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

📄 sqlite3.h

📁 sqlite 嵌入式数据库的源码
💻 H
📖 第 1 页 / 共 4 页
字号:
** to the syntax rules of the TCL programming language.** The value of these parameters (also called "host parameter names") can** be set using the routines listed below.**** In every case, the first parameter is a pointer to the sqlite3_stmt** structure returned from sqlite3_prepare().  The second parameter is the** index of the parameter.  The first parameter as an index of 1.  For** named parameters (":AAA" or "$VVV") you can use ** sqlite3_bind_parameter_index() to get the correct index value given** the parameters name.  If the same named parameter occurs more than** once, it is assigned the same index each time.**** The fifth parameter to sqlite3_bind_blob(), sqlite3_bind_text(), and** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or** text after SQLite has finished with it.  If the fifth argument is the** special value SQLITE_STATIC, then the library assumes that the information** is in static, unmanaged space and does not need to be freed.  If the** fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its** own private copy of the data.**** The sqlite3_bind_* routine must be called before sqlite3_step() after** an sqlite3_prepare() or sqlite3_reset().  Unbound parameterss are** interpreted as NULL.*/int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));int sqlite3_bind_double(sqlite3_stmt*, int, double);int sqlite3_bind_int(sqlite3_stmt*, int, int);int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite_int64);int sqlite3_bind_null(sqlite3_stmt*, int);int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);/*** Return the number of parameters in a compiled SQL statement.  This** routine was added to support DBD::SQLite.*/int sqlite3_bind_parameter_count(sqlite3_stmt*);/*** Return the name of the i-th parameter.  Ordinary parameters "?" are** nameless and a NULL is returned.  For parameters of the form :AAA or** $VVV the complete text of the parameter name is returned, including** the initial ":" or "$".  NULL is returned if the index is out of range.*/const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);/*** Return the index of a parameter with the given name.  The name** must match exactly.  If no parameter with the given name is found,** return 0.*/int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);/*** Set all the parameters in the compiled SQL statement to NULL.*/int sqlite3_clear_bindings(sqlite3_stmt*);/*** Return the number of columns in the result set returned by the compiled** SQL statement. This routine returns 0 if pStmt is an SQL statement** that does not return data (for example an UPDATE).*/int sqlite3_column_count(sqlite3_stmt *pStmt);/*** The first parameter is a compiled SQL statement. This function returns** the column heading for the Nth column of that statement, where N is the** second function parameter.  The string returned is UTF-8 for** sqlite3_column_name() and UTF-16 for sqlite3_column_name16().*/const char *sqlite3_column_name(sqlite3_stmt*,int);const void *sqlite3_column_name16(sqlite3_stmt*,int);/*** The first parameter is a compiled SQL statement. If this statement** is a SELECT statement, the Nth column of the returned result set ** of the SELECT is a table column then the declared type of the table** column is returned. If the Nth column of the result set is not at table** column, then a NULL pointer is returned. The returned string is always** UTF-8 encoded. For example, in the database schema:**** CREATE TABLE t1(c1 VARIANT);**** And the following statement compiled:**** SELECT c1 + 1, 0 FROM t1;**** Then this routine would return the string "VARIANT" for the second** result column (i==1), and a NULL pointer for the first result column** (i==0).*/const char *sqlite3_column_decltype(sqlite3_stmt *, int i);/*** The first parameter is a compiled SQL statement. If this statement** is a SELECT statement, the Nth column of the returned result set ** of the SELECT is a table column then the declared type of the table** column is returned. If the Nth column of the result set is not at table** column, then a NULL pointer is returned. The returned string is always** UTF-16 encoded. For example, in the database schema:**** CREATE TABLE t1(c1 INTEGER);**** And the following statement compiled:**** SELECT c1 + 1, 0 FROM t1;**** Then this routine would return the string "INTEGER" for the second** result column (i==1), and a NULL pointer for the first result column** (i==0).*/const void *sqlite3_column_decltype16(sqlite3_stmt*,int);/* ** After an SQL query has been compiled with a call to either** sqlite3_prepare() or sqlite3_prepare16(), then this function must be** called one or more times to execute the statement.**** The return value will be either SQLITE_BUSY, SQLITE_DONE, ** SQLITE_ROW, SQLITE_ERROR, or SQLITE_MISUSE.**** SQLITE_BUSY means that the database engine attempted to open** a locked database and there is no busy callback registered.** Call sqlite3_step() again to retry the open.**** SQLITE_DONE means that the statement has finished executing** successfully.  sqlite3_step() should not be called again on this virtual** machine.**** If the SQL statement being executed returns any data, then ** SQLITE_ROW is returned each time a new row of data is ready** for processing by the caller. The values may be accessed using** the sqlite3_column_*() functions described below. sqlite3_step()** is called again to retrieve the next row of data.** ** SQLITE_ERROR means that a run-time error (such as a constraint** violation) has occurred.  sqlite3_step() should not be called again on** the VM. More information may be found by calling sqlite3_errmsg().**** SQLITE_MISUSE means that the this routine was called inappropriately.** Perhaps it was called on a virtual machine that had already been** finalized or on one that had previously returned SQLITE_ERROR or** SQLITE_DONE.  Or it could be the case the the same database connection** is being used simulataneously by two or more threads.*/int sqlite3_step(sqlite3_stmt*);/*** Return the number of values in the current row of the result set.**** After a call to sqlite3_step() that returns SQLITE_ROW, this routine** will return the same value as the sqlite3_column_count() function.** After sqlite3_step() has returned an SQLITE_DONE, SQLITE_BUSY or** error code, or before sqlite3_step() has been called on a ** compiled SQL statement, this routine returns zero.*/int sqlite3_data_count(sqlite3_stmt *pStmt);/*** Values are stored in the database in one of the following fundamental** types.*/#define SQLITE_INTEGER  1#define SQLITE_FLOAT    2/* #define SQLITE_TEXT  3  // See below */#define SQLITE_BLOB     4#define SQLITE_NULL     5/*** SQLite version 2 defines SQLITE_TEXT differently.  To allow both** version 2 and version 3 to be included, undefine them both if a** conflict is seen.  Define SQLITE3_TEXT to be the version 3 value.*/#ifdef SQLITE_TEXT# undef SQLITE_TEXT#else# define SQLITE_TEXT     3#endif#define SQLITE3_TEXT     3/*** The next group of routines returns information about the information** in a single column of the current result row of a query.  In every** case the first parameter is a pointer to the SQL statement that is being** executed (the sqlite_stmt* that was returned from sqlite3_prepare()) and** the second argument is the index of the column for which information ** should be returned.  iCol is zero-indexed.  The left-most column as an** index of 0.**** If the SQL statement is not currently point to a valid row, or if the** the colulmn index is out of range, the result is undefined.**** These routines attempt to convert the value where appropriate.  For** example, if the internal representation is FLOAT and a text result** is requested, sprintf() is used internally to do the conversion** automatically.  The following table details the conversions that** are applied:****    Internal Type    Requested Type     Conversion**    -------------    --------------    --------------------------**       NULL             INTEGER         Result is 0**       NULL             FLOAT           Result is 0.0**       NULL             TEXT            Result is an empty string**       NULL             BLOB            Result is a zero-length BLOB**       INTEGER          FLOAT           Convert from integer to float**       INTEGER          TEXT            ASCII rendering of the integer**       INTEGER          BLOB            Same as for INTEGER->TEXT**       FLOAT            INTEGER         Convert from float to integer**       FLOAT            TEXT            ASCII rendering of the float**       FLOAT            BLOB            Same as FLOAT->TEXT**       TEXT             INTEGER         Use atoi()**       TEXT             FLOAT           Use atof()**       TEXT             BLOB            No change**       BLOB             INTEGER         Convert to TEXT then use atoi()**       BLOB             FLOAT           Convert to TEXT then use atof()**       BLOB             TEXT            Add a \000 terminator if needed**** The following access routines are provided:**** _type()     Return the datatype of the result.  This is one of**             SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB,**             or SQLITE_NULL.** _blob()     Return the value of a BLOB.** _bytes()    Return the number of bytes in a BLOB value or the number**             of bytes in a TEXT value represented as UTF-8.  The \000**             terminator is included in the byte count for TEXT values.** _bytes16()  Return the number of bytes in a BLOB value or the number**             of bytes in a TEXT value represented as UTF-16.  The \u0000**             terminator is included in the byte count for TEXT values.** _double()   Return a FLOAT value.** _int()      Return an INTEGER value in the host computer's native**             integer representation.  This might be either a 32- or 64-bit**             integer depending on the host.** _int64()    Return an INTEGER value as a 64-bit signed integer.** _text()     Return the value as UTF-8 text.** _text16()   Return the value as UTF-16 text.*/const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);int sqlite3_column_bytes(sqlite3_stmt*, int iCol);int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);double sqlite3_column_double(sqlite3_stmt*, int iCol);int sqlite3_column_int(sqlite3_stmt*, int iCol);sqlite_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);int sqlite3_column_type(sqlite3_stmt*, int iCol);/*** The sqlite3_finalize() function is called to delete a compiled** SQL statement obtained by a previous call to sqlite3_prepare()** or sqlite3_prepare16(). If the statement was executed successfully, or** not executed at all, then SQLITE_OK is returned. If execution of the** statement failed then an error code is returned. **** This routine can be called at any point during the execution of the** virtual machine.  If the virtual machine has not completed execution** when this routine is called, that is like encountering an error or** an interrupt.  (See sqlite3_interrupt().)  Incomplete updates may be** rolled back and transactions cancelled,  depending on the circumstances,** and the result code returned will be SQLITE_ABORT.*/int sqlite3_finalize(sqlite3_stmt *pStmt);/*** The sqlite3_reset() function is called to reset a compiled SQL** statement obtained by a previous call to sqlite3_prepare() or** sqlite3_prepare16() back to it's initial state, ready to be re-executed.** Any SQL statement variables that had values bound to them using** the sqlite3_bind_*() API retain their values.*/int sqlite3_reset(sqlite3_stmt *pStmt);/*** The following two functions are used to add user functions or aggregates** implemented in C to the SQL langauge interpreted by SQLite. The** difference only between the two is that the second parameter, the** name of the (scalar) function or aggregate, is encoded in UTF-8 for** sqlite3_create_function() and UTF-16 for sqlite3_create_function16().**** The first argument is the database handle that the new function or** aggregate is to be added to. If a single program uses more than one** database handle internally, then user functions or aggregates must ** be added individually to each database handle with which they will be** used.**** The third parameter is the number of arguments that the function or** aggregate takes. If this parameter is negative, then the function or** aggregate may take any number of arguments.**** The fourth parameter is one of SQLITE_UTF* values defined below,** indicating the encoding that the function is most likely to handle** values in.  This does not change the behaviour of the programming** interface. However, if two versions of the same function are registered** with different encoding values, SQLite invokes the version likely to** minimize conversions between text encodings.**** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are** pointers to user implemented C functions that implement the user** function or aggregate. A scalar function requires an implementation of** the xFunc callback only, NULL pointers should be passed as the xStep** and xFinal parameters. An aggregate function requires an implementation** of xStep and xFinal, but NULL should be passed for xFunc. To delete an** existing user function or aggregate, pass NULL for all three function** callback. Specifying an inconstent set of callback values, such as an** xFunc and an xFinal, or an xStep but no xFinal, SQLITE_ERROR is** returned.*/int sqlite3_create_function(  sqlite3 *,  const char *zFunctionName,  int nArg,  int eTextRep,  void*,  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),  void (*xStep)(sqlite3_context*,int,sqlite3_value**),

⌨️ 快捷键说明

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