List:Internals« Previous MessageNext Message »
From:paul Date:October 13 2005 6:35pm
Subject:svn commit - mysqldoc@docsrva: r59 - in trunk: . refman refman-4.1 refman-5.0 refman-5.1
View as plain text  
Author: paul
Date: 2005-10-13 20:35:06 +0200 (Thu, 13 Oct 2005)
New Revision: 59

Log:
 r2699@frost:  paul | 2005-10-13 13:34:36 -0500
 Add cursor-opening example.


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


Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:2688
   + b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:2699

Modified: trunk/refman/mysql-apis.xml
===================================================================
--- trunk/refman/mysql-apis.xml	2005-10-13 17:46:25 UTC (rev 58)
+++ trunk/refman/mysql-apis.xml	2005-10-13 18:35:06 UTC (rev 59)
@@ -9335,7 +9335,7 @@
         </para>
 
         <para>
-          Can be used to set affect behavior for a statement. This
+          Can be used to affect behavior for a prepared statement. This
           function may be called multiple times to set several options.
         </para>
 
@@ -9405,6 +9405,13 @@
         </para>
 
         <para>
+          If you open a cursor for a prepared statement,
+          <literal>mysql_stmt_store_result()</literal> is unnecessary,
+          because that function causes the result set to be buffered on
+          the client side.
+        </para>
+
+        <para>
           This function was added in MySQL 4.1.2. The
           <literal>STMT_ATTR_CURSOR_TYPE</literal> option was added in
           MySQL 5.0.2. The <literal>STMT_ATTR_PREFETCH_ROWS</literal>
@@ -9428,6 +9435,30 @@
           None.
         </para>
 
+        <para>
+          <emphasis role="bold">Example</emphasis>
+        </para>
+
+        <para>
+          The following example opens a cursor for a prepared statement
+          and sets the number of rows to fetch at a time to 5:
+        </para>
+
+<programlisting>
+MYSQL_STMT *stmt;
+int rc;
+unsigned long type;
+unsigned long prefetch_rows = 5;
+
+stmt = mysql_stmt_init(mysql);
+type = (unsigned long) CURSOR_TYPE_READ_ONLY;
+rc = mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &amp;type);
+/* ... check return value ... */
+rc = mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS,
+					  (void*) &amp;prefetch_rows);
+/* ... check return value ... */
+</programlisting>
+
       </section>
 
       <section id="mysql-stmt-bind-param">

Modified: trunk/refman-4.1/mysql-apis.xml
===================================================================
--- trunk/refman-4.1/mysql-apis.xml	2005-10-13 17:46:25 UTC (rev 58)
+++ trunk/refman-4.1/mysql-apis.xml	2005-10-13 18:35:06 UTC (rev 59)
@@ -9203,8 +9203,8 @@
         </para>
 
         <para>
-          Can be used to set affect behavior for a statement. In MySQL
-          4.1, the <literal>option</literal> argument can take the
+          Can be used to affect behavior for a prepared statement. In
+          MySQL 4.1, the <literal>option</literal> argument can take the
           single value <literal>STMT_ATTR_UPDATE_MAX_LENGTH</literal>;
           the <literal>arg</literal> argument is a pointer of type
           <literal>my_bool *</literal>. If <literal>arg</literal> points

Modified: trunk/refman-5.0/mysql-apis.xml
===================================================================
--- trunk/refman-5.0/mysql-apis.xml	2005-10-13 17:46:25 UTC (rev 58)
+++ trunk/refman-5.0/mysql-apis.xml	2005-10-13 18:35:06 UTC (rev 59)
@@ -9169,7 +9169,7 @@
         </para>
 
         <para>
-          Can be used to set affect behavior for a statement. This
+          Can be used to affect behavior for a prepared statement. This
           function may be called multiple times to set several options.
         </para>
 
@@ -9239,6 +9239,13 @@
         </para>
 
         <para>
+          If you open a cursor for a prepared statement,
+          <literal>mysql_stmt_store_result()</literal> is unnecessary,
+          because that function causes the result set to be buffered on
+          the client side.
+        </para>
+
+        <para>
           The <literal>STMT_ATTR_CURSOR_TYPE</literal> option was added
           in MySQL 5.0.2. The <literal>STMT_ATTR_PREFETCH_ROWS</literal>
           option was added in MySQL 5.0.6.
@@ -9261,6 +9268,30 @@
           None.
         </para>
 
+        <para>
+          <emphasis role="bold">Example</emphasis>
+        </para>
+
+        <para>
+          The following example opens a cursor for a prepared statement
+          and sets the number of rows to fetch at a time to 5:
+        </para>
+
+<programlisting>
+MYSQL_STMT *stmt;
+int rc;
+unsigned long type;
+unsigned long prefetch_rows = 5;
+
+stmt = mysql_stmt_init(mysql);
+type = (unsigned long) CURSOR_TYPE_READ_ONLY;
+rc = mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &amp;type);
+/* ... check return value ... */
+rc = mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS,
+					  (void*) &amp;prefetch_rows);
+/* ... check return value ... */
+</programlisting>
+
       </section>
 
       <section id="mysql-stmt-bind-param">

Modified: trunk/refman-5.1/mysql-apis.xml
===================================================================
--- trunk/refman-5.1/mysql-apis.xml	2005-10-13 17:46:25 UTC (rev 58)
+++ trunk/refman-5.1/mysql-apis.xml	2005-10-13 18:35:06 UTC (rev 59)
@@ -9175,7 +9175,7 @@
         </para>
 
         <para>
-          Can be used to set affect behavior for a statement. This
+          Can be used to affect behavior for a prepared statement. This
           function may be called multiple times to set several options.
         </para>
 
@@ -9245,6 +9245,13 @@
         </para>
 
         <para>
+          If you open a cursor for a prepared statement,
+          <literal>mysql_stmt_store_result()</literal> is unnecessary,
+          because that function causes the result set to be buffered on
+          the client side.
+        </para>
+
+        <para>
           The <literal>STMT_ATTR_CURSOR_TYPE</literal> option was added
           in MySQL 5.0.2. The <literal>STMT_ATTR_PREFETCH_ROWS</literal>
           option was added in MySQL 5.0.6.
@@ -9267,6 +9274,30 @@
           None.
         </para>
 
+        <para>
+          <emphasis role="bold">Example</emphasis>
+        </para>
+
+        <para>
+          The following example opens a cursor for a prepared statement
+          and sets the number of rows to fetch at a time to 5:
+        </para>
+
+<programlisting>
+MYSQL_STMT *stmt;
+int rc;
+unsigned long type;
+unsigned long prefetch_rows = 5;
+
+stmt = mysql_stmt_init(mysql);
+type = (unsigned long) CURSOR_TYPE_READ_ONLY;
+rc = mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &amp;type);
+/* ... check return value ... */
+rc = mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS,
+					  (void*) &amp;prefetch_rows);
+/* ... check return value ... */
+</programlisting>
+
       </section>
 
       <section id="mysql-stmt-bind-param">

Thread
svn commit - mysqldoc@docsrva: r59 - in trunk: . refman refman-4.1 refman-5.0 refman-5.1paul13 Oct