| Bug #56557 | documentation bug | ||
|---|---|---|---|
| Submitted: | 4 Sep 2010 12:29 | Modified: | 27 Sep 2010 15:34 |
| Reporter: | alex s | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / C++ Documentation | Severity: | S3 (Non-critical) |
| Version: | 5.1 | OS: | Any |
| Assigned to: | Tony Bedford | CPU Architecture: | Any |
| Tags: | sqlconnector c++ chm | ||
[4 Sep 2010 16:28]
Valeriy Kravchuk
Thank you for the bug report. Indeed, http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-results.html should be fixed. See http://download.oracle.com/javase/1.4.2/docs/api/java/sql/ResultSet.html#getInt(int) for reference.
[27 Sep 2010 15:34]
Tony Bedford
The documentation XML sources have been corrected. A supporting note has also been added on indexing of getInt().

Description: at 21.5.5.3. MySQL Connector/C++ Fetching results res = stmt->executeQuery("SELECT id, label FROM test ORDER BY id ASC"); while (res->next()) { // You can use either numeric offsets... cout << "id = " <&;t; res->getInt(0); // ... or column names for accessing results. » The latter is recommended. cout << ", label = '" << » res->getString("label") << "'" << endl; when in fact "getInt(0)" is 1 based and not 0 based . How to repeat: download help reference in chm format in contet goto Connectors and API->MySql connector /C++ /Getting started - Usage example/Fetching Results Suggested fix: change example to res = stmt->executeQuery("SELECT id, label FROM test ORDER BY id ASC"); while (res->next()) { // You can use either numeric offsets... cout << "id = " <&;t; res->getInt(1); // ... or column names for accessing results. » The latter is recommended. cout << ", label = '" << » res->getString("label") << "'" << endl; A mention that result set columns are 1 based can also be added.