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

📄 result_blob.html

📁 嵌入式数据库sqlite 3.5.9的文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Setting The Result Of An SQL Function</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>Setting The Result Of An SQL Function</h2><blockquote><pre>void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));void sqlite3_result_double(sqlite3_context*, double);void sqlite3_result_error(sqlite3_context*, const char*, int);void sqlite3_result_error16(sqlite3_context*, const void*, int);void sqlite3_result_error_toobig(sqlite3_context*);void sqlite3_result_error_nomem(sqlite3_context*);void sqlite3_result_error_code(sqlite3_context*, int);void sqlite3_result_int(sqlite3_context*, int);void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);void sqlite3_result_null(sqlite3_context*);void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));void sqlite3_result_value(sqlite3_context*, sqlite3_value*);void sqlite3_result_zeroblob(sqlite3_context*, int n);</pre></blockquote><p>These routines are used by the xFunc or xFinal callbacks thatimplement SQL functions and aggregates.  See<a href="../c3ref/create_function.html">sqlite3_create_function()</a> and <a href="../c3ref/create_function.html">sqlite3_create_function16()</a>for additional information.</p><p>These functions work very much like the<a href="../c3ref/bind_blob.html">sqlite3_bind_*</a> family of functions usedto bind values to host parameters in prepared statements.Refer to the<a href="../c3ref/bind_blob.html">sqlite3_bind_* documentation</a> foradditional information.</p><p>The sqlite3_result_blob() interface sets the result froman application defined function to be the BLOB whose content is pointedto by the second parameter and which is N bytes long where N is thethird parameter.The sqlite3_result_zeroblob() inerfaces set the result ofthe application defined function to be a BLOB containing all zerobytes and N bytes in size, where N is the value of the 2nd parameter.</p><p>The sqlite3_result_double() interface sets the result froman application defined function to be a floating point value specifiedby its 2nd argument.</p><p>The sqlite3_result_error() and sqlite3_result_error16() functionscause the implemented SQL function to throw an exception.SQLite uses the string pointed to by the2nd parameter of sqlite3_result_error() or sqlite3_result_error16()as the text of an error message.  SQLite interprets the errormessage string from sqlite3_result_error() as UTF8. SQLiteinterprets the string from sqlite3_result_error16() as UTF16 in nativebyte order.  If the third parameter to sqlite3_result_error()or sqlite3_result_error16() is negative then SQLite takes as the errormessage all text up through the first zero character.If the third parameter to sqlite3_result_error() orsqlite3_result_error16() is non-negative then SQLite takes that manybytes (not characters) from the 2nd parameter as the error message.The sqlite3_result_error() and sqlite3_result_error16()routines make a copy private copy of the error message text beforethey return.  Hence, the calling function can deallocate ormodify the text after they return without harm.The sqlite3_result_error_code() function changes the error codereturned by SQLite as a result of an error in a function.  By default,the error code is SQLITE_ERROR.  A subsequent call to sqlite3_result_error()or sqlite3_result_error16() resets the error code to SQLITE_ERROR.</p><p>The sqlite3_result_toobig() interface causes SQLiteto throw an error indicating that a string or BLOB is to longto represent.  The sqlite3_result_nomem() interfacecauses SQLite to throw an exception indicating that the amemory allocation failed.</p><p>The sqlite3_result_int() interface sets the return valueof the application-defined function to be the 32-bit signed integervalue given in the 2nd argument.The sqlite3_result_int64() interface sets the return valueof the application-defined function to be the 64-bit signed integervalue given in the 2nd argument.</p><p>The sqlite3_result_null() interface sets the return valueof the application-defined function to be NULL.</p><p>The sqlite3_result_text(), sqlite3_result_text16(),sqlite3_result_text16le(), and sqlite3_result_text16be() interfacesset the return value of the application-defined function to bea text string which is represented as UTF-8, UTF-16 native byte order,UTF-16 little endian, or UTF-16 big endian, respectively.SQLite takes the text result from the application fromthe 2nd parameter of the sqlite3_result_text* interfaces.If the 3rd parameter to the sqlite3_result_text* interfacesis negative, then SQLite takes result text from the 2nd parameterthrough the first zero character.If the 3rd parameter to the sqlite3_result_text* interfacesis non-negative, then as many bytes (not characters) of the textpointed to by the 2nd parameter are taken as the application-definedfunction result.If the 4th parameter to the sqlite3_result_text* interfacesor sqlite3_result_blob is a non-NULL pointer, then SQLite calls thatfunction as the destructor on the text or blob result when it hasfinished using that result.If the 4th parameter to the sqlite3_result_text* interfacesor sqlite3_result_blob is the special constant SQLITE_STATIC, thenSQLite assumes that the text or blob result is constant space anddoes not copy the space or call a destructor when it hasfinished using that result.If the 4th parameter to the sqlite3_result_text* interfacesor sqlite3_result_blob is the special constant SQLITE_TRANSIENTthen SQLite makes a copy of the result into space obtained fromfrom <a href="../c3ref/free.html">sqlite3_malloc()</a> before it returns.</p><p>The sqlite3_result_value() interface sets the result of

⌨️ 快捷键说明

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