List:Commits« Previous MessageNext Message »
From:tony.bedford Date:September 27 2010 3:32pm
Subject:svn commit - mysqldoc@docsrva: r22859 - trunk/refman-common
View as plain text  
Author: tbedford
Date: 2010-09-27 17:32:07 +0200 (Mon, 27 Sep 2010)
New Revision: 22859

Log:
Fixes doc bug #56557.

Modified:
   trunk/refman-common/connector-cpp-core.xml


Modified: trunk/refman-common/connector-cpp-core.xml
===================================================================
--- trunk/refman-common/connector-cpp-core.xml	2010-09-27 13:44:55 UTC (rev 22858)
+++ trunk/refman-common/connector-cpp-core.xml	2010-09-27 15:32:07 UTC (rev 22859)
Changed blocks: 2, Lines Added: 21, Lines Deleted: 11; 1777 bytes

@@ -10,7 +10,7 @@
   <remark role="dynamic-dependency-list"/>
 
   <para>
-    &ccpp; is a MySQL database connector for C++.  
+    &ccpp; is a MySQL database connector for C++.
   </para>
 
   <para>

@@ -2235,28 +2235,38 @@
         cursors.
       </para>
 
-<programlisting>// ...
+<programlisting>
+<![CDATA[
+// ...
 sql::Connection *con;
 sql::Statement *stmt
 sql::ResultSet  *res;
 // ...
-stmt = con-&gt;createStatement();
+stmt = con->createStatement();
 // ...
 
-res = stmt-&gt;executeQuery("SELECT id, label FROM test ORDER BY id ASC");
-while (res-&gt;next()) {
+res = stmt->executeQuery("SELECT id, label FROM test ORDER BY id ASC");
+while (res->next()) {
   // You can use either numeric offsets...
-  cout &lt;&lt; "id = " &lt;&amp;;t; res-&gt;getInt(0);
-  // ... or column names for accessing results. &raquo;
-    The latter is recommended.
-  cout &lt;&lt; ", label = '" &lt;&lt; &raquo;
-    res-&gt;getString("label") &lt;&lt; "'" &lt;&lt; endl;
+  cout << "id = " << res->getInt(1); // getInt(1) returns the first column
+  // ... or column names for accessing results.
+  // The latter is recommended.
+  cout << ", label = '" << res->getString("label") << "'" << endl;
 }
 
 delete res;
 delete stmt;
-delete con;</programlisting>
+delete con;
+]]>
+</programlisting>
 
+      <note>
+        <para>
+          Note in the preceding code snippet that column indexing starts
+          from 1.
+        </para>
+      </note>
+
       <para>
         Note that you have to free
         <classname>sql::Statement</classname>,


Thread
svn commit - mysqldoc@docsrva: r22859 - trunk/refman-commontony.bedford27 Sep