|
|
These attributes apply to statement handles that have been returned from a prepared query. Most of them are read-only and are specific to the statement handle.
CursorName (string, read-only)
The name of the cursor associated with the statement handle or undef if it cannot be obtained.
NAME (array-ref, read-only)
A reference to an array of fieldnames. Names can be uppercase, lowercase, or mixed case. Instead, use NAME_lc or NAME_uc for portability across systems.
For example, to display the second column, use the following:
$sth = $dbh->prepare("select * from customer"); $sth->execute; @row = $sth->fetchrow_array; print "Column 2: $sth->{NAME}->[1]";
NAME_hash (hash-ref, read-only)
Fieldname information returned as reference to a hash. Names can be uppercase, lowercase, or mixed case. The keys of the hash are the fieldnames, and the values are the field index (from 0 for the first field). Instead, use NAME_hash_lc or NAME_hash_uc for portability across systems.
For example:
$sth = $dbh->prepare("select first_name, surname from customer"); $sth->execute; @row = $sth->fetchrow_array; print "First name: $row[$sth->{NAME_hash}{first_name}]\n"; print "Surname: $row[$sth->{NAME_hash}{surname}]\n";
NAME_lc (array-ref, read-only)
The same as NAME but only returns lowercase names.
NAME_lc_hash (hash-ref, read-only)
The same as NAME_hash but only returns lowercase names.
NAME_uc (array-ref, read-only)
The same as NAME but only returns lowercase names.
NAME_uc_hash (hash-ref, read-only)
The same as NAME_hash but only returns uppercase names.
NULLABLE (array-ref, read-only)
A reference to an array of whether the field can contain nulls. Will contain 0 for no, 1 for yes, and 2 for unknown.
For example:
print "Field 1 can contain a NULL" if $sth->{NULLABLE}->[0];
NUM_OF_FIELDS (integer, read-only)
The number of fields that the prepared statement will return. It will be 0 for statements that do not return fields (INSERT, UPDATE, and so on).
NUM_OF_PARAMS (integer, read-only)
The number of placeholders in the prepared statement.
ParamValues (hash ref, read-only)
A reference to a hash containing the values bound to placeholders or undef if not available.
PRECISION (array-ref, read-only)
This is a reference to an array of integers for each field, referring to either the maximum length of the field (nonnumeric fields) or the maximum number of significant digits (not the display size—it excludes the sign, decimal point, E character, and so on).
RowsInCache (integer, read-only)
The number of unfetched rows in the cache or undef if the driver does not support a local row cache.
SCALE (array-ref, read-only)
Returns a reference to an array of integer values for each column. NULL (undef) values indicate columns where scale is not applicable.
Statement (string, read-only)
The last SQL query passed to the prepare() method.
TYPE (array-ref, read-only)
A reference to an array of integer values (representing the data type) for each field.
|
|