⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exec.html

📁 这是sqlite3.56的文档。拿来给大家阅读使用
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>One-Step Query Execution Interface</title><style type="text/css">body {    margin: auto;    font-family: "Verdana" "sans-serif";    padding: 8px 1%;}a { color: #45735f }a:visited { color: #734559 }.logo { position:absolute; margin:3px; }.tagline {  float:right;  text-align:right;  font-style:italic;  width:240px;  margin:12px;  margin-top:58px;}.toolbar {  font-variant: small-caps;  text-align: center;  line-height: 1.6em;  margin: 0;  padding:1px 8px;}.toolbar a { color: white; text-decoration: none; padding: 6px 12px; }.toolbar a:visited { color: white; }.toolbar a:hover { color: #80a796; background: white; }.content    { margin: 5%; }.content dt { font-weight:bold; }.content dd { margin-bottom: 25px; margin-left:20%; }.content ul { padding:0px; padding-left: 15px; margin:0px; }/* rounded corners */.se  { background: url(../images/se.png) 100% 100% no-repeat #80a796}.sw  { background: url(../images/sw.png) 0% 100% no-repeat }.ne  { background: url(../images/ne.png) 100% 0% no-repeat }.nw  { background: url(../images/nw.png) 0% 0% no-repeat }</style><meta http-equiv="content-type" content="text/html; charset=UTF-8">  </head><body><div><!-- container div to satisfy validator --><a href="../index.html"><img class="logo" src="../images/SQLite.gif" alt="SQLite Logo" border="0"></a><div><!-- IE hack to prevent disappearing logo--></div><div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div><table width=100% style="clear:both"><tr><td>  <div class="se"><div class="sw"><div class="ne"><div class="nw">  <div class="toolbar">    <a href="../about.html">About</a>    <a href="../sitemap.html">Sitemap</a>    <a href="../docs.html">Documentation</a>    <a href="../download.html">Download</a>    <a href="../copyright.html">License</a>    <a href="../news.html">News</a>    <a href="http://www.sqlite.org/cvstrac/index">Developers</a>    <a href="../support.html">Support</a>  </div></div></div></div></div></td></tr></table>  <a href="intro.html"><h2>SQLite C Interface</h2></a><h2>One-Step Query Execution Interface</h2><blockquote><pre>int sqlite3_exec(  sqlite3*,                                  /* An open database */  const char *sql,                           /* SQL to be evaluted */  int (*callback)(void*,int,char**,char**),  /* Callback function */  void *,                                    /* 1st argument to callback */  char **errmsg                              /* Error msg written here */);</pre></blockquote><p>The sqlite3_exec() interface is a convenient way of runningone or more SQL statements without a lot of C code.  TheSQL statements are passed in as the second parameter tosqlite3_exec().  The statements are evaluated one by oneuntil either an error or an interrupt is encountered oruntil they are all done.  The 3rd parameter is an optionalcallback that is invoked once for each row of any query resultsproduced by the SQL statements.  The 5th parameter tells whereto write any error messages.</p><p>The sqlite3_exec() interface is implemented in terms of<a href="../c3ref/prepare.html">sqlite3_prepare_v2()</a>, <a href="../c3ref/step.html">sqlite3_step()</a>, and <a href="../c3ref/finalize.html">sqlite3_finalize()</a>.The sqlite3_exec() routine does nothing that cannot be doneby <a href="../c3ref/prepare.html">sqlite3_prepare_v2()</a>, <a href="../c3ref/step.html">sqlite3_step()</a>, and <a href="../c3ref/finalize.html">sqlite3_finalize()</a>.The sqlite3_exec() is just a convenient wrapper.</p><p><h3>Invariants:</h3><table border="0" cellpadding="5" cellspacing="0"><tr><td valign="top">F12101</td> <td valign="top">The <a href="../c3ref/exec.html">sqlite3_exec()</a> interface evaluates zero or more UTF-8encoded, semicolon-separated, SQL statements in thezero-terminated string of its 2nd parameter within thecontext of the <a href="../c3ref/sqlite3.html">sqlite3</a> object given in the 1st parameter.</td></tr><tr><td valign="top">F12104</td> <td valign="top">The return value of <a href="../c3ref/exec.html">sqlite3_exec()</a> is SQLITE_OK if allSQL statements run successfully.</td></tr><tr><td valign="top">F12105</td> <td valign="top">The return value of <a href="../c3ref/exec.html">sqlite3_exec()</a> is an appropriatenon-zero error code if any SQL statement fails.</td></tr><tr><td valign="top">F12107</td> <td valign="top">If one or more of the SQL statements handed to <a href="../c3ref/exec.html">sqlite3_exec()</a>return results and the 3rd parameter is not NULL, thenthe callback function specified by the 3rd parameter isinvoked once for each row of result.</td></tr><tr><td valign="top">F12110</td> <td valign="top">If the callback returns a non-zero value then <a href="../c3ref/exec.html">sqlite3_exec()</a>will aborted the SQL statement it is currently evaluating,skip all subsequent SQL statements, and return <a href="../c3ref/c_abort.html">SQLITE_ABORT</a>.<font color="red">(TODO: What happens to *errmsg here?  Does the result code forsqlite3_errcode() get set?)</font></td></tr><tr><td valign="top">F12113</td> <td valign="top">The <a href="../c3ref/exec.html">sqlite3_exec()</a> routine will pass its 4th parameter throughas the 1st parameter of the callback.</td></tr><tr><td valign="top">F12116</td> <td valign="top">The <a href="../c3ref/exec.html">sqlite3_exec()</a> routine sets the 2nd parameter of itscallback to be the number of columns in the current row ofresult.</td></tr><tr><td valign="top">F12119</td> <td valign="top">The <a href="../c3ref/exec.html">sqlite3_exec()</a> routine sets the 3rd parameter of itscallback to be an array of pointers to strings holding thevalues for each column in the current result set row asobtained from <a href="../c3ref/column_blob.html">sqlite3_column_text()</a>.</td></tr><tr><td valign="top">F12122</td> <td valign="top">The <a href="../c3ref/exec.html">sqlite3_exec()</a> routine sets the 4th parameter of itscallback to be an array of pointers to strings holding thenames of result columns as obtained from <a href="../c3ref/column_name.html">sqlite3_column_name()</a>.</td></tr><tr><td valign="top">F12125</td> <td valign="top">If the 3rd parameter to <a href="../c3ref/exec.html">sqlite3_exec()</a> is NULL then<a href="../c3ref/exec.html">sqlite3_exec()</a> never invokes a callback.  All queryresults are silently discarded.</td></tr><tr><td valign="top">F12128</td> <td valign="top">If an error occurs while parsing or evaluating any of the SQLstatements handed to <a href="../c3ref/exec.html">sqlite3_exec()</a> then <a href="../c3ref/exec.html">sqlite3_exec()</a> willreturn an <a href="../c3ref/c_abort.html">error code</a> other than <a href="../c3ref/c_abort.html">SQLITE_OK</a>.</td></tr><tr><td valign="top">F12131</td> <td valign="top">If an error occurs while parsing or evaluating any of the SQLhanded to <a href="../c3ref/exec.html">sqlite3_exec()</a> and if the 5th parameter (errmsg)to <a href="../c3ref/exec.html">sqlite3_exec()</a> is not NULL, then an error message isallocated using the equivalent of <a href="../c3ref/mprintf.html">sqlite3_mprintf()</a> and*errmsg is made to point to that message.</td></tr><tr><td valign="top">F12134</td> <td valign="top">The <a href="../c3ref/exec.html">sqlite3_exec()</a> routine does not change the value of*errmsg if errmsg is NULL or if there are no errors.</td></tr><tr><td valign="top">F12137</td> <td valign="top">The <a href="../c3ref/exec.html">sqlite3_exec()</a> function sets the error code and messageaccessible via <a href="../c3ref/errcode.html">sqlite3_errcode()</a> and <a href="../c3ref/errcode.html">sqlite3_errmsg()</a>.</td></tr></table></p><p><h3>Limitations:</h3><table border="0" cellpadding="5" cellspacing="0"><tr><td valign="top">U12141</td> <td valign="top">The first parameter to <a href="../c3ref/exec.html">sqlite3_exec()</a> must be an valid and open<a href="../c3ref/sqlite3.html">database connection</a>.</td></tr><tr><td valign="top">U12142</td> <td valign="top">The database connection must not be closed while<a href="../c3ref/exec.html">sqlite3_exec()</a> is running.</td></tr><tr><td valign="top">U12143</td> <td valign="top">The calling function is should use <a href="../c3ref/free.html">sqlite3_free()</a> to freethe memory that *errmsg is left pointing at once the errormessage is no longer needed.</td></tr><tr><td valign="top">U12145</td> <td valign="top">The SQL statement text in the 2nd parameter to <a href="../c3ref/exec.html">sqlite3_exec()</a>must remain unchanged while <a href="../c3ref/exec.html">sqlite3_exec()</a> is running.</td></tr></table></p><p>See also lists of  <a href="objlist.html">Objects</a>,  <a href="constlist.html">Constants</a>, and  <a href="funclist.html">Functions</a>.</p><hr><small<i>This page last modified 2008/01/31 20:37:13 UTC</i></small></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -