DBD-DBMaker
view release on metacpan or search on metacpan
html/dbd-dbmaker.html view on Meta::CPAN
these attributes are read-only. Example: ... = $h->{NUM_OF_FIELDS}; #
get/read
<DL>
<DT><STRONG><A NAME="item_NUM_OF_FIELDS">NUM_OF_FIELDS (integer) read-only</A></STRONG><DD>
<P>
Number of fields (columns) the prepared statement will return. Non-select
statements will have NUM_OF_FIELDS = 0.
<DT><STRONG><A NAME="item_NUM_OF_PARAMS">NUM_OF_PARAMS (integer) read-only</A></STRONG><DD>
<P>
The number of parameters (placeholders) in the prepared statement.
<DT><STRONG><A NAME="item_NAME">NAME (array-ref) read-only</A></STRONG><DD>
<P>
Returns a *reference* to an array of field names for each column.
<P>
<PRE> Example:
print "First column name: $sth->{NAME}->[0]\n";
</PRE>
<DT><STRONG><A NAME="item_NAME_lc">NAME_lc (array-ref) read-only</A></STRONG><DD>
<P>
Like the NAME entry elsewhere in this document but always returns lowercase
names.
<DT><STRONG><A NAME="item_NAME_uc">NAME_uc (array-ref) read-only</A></STRONG><DD>
<P>
Like the NAME entry elsewhere in this document but always returns uppercase
names.
<DT><STRONG><A NAME="item_TYPE">TYPE (array-ref) read-only</A></STRONG><DD>
<P>
Returns a *reference* to an array of integer values for each column. The
value indicates the data type of the corresponding column.
<DT><STRONG><A NAME="item_PRECISION">PRECISION (array-ref) read-only</A></STRONG><DD>
<P>
Returns a *reference* to an array of integer values for each column. For
nonnumeric columns the value generally refers to either the maximum length
or the defined length of the column. For numeric columns the value refers
to the maximum number of significant digits used by the data type (without
considering a sign character or decimal point).
<DT><STRONG><A NAME="item_SCALE">SCALE (array-ref) read-only</A></STRONG><DD>
<P>
Returns a *reference* to an array of integer values for each column. NULL
(undef) values indicate columns where scale is not applicable.
<DT><STRONG><A NAME="item_NULLABLE">NULLABLE (array-ref) read-only</A></STRONG><DD>
<P>
Returns a *reference* to an array indicating the possibility of each column
returning a null: 0 = no, 1 = yes.
<P>
<PRE> Example:
print "First column may return NULL\n" if $sth->{NULLABLE}->[0];
</PRE>
<DT><STRONG><A NAME="item_CursorName">CursorName (string) read-only</A></STRONG><DD>
<P>
Returns the name of the cursor associated with the statement handle if
available.
<DT><STRONG><A NAME="item_Statement">Statement (string) read-only</A></STRONG><DD>
<P>
Returns the statement string passed to the the prepare entry elsewhere in
this document method.
<DT><STRONG><A NAME="item_RowsInCache">RowsInCache (integer) read-only, currently return undef.</A></STRONG><DD>
<P>
If the driver supports a local row cache for select statements then this
attribute holds the number of un-fetched rows in the cache. Currently
DBMaker will return undef for this value, while DBMaker will prefetch about
8K size's data into client side.
</DL>
<P>
<HR>
<H2><A NAME="Handling_BLOB_Fields_with_DBMake">Handling BLOB Fields with DBMaker</A></H2>
<P>
DBMaker support LONG VARCHAR, LONG VARBINARY and FILE data type for user to
store BLOB in the database. For easier handling with blob input/output,
DBMaker support the following method for user to store their blob file into
the database or retrieve their blob data to a user local file.
<DL>
<DT><STRONG><A NAME="item_Use">Use file as input parameter to a BLOB column</A></STRONG><DD>
<P>
Statement Attribute: dbmaker_file_input (default is 1)
<P>
a. Store file content for BLOB field
<P>
When this attribute value is 1 and user add quote for a file name as input
parameter value, and the parameter's SQL type is SQL_LONGVARCHAR/
SQL_LONGVARBINARY/SQL_FILE, DBMaker will store the file's content into
database.
<P>
<PRE> Example:
$dbh->do("create table blobt1 (c1 long varchar)");
my $sql=qq{INSERT INTO blobt1 values(?)};
my $sth = $dbh->prepare($sql);
# By default, DBMaker will try to open a blob file name (for example: test.gif),
# read the file and then store into the database
$sth->bind_param(1,"'test.gif'");
$sth->execute();
</PRE>
<P>
<PRE> # If you want to store a blob file name (for example: test.gif) with string quote
# into database
$sth->{dbmaker_file_input} = 0;
$sth->bind_param(1,"'test.gif'");
$sth->execute();
</PRE>
<P>
You can select c1 from this table and see what's the difference between
these two insert.
( run in 0.574 second using v1.01-cache-2.11-cpan-39bf76dae61 )