Author: timbo
Date: Tue Jun  2 03:05:32 2009
New Revision: 12804

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.pm

Log:
Added docs form column_info()'s COLUMN_DEF value.
Clarified docs on stickyness of data type via bind_param().
Clarified docs on stickyness of data type via bind_col().


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Tue Jun  2 03:05:32 2009
@@ -60,6 +60,10 @@
     added f_schema attribute
     table names case sensitive when quoted, insensitive when unquoted
 
+  Added docs form column_info()'s COLUMN_DEF value.
+  Clarified docs on stickyness of data type via bind_param().
+  Clarified docs on stickyness of data type via bind_col().
+
 =head2 Changes in DBI 1.608 (svn r12742) 5th May 2009
 
   Fixes to DBD::File (H.Merijn Brand)

Modified: dbi/trunk/DBI.pm
==============================================================================
--- dbi/trunk/DBI.pm    (original)
+++ dbi/trunk/DBI.pm    Tue Jun  2 03:05:32 2009
@@ -4611,7 +4611,23 @@
 
 B<REMARKS>: A description of the column.
 
-B<COLUMN_DEF>: The default value of the column.
+B<COLUMN_DEF>: The default value of the column, in a format that can be used
+directly in an SQL statement.
+
+Note that this may be an expression and not simply the text used for the
+default value in the original CREATE TABLE statement. For example, given:
+
+    col1 char(30) default current_user    -- a 'function'
+    col2 char(30) default 'string'        -- a string literal
+
+where "current_user" is the name of a function, the corresponding C<COLUMN_DEF>
+values would be:
+
+    Database        col1                     col2
+    --------        ----                     ----
+    Oracle:         current_user             'string'
+    Postgres:       "current_user"()         'string'::text
+    MS SQL:         (user_name())            ('string')
 
 B<SQL_DATA_TYPE>: The SQL data type.
 
@@ -5474,11 +5490,9 @@
 
 See L</"DBI Constants"> for more information.
 
-The data type for a placeholder cannot be changed after the first
-C<bind_param> call. In fact the whole \%attr parameter is 'sticky'
-in the sense that a driver only needs to consider the \%attr parameter
-for the first call, for a given $sth and parameter. After that the driver
-may ignore the \%attr parameter for that placeholder.
+The data type for a placeholder cannot be changed after the first C<bind_param>
+call. The data type is said to be 'sticky'. Bind values passed to execute()
+are bound with the data type specified by earlier bind_param() calls, if any.
 
 Perl only has string and number scalar data types. All database types
 that aren't numbers are bound as strings and must be in a format the
@@ -6133,7 +6147,7 @@
 native formatting the database would normally use.
 
 There's no $var_to_bind in that example to emphasize the point
-that bind_col() works on the underlying column value and not just
+that bind_col() works on the underlying column and not just
 a particular bound variable.
 
 As a short-cut for the common case, the data type can be passed
@@ -6152,10 +6166,9 @@
 
 See L</"DBI Constants"> for more information.
 
-The data type for a bind variable cannot be changed after the first
-C<bind_col> call. In fact the whole \%attr parameter is 'sticky'
-in the sense that a driver only needs to consider the \%attr parameter
-for the first call for a given $sth and column.
+Few drivers support specifying a data type via a C<bind_col> call (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.
 

Reply via email to