<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>libsqlite3x: sqlite3x::sqlite3_cursor Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespacesqlite3x.html">sqlite3x</a>::<a class="el" href="classsqlite3x_1_1sqlite3__cursor.html">sqlite3_cursor</a> </div> </div> <div class="contents"> <h1>sqlite3x::sqlite3_cursor Class Reference</h1><!-- doxytag: class="sqlite3x::sqlite3_cursor" -->A type for reading results from an <a class="el" href="classsqlite3x_1_1sqlite3__command.html" title="Encapsulates a command to send to an sqlite3_connection.">sqlite3_command</a>. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="sqlite3x_8hpp_source.html">sqlite3x.hpp</a>></code> <p> <p> <a href="classsqlite3x_1_1sqlite3__cursor-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a48d3d71142b95cd9abe9717cdcbb1b7"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::sqlite3_cursor" ref="a48d3d71142b95cd9abe9717cdcbb1b7" args="(sqlite3_command &cmd)" --> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#a48d3d71142b95cd9abe9717cdcbb1b7">sqlite3_cursor</a> (<a class="el" href="classsqlite3x_1_1sqlite3__command.html">sqlite3_command</a> &cmd)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a cursor by calling cmd->executecursor(). <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3761e4b35a2fe422bdb46d013b6e2a93"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::sqlite3_cursor" ref="3761e4b35a2fe422bdb46d013b6e2a93" args="()" --> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#3761e4b35a2fe422bdb46d013b6e2a93">sqlite3_cursor</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Creates an empty cursor object, suitable only for use as the target of a copy/assignment. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#e050295d1038d6cbcecf0915cb53b059">sqlite3_cursor</a> (const <a class="el" href="classsqlite3x_1_1sqlite3__cursor.html">sqlite3_cursor</a> &copy)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Copies the given cursor object. <a href="#e050295d1038d6cbcecf0915cb53b059"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6f68791cf8fc8a4ee399619494d3251b"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::~sqlite3_cursor" ref="6f68791cf8fc8a4ee399619494d3251b" args="()" --> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#6f68791cf8fc8a4ee399619494d3251b">~sqlite3_cursor</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Closes this cursor, freeing up db resources if this is the last cursor of a copied set. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html">sqlite3_cursor</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#c2a3544f41845997e266edc71875f134">operator=</a> (const <a class="el" href="classsqlite3x_1_1sqlite3__cursor.html">sqlite3_cursor</a> &copy)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Copies the given cursor object. <a href="#c2a3544f41845997e266edc71875f134"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b2c806b7049f1715b8e6f4106aa6af4b"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::step" ref="b2c806b7049f1715b8e6f4106aa6af4b" args="()" --> bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#b2c806b7049f1715b8e6f4106aa6af4b">step</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Steps one step through the sql result set and returns true on SQLITE_ROW, false on SQLITE3_DONE, and throws on any other result. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#c456cea61aa21a64ab9b617ed58eae1f">reset</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Resets the underlying prepared statement of this cursor. <a href="#c456cea61aa21a64ab9b617ed58eae1f"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#4fa5692ec13fd4197e71e6c7f495dd4a">close</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Closes this cursor. <a href="#4fa5692ec13fd4197e71e6c7f495dd4a"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="98a12f884ca428595e692603ab863d9f"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::colcount" ref="98a12f884ca428595e692603ab863d9f" args="()" --> int </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#98a12f884ca428595e692603ab863d9f">colcount</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the column count of the result set or throws on error. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#505869cfa78a1b5aeb516bbe99d2400e">isnull</a> (int index)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Check if the given field number is NULL. <a href="#505869cfa78a1b5aeb516bbe99d2400e"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0c8263dc2db4054e38f4479a70a8dec8"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getint" ref="0c8263dc2db4054e38f4479a70a8dec8" args="(int index)" --> int </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#0c8263dc2db4054e38f4479a70a8dec8">getint</a> (int index)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the integer value at the given field number. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1f78949a7d2dd96b8677964368b2dc71"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getint64" ref="1f78949a7d2dd96b8677964368b2dc71" args="(int index)" --> <a class="el" href="namespacesqlite3x.html#006a0e90d7b40685893f6f6f766d9b48">int64_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#1f78949a7d2dd96b8677964368b2dc71">getint64</a> (int index)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the (int64_t) value at the given field number. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c6a6487bb07c7a7a864e9c971f4c773f"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getdouble" ref="c6a6487bb07c7a7a864e9c971f4c773f" args="(int index)" --> double </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#c6a6487bb07c7a7a864e9c971f4c773f">getdouble</a> (int index)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the double value at the given field number. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2d323375d5cf1a0c3efc915179558db3"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getstring" ref="2d323375d5cf1a0c3efc915179558db3" args="(int index)" --> std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#2d323375d5cf1a0c3efc915179558db3">getstring</a> (int index)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the string value at the given field number. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">char const * </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#c469fe6903f1d1af7623bba6b9cd2570">getstring</a> (int index, int &size)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Like getstring(index), but returns a C-style string. <a href="#c469fe6903f1d1af7623bba6b9cd2570"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c645e030d1bbdfa13e88af4a61ed810e"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getblob" ref="c645e030d1bbdfa13e88af4a61ed810e" args="(int index)" --> std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#c645e030d1bbdfa13e88af4a61ed810e">getblob</a> (int index)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the blob value at the given field number. <br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void const * </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#fbd6d623c832623904e529571732ca10">getblob</a> (int index, int &size)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Overloaded to avoid an internal copy of the blob data. <a href="#fbd6d623c832623904e529571732ca10"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html#adfe96368032b5cdb54112eb93f6e3c5">getcolname</a> (int index)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gets the column name for the given column index. <a href="#adfe96368032b5cdb54112eb93f6e3c5"></a><br></td></tr> <tr><td colspan="2"><br><h2>Friends</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="cc94d3b7fc3b64e83864dab2f559fbe0"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::sqlite3_command" ref="cc94d3b7fc3b64e83864dab2f559fbe0" args="" --> class </td><td class="memItemRight" valign="bottom"><b>sqlite3_command</b></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> A type for reading results from an <a class="el" href="classsqlite3x_1_1sqlite3__command.html" title="Encapsulates a command to send to an sqlite3_connection.">sqlite3_command</a>. <p>Definition at line <a class="el" href="sqlite3x_8hpp_source.html#l00458">458</a> of file <a class="el" href="sqlite3x_8hpp_source.html">sqlite3x.hpp</a>.</p> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="e050295d1038d6cbcecf0915cb53b059"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::sqlite3_cursor" ref="e050295d1038d6cbcecf0915cb53b059" args="(const sqlite3_cursor &copy)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">sqlite3x::sqlite3_cursor::sqlite3_cursor </td> <td>(</td> <td class="paramtype">const <a class="el" href="classsqlite3x_1_1sqlite3__cursor.html">sqlite3_cursor</a> & </td> <td class="paramname"> <em>copy</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Copies the given cursor object. <p> This is a fairly efficient operation, using reference counting. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00029">29</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> </div> </div><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="4fa5692ec13fd4197e71e6c7f495dd4a"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::close" ref="4fa5692ec13fd4197e71e6c7f495dd4a" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void sqlite3x::sqlite3_cursor::close </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Closes this cursor. <p> Calling it multiple times is a no-op on the second and subsequent calls. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00081">81</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> <p>Referenced by <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00041">operator=()</a>, and <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00037">~sqlite3_cursor()</a>.</p> </div> </div><p> <a class="anchor" name="fbd6d623c832623904e529571732ca10"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getblob" ref="fbd6d623c832623904e529571732ca10" args="(int index, int &size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void const * sqlite3x::sqlite3_cursor::getblob </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>index</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int & </td> <td class="paramname"> <em>size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> Overloaded to avoid an internal copy of the blob data. <p> size is set to the number of bytes in the blob and the returned pointer is the blob. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00135">135</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> </div> </div><p> <a class="anchor" name="adfe96368032b5cdb54112eb93f6e3c5"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getcolname" ref="adfe96368032b5cdb54112eb93f6e3c5" args="(int index)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">std::string sqlite3x::sqlite3_cursor::getcolname </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>index</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Gets the column name for the given column index. <p> Throws on error. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00141">141</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> </div> </div><p> <a class="anchor" name="c469fe6903f1d1af7623bba6b9cd2570"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::getstring" ref="c469fe6903f1d1af7623bba6b9cd2570" args="(int index, int &size)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">char const * sqlite3x::sqlite3_cursor::getstring </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>index</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int & </td> <td class="paramname"> <em>size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> Like getstring(index), but returns a C-style string. <p> We hope it is null-terminated, but the sqlite3 docs are ambiguous on this point. size is set to the length of the returned string.<p> The advantage of this over getstring(index) is that this version avoids a potential extra internal copy of the string. Note that there is no guaranty how long this pointer will remain valid - be sure to copy the string if you need it. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00117">117</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> </div> </div><p> <a class="anchor" name="505869cfa78a1b5aeb516bbe99d2400e"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::isnull" ref="505869cfa78a1b5aeb516bbe99d2400e" args="(int index)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool sqlite3x::sqlite3_cursor::isnull </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>index</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Check if the given field number is NULL. <p> This function returns true if is NULL, else false. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00092">92</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> </div> </div><p> <a class="anchor" name="c2a3544f41845997e266edc71875f134"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::operator=" ref="c2a3544f41845997e266edc71875f134" args="(const sqlite3_cursor &copy)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classsqlite3x_1_1sqlite3__cursor.html">sqlite3_cursor</a> & sqlite3x::sqlite3_cursor::operator= </td> <td>(</td> <td class="paramtype">const <a class="el" href="classsqlite3x_1_1sqlite3__cursor.html">sqlite3_cursor</a> & </td> <td class="paramname"> <em>copy</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Copies the given cursor object. <p> This is a fairly efficient operation, using reference counting. This object points to the same underlying result set as the original, so both objects should not be used. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00041">41</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> <p>References <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00081">close()</a>.</p> </div> </div><p> <a class="anchor" name="c456cea61aa21a64ab9b617ed58eae1f"></a><!-- doxytag: member="sqlite3x::sqlite3_cursor::reset" ref="c456cea61aa21a64ab9b617ed58eae1f" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void sqlite3x::sqlite3_cursor::reset </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Resets the underlying prepared statement of this cursor. <p> Throws on error. <p>Definition at line <a class="el" href="sqlite3x__cursor_8cpp_source.html#l00072">72</a> of file <a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a>.</p> <p>References <a class="el" href="sqlite3x__connection_8cpp_source.html#l00114">sqlite3x::sqlite3_connection::errormsg()</a>, and <a class="el" href="sqlite3x__command_8cpp_source.html#l00236">sqlite3x::sqlite3_command::reset()</a>.</p> </div> </div><p> <hr>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="sqlite3x_8hpp_source.html">sqlite3x.hpp</a><li><a class="el" href="sqlite3x__cursor_8cpp_source.html">sqlite3x_cursor.cpp</a></ul> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jul 26 18:20:37 2009 for libsqlite3x by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>