Author: timbo
Date: Fri Nov 27 08:33:14 2009
New Revision: 13614

Modified:
   dbi/trunk/DBI.pm

Log:
Tweaked the docs for bind_col to be slighly less focused on internals.
(Would be better to document DBI::sql_type_cast() and then have the bind_col()
docs refer to that for the fine detail.)


Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Fri Nov 27 08:33:14 2009
@@ -6248,15 +6248,28 @@
 (most will simply ignore the data type). Fewer still allow the data
 type to be altered once set.
 
+The TYPE attribute for bind_col() was first specified in DBI 1.41.
+
 From DBI 1.611, drivers can use the C<TYPE> attribute to attempt to
 cast the bound scalar to a perl type which more closely matches
 C<TYPE>. At present DBI supports C<SQL_INTEGER>, C<SQL_DOUBLE> and
-C<SQL_NUMERIC>. For C<SQL_INTEGER>, this means the perl scalar will be
-an IV, UV or NV; for C<SQL_DOUBLE> a NV and for C<SQL_NUMERIC> it will
-be an IV, UV or NV. What the bound perl scalar is cast to
-depends on the bound value and whether it fits in an IV, UV or NV.
+C<SQL_NUMERIC>.
 
-The TYPE attribute for bind_col() was first specified in DBI 1.41.
+For C<SQL_INTEGER> the effect is similar to using the value in an expression
+that requires an integer. It gives the perl scalar an 'integer aspect'.
+(Technically the value gains an IV, or possibly a UV or NV if the value is too
+large for an IV.)
+
+For C<SQL_DOUBLE> the effect is similar to using the value in an expression
+that requires a general numeric value. It gives the perl scalar a 'numeric
+aspect'.  (Technically the value gains an NV.)
+
+C<SQL_NUMERIC> is similar to C<SQL_INTEGER> or C<SQL_DOUBLE> but more general
+and more cautious.  It will look at the string first and if it looks like an
+integer (that will fit in an IV or UV) it will act like C<SQL_INTEGER>, if it
+looks like a floating point value it will act like C<SQL_DOUBLE>, if it looks
+like neither then it will do nothing--and thereby avoid the warnings that would
+be generated by C<SQL_INTEGER> and C<SQL_DOUBLE> when given non-numeric data.
 
 B<Other attributes for Column Binding>
 
@@ -6279,9 +6292,9 @@
 
 =item DiscardString
 
-When the C<TYPE> attribute is passed to bind_col and the driver
-successfully casts the bound perl scalar to a non-string type (e.g.,
-IV, UV, NV) then if C<DiscardString> is set to 1, the PV portion of the
+When the C<TYPE> attribute is passed to L</bind_col> and the driver
+successfully casts the bound perl scalar to a non-string type
+then if C<DiscardString> is set to 1, the string portion of the
 scalar will be discarded. By default, C<DiscardString> is not set.
 
 This attribute was first added in DBI 1.611. When 1.611 was released

Reply via email to