List:Commits« Previous MessageNext Message »
From:paul Date:February 12 2007 1:46am
Subject:svn commit - mysqldoc@docsrva: r4895 - in trunk: . refman-4.1 refman-5.0 refman-5.1
View as plain text  
Author: paul
Date: 2007-02-12 02:45:58 +0100 (Mon, 12 Feb 2007)
New Revision: 4895

Log:
 r16114@frost:  paul | 2007-02-11 19:45:00 -0600
 C API binary protocol:
 Additions to/corrections of information about type codes.


Modified:
   trunk/refman-4.1/apis-c.xml
   trunk/refman-5.0/apis-c.xml
   trunk/refman-5.1/apis-c.xml

Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:19666
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:16111
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:13520
   + 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:19666
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:16114
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:13520


Modified: trunk/refman-4.1/apis-c.xml
===================================================================
--- trunk/refman-4.1/apis-c.xml	2007-02-12 00:25:53 UTC (rev 4894)
+++ trunk/refman-4.1/apis-c.xml	2007-02-12 01:45:58 UTC (rev 4895)
Changed blocks: 12, Lines Added: 163, Lines Deleted: 68; 19446 bytes

@@ -714,12 +714,13 @@
         <para>
           To distinguish between binary and non-binary data for string
           data types, check whether the <literal>charsetnr</literal>
-          value is 63. If so, the character set is
-          <literal>binary</literal>, which indicates binary rather than
-          non-binary data. This is how to distinguish between
-          <literal>BINARY</literal> and <literal>CHAR</literal>,
-          <literal>VARBINARY</literal> and <literal>VARCHAR</literal>,
-          and <literal>BLOB</literal> and <literal>TEXT</literal>.
+          value is 63 (see <xref linkend="c-api-datatypes"/>). If so,
+          the character set is <literal>binary</literal>, which
+          indicates binary rather than non-binary data. This is how to
+          distinguish between <literal>BINARY</literal> and
+          <literal>CHAR</literal>, <literal>VARBINARY</literal> and
+          <literal>VARCHAR</literal>, and <literal>BLOB</literal> and
+          <literal>TEXT</literal>.
         </para>
       </listitem>
 

@@ -7992,13 +7993,15 @@
             </para>
 
             <para>
-              The type of the buffer. The allowable
+              The type of the buffer. This member indicates the data
+              type of the C language variable that you are binding to
+              the statement parameter. The allowable
               <literal>buffer_type</literal> values are listed later in
               this section. For input, <literal>buffer_type</literal>
-              indicates the data type of the C language variable that
-              you are binding to a statement parameter. For output, it
-              indicates the SQL data type of the value that you expect
-              to receive in a result buffer.
+              indicates the type of the variable containing the value
+              that you will send to the server. For output, it indicates
+              the type of the variable into which you want a value
+              received from the server to be stored.
             </para>
           </listitem>
 

@@ -8008,36 +8011,49 @@
             </para>
 
             <para>
+              A pointer to the buffer to be used for data transfer. This
+              is the address of a variable.
+            </para>
+
+            <para>
               For input, <literal>buffer</literal> is a pointer to the
-              buffer in which a statement parameter's data value is
+              variable in which a statement parameter's data value is
               stored. When you call
               <literal>mysql_stmt_execute()</literal>, MySQL takes the
-              value that you have stored in the buffer and uses it in
+              value that you have stored in the variable and uses it in
               place of the corresponding parameter marker in the
               statement.
             </para>
 
             <para>
               For output, <literal>buffer</literal> is a pointer to the
-              buffer in which to return a result set column value. When
-              you call <literal>mysql_stmt_fetch()</literal>, MySQL
-              returns a column value and stores it in this buffer. You
+              variable in which to return a result set column value.
+              When you call <literal>mysql_stmt_fetch()</literal>, MySQL
+              returns a column value and stores it in this variable. You
               can access the value when the call returns.
             </para>
 
             <para>
-              For character (non-binary) and binary string data types,
-              <literal>buffer</literal> should point to a character
-              buffer. For numeric data types, <literal>buffer</literal>
-              should point to a variable of the proper numeric C type.
-              (For <literal>char</literal> or integer variables, you
-              should also indicate whether the variable has the
+              To minimize the need for MySQL to perform type conversions
+              between C language values on the client side and SQL
+              values on the server side, use variables that have types
+              similar to those of the corresponding SQL values. For
+              numeric data types, <literal>buffer</literal> should point
+              to a variable of the proper numeric C type. (For
+              <literal>char</literal> or integer variables, you should
+              also indicate whether the variable has the
               <literal>unsigned</literal> attribute by setting the
               <literal>is_unsigned</literal> member, described later in
-              this list.) For date and time data types,
+              this list.) For character (non-binary) and binary string
+              data types, <literal>buffer</literal> should point to a
+              character buffer. For date and time data types,
               <literal>buffer</literal> should point to a
               <literal>MYSQL_TIME</literal> structure.
             </para>
+
+            <para>
+              See the notes about type conversions later in the section.
+            </para>
           </listitem>
 
           <listitem>

@@ -8132,9 +8148,11 @@
             </para>
 
             <para>
-              <literal>is_null</literal> is a pointer to a boolean
-              rather than a boolean scalar to provide flexibility in how
-              you specify <literal>NULL</literal> values:
+              The reason that <literal>is_null</literal> is not a
+              boolean scalar but is instead a
+              <emphasis>pointer</emphasis> to a boolean scalar is to
+              provide flexibility in how you specify
+              <literal>NULL</literal> values:
             </para>
 
             <itemizedlist>

@@ -8161,7 +8179,7 @@
               <listitem>
                 <para>
                   In all other cases, set the other members
-                  appriopriate, and set <literal>is_null</literal> to
+                  appriopriately, and set <literal>is_null</literal> to
                   the address of a <literal>my_bool</literal> variable.
                   Set that variable's value to true or false
                   appropriately between executions to indicate whether

@@ -8190,22 +8208,23 @@
               can be <literal>unsigned</literal>
               (<literal>char</literal>, <literal>short int</literal>,
               <literal>int</literal>, <literal>long long int</literal>).
-              integer types. Set <literal>is_unsigned</literal> to true
-              if the variable pointed to by <literal>buffer</literal> is
+              Set <literal>is_unsigned</literal> to true if the variable
+              pointed to by <literal>buffer</literal> is
               <literal>unsigned</literal> and false otherwise. For
               example, if you bind a <literal>char</literal> variable to
               <literal>buffer</literal>, specify a type code of
               <literal>MYSQL_TYPE_TINY</literal> and set
               <literal>is_unsigned</literal> to false. If you bind an
               <literal>unsigned char</literal> instead, the type code is
-              the same, but <literal>is_unsigned</literal> should be
+              the same but <literal>is_unsigned</literal> should be
               true.
             </para>
 
             <para>
-              <literal>is_unsigned</literal> indicates nothing about the
-              signedness of the SQL value that you are sending or
-              receiving. For example, if you use an
+              <literal>is_unsigned</literal> applies only to the C
+              language variable on the client side. It indicates nothing
+              about the signedness of the corresponding SQL value on the
+              server side. For example, if you use an
               <literal>int</literal> variable to supply a value for a
               <literal>BIGINT UNSIGNED</literal> column,
               <literal>is_unsigned</literal> should be false because

@@ -8330,69 +8349,87 @@
       value should be chosen according to the data type of the C
       language variable that you are binding. If the variable is
       <literal>unsigned</literal>, you should also set the
-      <literal>is_unsigned</literal> member to true.
+      <literal>is_unsigned</literal> member to true. The table shows the
+      C variable types that you can use, the corresponding type codes,
+      and the SQL data types for which the the supplied value can be
+      used without conversion.
     </para>
 
     <informaltable>
-      <tgroup cols="2">
+      <tgroup cols="3">
         <colspec colwidth="30*"/>
-        <colspec colwidth="70*"/>
+        <colspec colwidth="40*"/>
+        <colspec colwidth="30*"/>
         <tbody>
           <row>
-            <entry><emphasis role="bold">C Variable Type</emphasis></entry>
+            <entry><emphasis role="bold">Input Variable C Type</emphasis></entry>
             <entry><literal>buffer_type</literal> <emphasis role="bold">Value</emphasis></entry>
+            <entry><emphasis role="bold">SQL Type of Destination Value</emphasis></entry>
           </row>
           <row>
             <entry><literal>char</literal></entry>
             <entry><literal>MYSQL_TYPE_TINY</literal></entry>
+            <entry><literal>TINYINT</literal></entry>
           </row>
           <row>
             <entry><literal>short int</literal></entry>
             <entry><literal>MYSQL_TYPE_SHORT</literal></entry>
+            <entry><literal>SMALLINT</literal></entry>
           </row>
           <row>
             <entry><literal>int</literal></entry>
             <entry><literal>MYSQL_TYPE_LONG</literal></entry>
+            <entry><literal>INT</literal></entry>
           </row>
           <row>
             <entry><literal>long long int</literal></entry>
             <entry><literal>MYSQL_TYPE_LONGLONG</literal></entry>
+            <entry><literal>BIGINT</literal></entry>
           </row>
           <row>
             <entry><literal>float</literal></entry>
             <entry><literal>MYSQL_TYPE_FLOAT</literal></entry>
+            <entry><literal>FLOAT</literal></entry>
           </row>
           <row>
             <entry><literal>double</literal></entry>
             <entry><literal>MYSQL_TYPE_DOUBLE</literal></entry>
+            <entry><literal>DOUBLE</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIME</literal></entry>
+            <entry><literal>TIME</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_DATE</literal></entry>
+            <entry><literal>DATE</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_DATETIME</literal></entry>
+            <entry><literal>DATETIME</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIMESTAMP</literal></entry>
+            <entry><literal>TIMESTAMP</literal></entry>
           </row>
           <row>
             <entry><literal>char[]</literal></entry>
             <entry><literal>MYSQL_TYPE_STRING</literal> (for non-binary data)</entry>
+            <entry><literal>TEXT, CHAR, VARCHAR</literal></entry>
           </row>
           <row>
             <entry><literal>char[]</literal></entry>
             <entry><literal>MYSQL_TYPE_BLOB</literal> (for binary data)</entry>
+            <entry><literal>BLOB, BINARY, VARBINARY</literal></entry>
           </row>
           <row>
             <entry/>
             <entry><literal>MYSQL_TYPE_NULL</literal></entry>
+            <entry><literal>NULL</literal></entry>
           </row>
         </tbody>
       </tgroup>

@@ -8407,13 +8444,16 @@
       The following table shows the allowable values that may be
       specified in the <literal>buffer_type</literal> member of
       <literal>MYSQL_BIND</literal> structures for output values. The
-      value should be chosen according to the SQL data type of the value
-      that you receive from the server. The table also shows the
-      recommended type of C language variable to bind to the
-      <literal>MYSQL_BIND</literal> structure for each SQL type. If you
-      use an <literal>unsigned</literal> variable, you should also set
-      the <literal>is_unsigned</literal> member to true. Note that
-      <literal>DECIMAL</literal> values are returned as strings.
+      value should be chosen according to the data type of the C
+      language variable that you are binding. If the variable is
+      <literal>unsigned</literal>, you should also set the
+      <literal>is_unsigned</literal> member to true. The table shows the
+      SQL types of recieved values, the corresponding type code that
+      such values have in result set metadata, and the recommended C
+      language data types to bind to the <literal>MYSQL_BIND</literal>
+      structure to receive the SQL values without conversion. Note that
+      <literal>DECIMAL</literal> values are returned as strings, which
+      is why the corresponding C type is <literal>char[]</literal>.
     </para>
 
     <informaltable>

@@ -8423,9 +8463,9 @@
         <colspec colwidth="35*"/>
         <tbody>
           <row>
-            <entry><emphasis role="bold">SQL Type</emphasis></entry>
+            <entry><emphasis role="bold">SQL Type of Received Value</emphasis></entry>
             <entry><literal>buffer_type</literal> <emphasis role="bold">Value</emphasis></entry>
-            <entry><emphasis role="bold">Recommended C Type</emphasis></entry>
+            <entry><emphasis role="bold">Output Variable C Type</emphasis></entry>
           </row>
           <row>
             <entry><literal>TINYINT</literal></entry>

@@ -8458,6 +8498,11 @@
             <entry><literal>double</literal></entry>
           </row>
           <row>
+            <entry><literal>YEAR</literal></entry>
+            <entry><literal>MYSQL_TYPE_SHORT</literal></entry>
+            <entry><literal>short int</literal></entry>
+          </row>
+          <row>
             <entry><literal>TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIME</literal></entry>
             <entry><literal>MYSQL_TIME</literal></entry>

@@ -8512,23 +8557,73 @@
     </informaltable>
 
     <para>
-      The C language variable types are <quote>recommended</quote>
-      because implicit type conversion may be performed in both
-      directions. The <literal>buffer_type</literal> value controls the
-      conversion that will be performed. For example, to fetch a SQL
-      <literal>MEDIUMINT</literal> column value, you can specify a
-      <literal>buffer_type</literal> value of
-      <literal>MYSQL_TYPE_LONG</literal> and use a C variable of type
-      <literal>int</literal> as the destination buffer. If you fetch a
-      numeric column with a value of 255 into a
-      <literal>char[4]</literal> character array, specify a
-      <literal>buffer_type</literal> value of
-      <literal>MYSQL_TYPE_STRING</literal> and the resulting value in
-      the array will be a 4-byte string containing
-      <literal>'255\0'</literal>.
+      The C language variable types are those recommended if you want to
+      avoid type conversions. If there is a mismatch between the C
+      variable type on the client side and the corresponding SQL value
+      on the server side, MySQL performs implicit type conversions in
+      both directions.
     </para>
 
     <para>
+      MySQL knows the type code for the SQL value on the server side.
+      The <literal>buffer_type</literal> value indicates the MySQL the
+      type code of the C variable that holds the value on the client
+      side. The two codes together tell MySQL what conversion must be
+      performed, if any. Here are some examples:
+    </para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>
+          If you use <literal>MYSQL_TYPE_LONG</literal> with an
+          <literal>int</literal> variable to pass an integer value to
+          the server that is to be stored into a
+          <literal>FLOAT</literal> column, MySQL converts the value to
+          floating-point format before storing it.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          To fetch a SQL <literal>MEDIUMINT</literal> column value, you
+          can specify a <literal>buffer_type</literal> value of
+          <literal>MYSQL_TYPE_LONG</literal> and use a C variable of
+          type <literal>int</literal> as the destination buffer. MySQL
+          will convert the <literal>MEDIUMINT</literal> value (a 3-byte
+          value) for storage into the <literal>int</literal> (a 4-byte
+          variable).
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          If you fetch a numeric column with a value of 255 into a
+          <literal>char[4]</literal> character array, specify a
+          <literal>buffer_type</literal> value of
+          <literal>MYSQL_TYPE_STRING</literal> and the resulting value
+          in the array will be a 4-byte string containing
+          <literal>'255\0'</literal>.
+        </para>
+      </listitem>
+
+    </itemizedlist>
+
+    <para>
+      Before binding variables to the <literal>MYSQL_BIND</literal>
+      structures that are to be used for fetching the column values, you
+      can check the type codes for the columns of a result set. This
+      might be desirable if you want to determine which variable types
+      would be best to use to avoid type conversions. To get the type
+      codes, call <literal>mysql_stmt_result_metadata()</literal> after
+      executing the prepared statement with
+      <literal>mysql_stmt_execute()</literal>. The metadata provides
+      access to the type codes for the result set as described in
+      <xref linkend="mysql-stmt-result-metadata"/>, and
+      <xref linkend="c-api-datatypes"/>.
+    </para>
+
+    <para>
       For input character (non-binary) string data (indicated by
       <literal>MYSQL_TYPE_STRING</literal>), the value is assumed to be
       in the character set indicated by the

@@ -8542,15 +8637,15 @@
     </para>
 
     <para>
-      To determine whether string values in a result set returned from
-      the server contain binary or non-binary data, check whether the
-      <literal>charsetnr</literal> value of the result set metadata is
-      63. If so, the character set is <literal>binary</literal>, which
-      indicates binary rather than non-binary data. This enables you to
-      distinguish between <literal>BINARY</literal> and
+      To determine whether output string values in a result set returned
+      from the server contain binary or non-binary data, check whether
+      the <literal>charsetnr</literal> value of the result set metadata
+      is 63. If so, the character set is <literal>binary</literal>,
+      which indicates binary rather than non-binary data. This enables
+      you to distinguish between <literal>BINARY</literal> and
       <literal>CHAR</literal>, <literal>VARBINARY</literal> and
-      <literal>VARCHAR</literal>, and <literal>BLOB</literal> and
-      <literal>TEXT</literal>.
+      <literal>VARCHAR</literal>, and the <literal>BLOB</literal> and
+      <literal>TEXT</literal> types.
     </para>
 
   </section>


Modified: trunk/refman-5.0/apis-c.xml
===================================================================
--- trunk/refman-5.0/apis-c.xml	2007-02-12 00:25:53 UTC (rev 4894)
+++ trunk/refman-5.0/apis-c.xml	2007-02-12 01:45:58 UTC (rev 4895)
Changed blocks: 12, Lines Added: 163, Lines Deleted: 68; 19442 bytes

@@ -713,12 +713,13 @@
         <para>
           To distinguish between binary and non-binary data for string
           data types, check whether the <literal>charsetnr</literal>
-          value is 63. If so, the character set is
-          <literal>binary</literal>, which indicates binary rather than
-          non-binary data. This is how to distinguish between
-          <literal>BINARY</literal> and <literal>CHAR</literal>,
-          <literal>VARBINARY</literal> and <literal>VARCHAR</literal>,
-          and <literal>BLOB</literal> and <literal>TEXT</literal>.
+          value is 63 (see <xref linkend="c-api-datatypes"/>). If so,
+          the character set is <literal>binary</literal>, which
+          indicates binary rather than non-binary data. This is how to
+          distinguish between <literal>BINARY</literal> and
+          <literal>CHAR</literal>, <literal>VARBINARY</literal> and
+          <literal>VARCHAR</literal>, and <literal>BLOB</literal> and
+          <literal>TEXT</literal>.
         </para>
       </listitem>
 

@@ -8083,13 +8084,15 @@
             </para>
 
             <para>
-              The type of the buffer. The allowable
+              The type of the buffer. This member indicates the data
+              type of the C language variable that you are binding to
+              the statement parameter. The allowable
               <literal>buffer_type</literal> values are listed later in
               this section. For input, <literal>buffer_type</literal>
-              indicates the data type of the C language variable that
-              you are binding to a statement parameter. For output, it
-              indicates the SQL data type of the value that you expect
-              to receive in a result buffer.
+              indicates the type of the variable containing the value
+              that you will send to the server. For output, it indicates
+              the type of the variable into which you want a value
+              received from the server to be stored.
             </para>
           </listitem>
 

@@ -8099,36 +8102,49 @@
             </para>
 
             <para>
+              A pointer to the buffer to be used for data transfer. This
+              is the address of a variable.
+            </para>
+
+            <para>
               For input, <literal>buffer</literal> is a pointer to the
-              buffer in which a statement parameter's data value is
+              variable in which a statement parameter's data value is
               stored. When you call
               <literal>mysql_stmt_execute()</literal>, MySQL takes the
-              value that you have stored in the buffer and uses it in
+              value that you have stored in the variable and uses it in
               place of the corresponding parameter marker in the
               statement.
             </para>
 
             <para>
               For output, <literal>buffer</literal> is a pointer to the
-              buffer in which to return a result set column value. When
-              you call <literal>mysql_stmt_fetch()</literal>, MySQL
-              returns a column value and stores it in this buffer. You
+              variable in which to return a result set column value.
+              When you call <literal>mysql_stmt_fetch()</literal>, MySQL
+              returns a column value and stores it in this variable. You
               can access the value when the call returns.
             </para>
 
             <para>
-              For character (non-binary) and binary string data types,
-              <literal>buffer</literal> should point to a character
-              buffer. For numeric data types, <literal>buffer</literal>
-              should point to a variable of the proper numeric C type.
-              (For <literal>char</literal> or integer variables, you
-              should also indicate whether the variable has the
+              To minimize the need for MySQL to perform type conversions
+              between C language values on the client side and SQL
+              values on the server side, use variables that have types
+              similar to those of the corresponding SQL values. For
+              numeric data types, <literal>buffer</literal> should point
+              to a variable of the proper numeric C type. (For
+              <literal>char</literal> or integer variables, you should
+              also indicate whether the variable has the
               <literal>unsigned</literal> attribute by setting the
               <literal>is_unsigned</literal> member, described later in
-              this list.) For date and time data types,
+              this list.) For character (non-binary) and binary string
+              data types, <literal>buffer</literal> should point to a
+              character buffer. For date and time data types,
               <literal>buffer</literal> should point to a
               <literal>MYSQL_TIME</literal> structure.
             </para>
+
+            <para>
+              See the notes about type conversions later in the section.
+            </para>
           </listitem>
 
           <listitem>

@@ -8223,9 +8239,11 @@
             </para>
 
             <para>
-              <literal>is_null</literal> is a pointer to a boolean
-              rather than a boolean scalar to provide flexibility in how
-              you specify <literal>NULL</literal> values:
+              The reason that <literal>is_null</literal> is not a
+              boolean scalar but is instead a
+              <emphasis>pointer</emphasis> to a boolean scalar is to
+              provide flexibility in how you specify
+              <literal>NULL</literal> values:
             </para>
 
             <itemizedlist>

@@ -8252,7 +8270,7 @@
               <listitem>
                 <para>
                   In all other cases, set the other members
-                  appriopriate, and set <literal>is_null</literal> to
+                  appriopriately, and set <literal>is_null</literal> to
                   the address of a <literal>my_bool</literal> variable.
                   Set that variable's value to true or false
                   appropriately between executions to indicate whether

@@ -8281,22 +8299,23 @@
               can be <literal>unsigned</literal>
               (<literal>char</literal>, <literal>short int</literal>,
               <literal>int</literal>, <literal>long long int</literal>).
-              integer types. Set <literal>is_unsigned</literal> to true
-              if the variable pointed to by <literal>buffer</literal> is
+              Set <literal>is_unsigned</literal> to true if the variable
+              pointed to by <literal>buffer</literal> is
               <literal>unsigned</literal> and false otherwise. For
               example, if you bind a <literal>char</literal> variable to
               <literal>buffer</literal>, specify a type code of
               <literal>MYSQL_TYPE_TINY</literal> and set
               <literal>is_unsigned</literal> to false. If you bind an
               <literal>unsigned char</literal> instead, the type code is
-              the same, but <literal>is_unsigned</literal> should be
+              the same but <literal>is_unsigned</literal> should be
               true.
             </para>
 
             <para>
-              <literal>is_unsigned</literal> indicates nothing about the
-              signedness of the SQL value that you are sending or
-              receiving. For example, if you use an
+              <literal>is_unsigned</literal> applies only to the C
+              language variable on the client side. It indicates nothing
+              about the signedness of the corresponding SQL value on the
+              server side. For example, if you use an
               <literal>int</literal> variable to supply a value for a
               <literal>BIGINT UNSIGNED</literal> column,
               <literal>is_unsigned</literal> should be false because

@@ -8446,69 +8465,87 @@
       value should be chosen according to the data type of the C
       language variable that you are binding. If the variable is
       <literal>unsigned</literal>, you should also set the
-      <literal>is_unsigned</literal> member to true.
+      <literal>is_unsigned</literal> member to true. The table shows the
+      C variable types that you can use, the corresponding type codes,
+      and the SQL data types for which the the supplied value can be
+      used without conversion.
     </para>
 
     <informaltable>
-      <tgroup cols="2">
+      <tgroup cols="3">
         <colspec colwidth="30*"/>
-        <colspec colwidth="70*"/>
+        <colspec colwidth="40*"/>
+        <colspec colwidth="30*"/>
         <tbody>
           <row>
-            <entry><emphasis role="bold">C Variable Type</emphasis></entry>
+            <entry><emphasis role="bold">Input Variable C Type</emphasis></entry>
             <entry><literal>buffer_type</literal> <emphasis role="bold">Value</emphasis></entry>
+            <entry><emphasis role="bold">SQL Type of Destination Value</emphasis></entry>
           </row>
           <row>
             <entry><literal>char</literal></entry>
             <entry><literal>MYSQL_TYPE_TINY</literal></entry>
+            <entry><literal>TINYINT</literal></entry>
           </row>
           <row>
             <entry><literal>short int</literal></entry>
             <entry><literal>MYSQL_TYPE_SHORT</literal></entry>
+            <entry><literal>SMALLINT</literal></entry>
           </row>
           <row>
             <entry><literal>int</literal></entry>
             <entry><literal>MYSQL_TYPE_LONG</literal></entry>
+            <entry><literal>INT</literal></entry>
           </row>
           <row>
             <entry><literal>long long int</literal></entry>
             <entry><literal>MYSQL_TYPE_LONGLONG</literal></entry>
+            <entry><literal>BIGINT</literal></entry>
           </row>
           <row>
             <entry><literal>float</literal></entry>
             <entry><literal>MYSQL_TYPE_FLOAT</literal></entry>
+            <entry><literal>FLOAT</literal></entry>
           </row>
           <row>
             <entry><literal>double</literal></entry>
             <entry><literal>MYSQL_TYPE_DOUBLE</literal></entry>
+            <entry><literal>DOUBLE</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIME</literal></entry>
+            <entry><literal>TIME</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_DATE</literal></entry>
+            <entry><literal>DATE</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_DATETIME</literal></entry>
+            <entry><literal>DATETIME</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIMESTAMP</literal></entry>
+            <entry><literal>TIMESTAMP</literal></entry>
           </row>
           <row>
             <entry><literal>char[]</literal></entry>
             <entry><literal>MYSQL_TYPE_STRING</literal> (for non-binary data)</entry>
+            <entry><literal>TEXT, CHAR, VARCHAR</literal></entry>
           </row>
           <row>
             <entry><literal>char[]</literal></entry>
             <entry><literal>MYSQL_TYPE_BLOB</literal> (for binary data)</entry>
+            <entry><literal>BLOB, BINARY, VARBINARY</literal></entry>
           </row>
           <row>
             <entry/>
             <entry><literal>MYSQL_TYPE_NULL</literal></entry>
+            <entry><literal>NULL</literal></entry>
           </row>
         </tbody>
       </tgroup>

@@ -8523,13 +8560,16 @@
       The following table shows the allowable values that may be
       specified in the <literal>buffer_type</literal> member of
       <literal>MYSQL_BIND</literal> structures for output values. The
-      value should be chosen according to the SQL data type of the value
-      that you receive from the server. The table also shows the
-      recommended type of C language variable to bind to the
-      <literal>MYSQL_BIND</literal> structure for each SQL type. If you
-      use an <literal>unsigned</literal> variable, you should also set
-      the <literal>is_unsigned</literal> member to true. Note that
-      <literal>DECIMAL</literal> values are returned as strings.
+      value should be chosen according to the data type of the C
+      language variable that you are binding. If the variable is
+      <literal>unsigned</literal>, you should also set the
+      <literal>is_unsigned</literal> member to true. The table shows the
+      SQL types of recieved values, the corresponding type code that
+      such values have in result set metadata, and the recommended C
+      language data types to bind to the <literal>MYSQL_BIND</literal>
+      structure to receive the SQL values without conversion. Note that
+      <literal>DECIMAL</literal> values are returned as strings, which
+      is why the corresponding C type is <literal>char[]</literal>.
     </para>
 
     <informaltable>

@@ -8539,9 +8579,9 @@
         <colspec colwidth="35*"/>
         <tbody>
           <row>
-            <entry><emphasis role="bold">SQL Type</emphasis></entry>
+            <entry><emphasis role="bold">SQL Type of Received Value</emphasis></entry>
             <entry><literal>buffer_type</literal> <emphasis role="bold">Value</emphasis></entry>
-            <entry><emphasis role="bold">Recommended C Type</emphasis></entry>
+            <entry><emphasis role="bold">Output Variable C Type</emphasis></entry>
           </row>
           <row>
             <entry><literal>BIT</literal></entry>

@@ -8584,6 +8624,11 @@
             <entry><literal>char[]</literal></entry>
           </row>
           <row>
+            <entry><literal>YEAR</literal></entry>
+            <entry><literal>MYSQL_TYPE_SHORT</literal></entry>
+            <entry><literal>short int</literal></entry>
+          </row>
+          <row>
             <entry><literal>TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIME</literal></entry>
             <entry><literal>MYSQL_TIME</literal></entry>

@@ -8638,23 +8683,73 @@
     </informaltable>
 
     <para>
-      The C language variable types are <quote>recommended</quote>
-      because implicit type conversion may be performed in both
-      directions. The <literal>buffer_type</literal> value controls the
-      conversion that will be performed. For example, to fetch a SQL
-      <literal>MEDIUMINT</literal> column value, you can specify a
-      <literal>buffer_type</literal> value of
-      <literal>MYSQL_TYPE_LONG</literal> and use a C variable of type
-      <literal>int</literal> as the destination buffer. If you fetch a
-      numeric column with a value of 255 into a
-      <literal>char[4]</literal> character array, specify a
-      <literal>buffer_type</literal> value of
-      <literal>MYSQL_TYPE_STRING</literal> and the resulting value in
-      the array will be a 4-byte string containing
-      <literal>'255\0'</literal>.
+      The C language variable types are those recommended if you want to
+      avoid type conversions. If there is a mismatch between the C
+      variable type on the client side and the corresponding SQL value
+      on the server side, MySQL performs implicit type conversions in
+      both directions.
     </para>
 
     <para>
+      MySQL knows the type code for the SQL value on the server side.
+      The <literal>buffer_type</literal> value indicates the MySQL the
+      type code of the C variable that holds the value on the client
+      side. The two codes together tell MySQL what conversion must be
+      performed, if any. Here are some examples:
+    </para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>
+          If you use <literal>MYSQL_TYPE_LONG</literal> with an
+          <literal>int</literal> variable to pass an integer value to
+          the server that is to be stored into a
+          <literal>FLOAT</literal> column, MySQL converts the value to
+          floating-point format before storing it.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          To fetch a SQL <literal>MEDIUMINT</literal> column value, you
+          can specify a <literal>buffer_type</literal> value of
+          <literal>MYSQL_TYPE_LONG</literal> and use a C variable of
+          type <literal>int</literal> as the destination buffer. MySQL
+          will convert the <literal>MEDIUMINT</literal> value (a 3-byte
+          value) for storage into the <literal>int</literal> (a 4-byte
+          variable).
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          If you fetch a numeric column with a value of 255 into a
+          <literal>char[4]</literal> character array, specify a
+          <literal>buffer_type</literal> value of
+          <literal>MYSQL_TYPE_STRING</literal> and the resulting value
+          in the array will be a 4-byte string containing
+          <literal>'255\0'</literal>.
+        </para>
+      </listitem>
+
+    </itemizedlist>
+
+    <para>
+      Before binding variables to the <literal>MYSQL_BIND</literal>
+      structures that are to be used for fetching the column values, you
+      can check the type codes for the columns of a result set. This
+      might be desirable if you want to determine which variable types
+      would be best to use to avoid type conversions. To get the type
+      codes, call <literal>mysql_stmt_result_metadata()</literal> after
+      executing the prepared statement with
+      <literal>mysql_stmt_execute()</literal>. The metadata provides
+      access to the type codes for the result set as described in
+      <xref linkend="mysql-stmt-result-metadata"/>, and
+      <xref linkend="c-api-datatypes"/>.
+    </para>
+
+    <para>
       For input character (non-binary) string data (indicated by
       <literal>MYSQL_TYPE_STRING</literal>), the value is assumed to be
       in the character set indicated by the

@@ -8668,15 +8763,15 @@
     </para>
 
     <para>
-      To determine whether string values in a result set returned from
-      the server contain binary or non-binary data, check whether the
-      <literal>charsetnr</literal> value of the result set metadata is
-      63. If so, the character set is <literal>binary</literal>, which
-      indicates binary rather than non-binary data. This enables you to
-      distinguish between <literal>BINARY</literal> and
+      To determine whether output string values in a result set returned
+      from the server contain binary or non-binary data, check whether
+      the <literal>charsetnr</literal> value of the result set metadata
+      is 63. If so, the character set is <literal>binary</literal>,
+      which indicates binary rather than non-binary data. This enables
+      you to distinguish between <literal>BINARY</literal> and
       <literal>CHAR</literal>, <literal>VARBINARY</literal> and
-      <literal>VARCHAR</literal>, and <literal>BLOB</literal> and
-      <literal>TEXT</literal>.
+      <literal>VARCHAR</literal>, and the <literal>BLOB</literal> and
+      <literal>TEXT</literal> types.
     </para>
 
   </section>


Modified: trunk/refman-5.1/apis-c.xml
===================================================================
--- trunk/refman-5.1/apis-c.xml	2007-02-12 00:25:53 UTC (rev 4894)
+++ trunk/refman-5.1/apis-c.xml	2007-02-12 01:45:58 UTC (rev 4895)
Changed blocks: 12, Lines Added: 163, Lines Deleted: 68; 19442 bytes

@@ -712,12 +712,13 @@
         <para>
           To distinguish between binary and non-binary data for string
           data types, check whether the <literal>charsetnr</literal>
-          value is 63. If so, the character set is
-          <literal>binary</literal>, which indicates binary rather than
-          non-binary data. This is how to distinguish between
-          <literal>BINARY</literal> and <literal>CHAR</literal>,
-          <literal>VARBINARY</literal> and <literal>VARCHAR</literal>,
-          and <literal>BLOB</literal> and <literal>TEXT</literal>.
+          value is 63 (see <xref linkend="c-api-datatypes"/>). If so,
+          the character set is <literal>binary</literal>, which
+          indicates binary rather than non-binary data. This is how to
+          distinguish between <literal>BINARY</literal> and
+          <literal>CHAR</literal>, <literal>VARBINARY</literal> and
+          <literal>VARCHAR</literal>, and <literal>BLOB</literal> and
+          <literal>TEXT</literal>.
         </para>
       </listitem>
 

@@ -8202,13 +8203,15 @@
             </para>
 
             <para>
-              The type of the buffer. The allowable
+              The type of the buffer. This member indicates the data
+              type of the C language variable that you are binding to
+              the statement parameter. The allowable
               <literal>buffer_type</literal> values are listed later in
               this section. For input, <literal>buffer_type</literal>
-              indicates the data type of the C language variable that
-              you are binding to a statement parameter. For output, it
-              indicates the SQL data type of the value that you expect
-              to receive in a result buffer.
+              indicates the type of the variable containing the value
+              that you will send to the server. For output, it indicates
+              the type of the variable into which you want a value
+              received from the server to be stored.
             </para>
           </listitem>
 

@@ -8218,36 +8221,49 @@
             </para>
 
             <para>
+              A pointer to the buffer to be used for data transfer. This
+              is the address of a variable.
+            </para>
+
+            <para>
               For input, <literal>buffer</literal> is a pointer to the
-              buffer in which a statement parameter's data value is
+              variable in which a statement parameter's data value is
               stored. When you call
               <literal>mysql_stmt_execute()</literal>, MySQL takes the
-              value that you have stored in the buffer and uses it in
+              value that you have stored in the variable and uses it in
               place of the corresponding parameter marker in the
               statement.
             </para>
 
             <para>
               For output, <literal>buffer</literal> is a pointer to the
-              buffer in which to return a result set column value. When
-              you call <literal>mysql_stmt_fetch()</literal>, MySQL
-              returns a column value and stores it in this buffer. You
+              variable in which to return a result set column value.
+              When you call <literal>mysql_stmt_fetch()</literal>, MySQL
+              returns a column value and stores it in this variable. You
               can access the value when the call returns.
             </para>
 
             <para>
-              For character (non-binary) and binary string data types,
-              <literal>buffer</literal> should point to a character
-              buffer. For numeric data types, <literal>buffer</literal>
-              should point to a variable of the proper numeric C type.
-              (For <literal>char</literal> or integer variables, you
-              should also indicate whether the variable has the
+              To minimize the need for MySQL to perform type conversions
+              between C language values on the client side and SQL
+              values on the server side, use variables that have types
+              similar to those of the corresponding SQL values. For
+              numeric data types, <literal>buffer</literal> should point
+              to a variable of the proper numeric C type. (For
+              <literal>char</literal> or integer variables, you should
+              also indicate whether the variable has the
               <literal>unsigned</literal> attribute by setting the
               <literal>is_unsigned</literal> member, described later in
-              this list.) For date and time data types,
+              this list.) For character (non-binary) and binary string
+              data types, <literal>buffer</literal> should point to a
+              character buffer. For date and time data types,
               <literal>buffer</literal> should point to a
               <literal>MYSQL_TIME</literal> structure.
             </para>
+
+            <para>
+              See the notes about type conversions later in the section.
+            </para>
           </listitem>
 
           <listitem>

@@ -8342,9 +8358,11 @@
             </para>
 
             <para>
-              <literal>is_null</literal> is a pointer to a boolean
-              rather than a boolean scalar to provide flexibility in how
-              you specify <literal>NULL</literal> values:
+              The reason that <literal>is_null</literal> is not a
+              boolean scalar but is instead a
+              <emphasis>pointer</emphasis> to a boolean scalar is to
+              provide flexibility in how you specify
+              <literal>NULL</literal> values:
             </para>
 
             <itemizedlist>

@@ -8371,7 +8389,7 @@
               <listitem>
                 <para>
                   In all other cases, set the other members
-                  appriopriate, and set <literal>is_null</literal> to
+                  appriopriately, and set <literal>is_null</literal> to
                   the address of a <literal>my_bool</literal> variable.
                   Set that variable's value to true or false
                   appropriately between executions to indicate whether

@@ -8400,22 +8418,23 @@
               can be <literal>unsigned</literal>
               (<literal>char</literal>, <literal>short int</literal>,
               <literal>int</literal>, <literal>long long int</literal>).
-              integer types. Set <literal>is_unsigned</literal> to true
-              if the variable pointed to by <literal>buffer</literal> is
+              Set <literal>is_unsigned</literal> to true if the variable
+              pointed to by <literal>buffer</literal> is
               <literal>unsigned</literal> and false otherwise. For
               example, if you bind a <literal>char</literal> variable to
               <literal>buffer</literal>, specify a type code of
               <literal>MYSQL_TYPE_TINY</literal> and set
               <literal>is_unsigned</literal> to false. If you bind an
               <literal>unsigned char</literal> instead, the type code is
-              the same, but <literal>is_unsigned</literal> should be
+              the same but <literal>is_unsigned</literal> should be
               true.
             </para>
 
             <para>
-              <literal>is_unsigned</literal> indicates nothing about the
-              signedness of the SQL value that you are sending or
-              receiving. For example, if you use an
+              <literal>is_unsigned</literal> applies only to the C
+              language variable on the client side. It indicates nothing
+              about the signedness of the corresponding SQL value on the
+              server side. For example, if you use an
               <literal>int</literal> variable to supply a value for a
               <literal>BIGINT UNSIGNED</literal> column,
               <literal>is_unsigned</literal> should be false because

@@ -8564,69 +8583,87 @@
       value should be chosen according to the data type of the C
       language variable that you are binding. If the variable is
       <literal>unsigned</literal>, you should also set the
-      <literal>is_unsigned</literal> member to true.
+      <literal>is_unsigned</literal> member to true. The table shows the
+      C variable types that you can use, the corresponding type codes,
+      and the SQL data types for which the the supplied value can be
+      used without conversion.
     </para>
 
     <informaltable>
-      <tgroup cols="2">
+      <tgroup cols="3">
         <colspec colwidth="30*"/>
-        <colspec colwidth="70*"/>
+        <colspec colwidth="40*"/>
+        <colspec colwidth="30*"/>
         <tbody>
           <row>
-            <entry><emphasis role="bold">C Variable Type</emphasis></entry>
+            <entry><emphasis role="bold">Input Variable C Type</emphasis></entry>
             <entry><literal>buffer_type</literal> <emphasis role="bold">Value</emphasis></entry>
+            <entry><emphasis role="bold">SQL Type of Destination Value</emphasis></entry>
           </row>
           <row>
             <entry><literal>char</literal></entry>
             <entry><literal>MYSQL_TYPE_TINY</literal></entry>
+            <entry><literal>TINYINT</literal></entry>
           </row>
           <row>
             <entry><literal>short int</literal></entry>
             <entry><literal>MYSQL_TYPE_SHORT</literal></entry>
+            <entry><literal>SMALLINT</literal></entry>
           </row>
           <row>
             <entry><literal>int</literal></entry>
             <entry><literal>MYSQL_TYPE_LONG</literal></entry>
+            <entry><literal>INT</literal></entry>
           </row>
           <row>
             <entry><literal>long long int</literal></entry>
             <entry><literal>MYSQL_TYPE_LONGLONG</literal></entry>
+            <entry><literal>BIGINT</literal></entry>
           </row>
           <row>
             <entry><literal>float</literal></entry>
             <entry><literal>MYSQL_TYPE_FLOAT</literal></entry>
+            <entry><literal>FLOAT</literal></entry>
           </row>
           <row>
             <entry><literal>double</literal></entry>
             <entry><literal>MYSQL_TYPE_DOUBLE</literal></entry>
+            <entry><literal>DOUBLE</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIME</literal></entry>
+            <entry><literal>TIME</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_DATE</literal></entry>
+            <entry><literal>DATE</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_DATETIME</literal></entry>
+            <entry><literal>DATETIME</literal></entry>
           </row>
           <row>
             <entry><literal>MYSQL_TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIMESTAMP</literal></entry>
+            <entry><literal>TIMESTAMP</literal></entry>
           </row>
           <row>
             <entry><literal>char[]</literal></entry>
             <entry><literal>MYSQL_TYPE_STRING</literal> (for non-binary data)</entry>
+            <entry><literal>TEXT, CHAR, VARCHAR</literal></entry>
           </row>
           <row>
             <entry><literal>char[]</literal></entry>
             <entry><literal>MYSQL_TYPE_BLOB</literal> (for binary data)</entry>
+            <entry><literal>BLOB, BINARY, VARBINARY</literal></entry>
           </row>
           <row>
             <entry/>
             <entry><literal>MYSQL_TYPE_NULL</literal></entry>
+            <entry><literal>NULL</literal></entry>
           </row>
         </tbody>
       </tgroup>

@@ -8641,13 +8678,16 @@
       The following table shows the allowable values that may be
       specified in the <literal>buffer_type</literal> member of
       <literal>MYSQL_BIND</literal> structures for output values. The
-      value should be chosen according to the SQL data type of the value
-      that you receive from the server. The table also shows the
-      recommended type of C language variable to bind to the
-      <literal>MYSQL_BIND</literal> structure for each SQL type. If you
-      use an <literal>unsigned</literal> variable, you should also set
-      the <literal>is_unsigned</literal> member to true. Note that
-      <literal>DECIMAL</literal> values are returned as strings.
+      value should be chosen according to the data type of the C
+      language variable that you are binding. If the variable is
+      <literal>unsigned</literal>, you should also set the
+      <literal>is_unsigned</literal> member to true. The table shows the
+      SQL types of recieved values, the corresponding type code that
+      such values have in result set metadata, and the recommended C
+      language data types to bind to the <literal>MYSQL_BIND</literal>
+      structure to receive the SQL values without conversion. Note that
+      <literal>DECIMAL</literal> values are returned as strings, which
+      is why the corresponding C type is <literal>char[]</literal>.
     </para>
 
     <informaltable>

@@ -8657,9 +8697,9 @@
         <colspec colwidth="35*"/>
         <tbody>
           <row>
-            <entry><emphasis role="bold">SQL Type</emphasis></entry>
+            <entry><emphasis role="bold">SQL Type of Received Value</emphasis></entry>
             <entry><literal>buffer_type</literal> <emphasis role="bold">Value</emphasis></entry>
-            <entry><emphasis role="bold">Recommended C Type</emphasis></entry>
+            <entry><emphasis role="bold">Output Variable C Type</emphasis></entry>
           </row>
           <row>
             <entry><literal>BIT</literal></entry>

@@ -8702,6 +8742,11 @@
             <entry><literal>char[]</literal></entry>
           </row>
           <row>
+            <entry><literal>YEAR</literal></entry>
+            <entry><literal>MYSQL_TYPE_SHORT</literal></entry>
+            <entry><literal>short int</literal></entry>
+          </row>
+          <row>
             <entry><literal>TIME</literal></entry>
             <entry><literal>MYSQL_TYPE_TIME</literal></entry>
             <entry><literal>MYSQL_TIME</literal></entry>

@@ -8756,23 +8801,73 @@
     </informaltable>
 
     <para>
-      The C language variable types are <quote>recommended</quote>
-      because implicit type conversion may be performed in both
-      directions. The <literal>buffer_type</literal> value controls the
-      conversion that will be performed. For example, to fetch a SQL
-      <literal>MEDIUMINT</literal> column value, you can specify a
-      <literal>buffer_type</literal> value of
-      <literal>MYSQL_TYPE_LONG</literal> and use a C variable of type
-      <literal>int</literal> as the destination buffer. If you fetch a
-      numeric column with a value of 255 into a
-      <literal>char[4]</literal> character array, specify a
-      <literal>buffer_type</literal> value of
-      <literal>MYSQL_TYPE_STRING</literal> and the resulting value in
-      the array will be a 4-byte string containing
-      <literal>'255\0'</literal>.
+      The C language variable types are those recommended if you want to
+      avoid type conversions. If there is a mismatch between the C
+      variable type on the client side and the corresponding SQL value
+      on the server side, MySQL performs implicit type conversions in
+      both directions.
     </para>
 
     <para>
+      MySQL knows the type code for the SQL value on the server side.
+      The <literal>buffer_type</literal> value indicates the MySQL the
+      type code of the C variable that holds the value on the client
+      side. The two codes together tell MySQL what conversion must be
+      performed, if any. Here are some examples:
+    </para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>
+          If you use <literal>MYSQL_TYPE_LONG</literal> with an
+          <literal>int</literal> variable to pass an integer value to
+          the server that is to be stored into a
+          <literal>FLOAT</literal> column, MySQL converts the value to
+          floating-point format before storing it.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          To fetch a SQL <literal>MEDIUMINT</literal> column value, you
+          can specify a <literal>buffer_type</literal> value of
+          <literal>MYSQL_TYPE_LONG</literal> and use a C variable of
+          type <literal>int</literal> as the destination buffer. MySQL
+          will convert the <literal>MEDIUMINT</literal> value (a 3-byte
+          value) for storage into the <literal>int</literal> (a 4-byte
+          variable).
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>
+          If you fetch a numeric column with a value of 255 into a
+          <literal>char[4]</literal> character array, specify a
+          <literal>buffer_type</literal> value of
+          <literal>MYSQL_TYPE_STRING</literal> and the resulting value
+          in the array will be a 4-byte string containing
+          <literal>'255\0'</literal>.
+        </para>
+      </listitem>
+
+    </itemizedlist>
+
+    <para>
+      Before binding variables to the <literal>MYSQL_BIND</literal>
+      structures that are to be used for fetching the column values, you
+      can check the type codes for the columns of a result set. This
+      might be desirable if you want to determine which variable types
+      would be best to use to avoid type conversions. To get the type
+      codes, call <literal>mysql_stmt_result_metadata()</literal> after
+      executing the prepared statement with
+      <literal>mysql_stmt_execute()</literal>. The metadata provides
+      access to the type codes for the result set as described in
+      <xref linkend="mysql-stmt-result-metadata"/>, and
+      <xref linkend="c-api-datatypes"/>.
+    </para>
+
+    <para>
       For input character (non-binary) string data (indicated by
       <literal>MYSQL_TYPE_STRING</literal>), the value is assumed to be
       in the character set indicated by the

@@ -8786,15 +8881,15 @@
     </para>
 
     <para>
-      To determine whether string values in a result set returned from
-      the server contain binary or non-binary data, check whether the
-      <literal>charsetnr</literal> value of the result set metadata is
-      63. If so, the character set is <literal>binary</literal>, which
-      indicates binary rather than non-binary data. This enables you to
-      distinguish between <literal>BINARY</literal> and
+      To determine whether output string values in a result set returned
+      from the server contain binary or non-binary data, check whether
+      the <literal>charsetnr</literal> value of the result set metadata
+      is 63. If so, the character set is <literal>binary</literal>,
+      which indicates binary rather than non-binary data. This enables
+      you to distinguish between <literal>BINARY</literal> and
       <literal>CHAR</literal>, <literal>VARBINARY</literal> and
-      <literal>VARCHAR</literal>, and <literal>BLOB</literal> and
-      <literal>TEXT</literal>.
+      <literal>VARCHAR</literal>, and the <literal>BLOB</literal> and
+      <literal>TEXT</literal> types.
     </para>
 
   </section>


Thread
svn commit - mysqldoc@docsrva: r4895 - in trunk: . refman-4.1 refman-5.0 refman-5.1paul12 Feb