Sqlite3 语句原文解析摘取

前端之家收集整理的这篇文章主要介绍了Sqlite3 语句原文解析摘取前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

** ^The sqlite3_finalize() function is called to delete a [prepared statement].


** The sqlite3_reset() function is called to reset a [prepared statement]

** object back to its initial state,ready to be re-executed.

** ^The number of columns in the result can be determined using

** [sqlite3_column_count()].

** ^The sqlite3_data_count(P) interface returns the number of columns in the

** current row of the result set of [prepared statement] P.


sqlite3_step

** After a [prepared statement] has been prepared using either

** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy

** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()],this function

** must be called one or more times to evaluate the statement.

**

** The details of the behavior of the sqlite3_step() interface depend

** on whether the statement was prepared using the newer "v2" interface

** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy

** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the

** new "v2" interface is recommended for new applications but the legacy

** interface will continue to be supported.

sqlite3_column_name

** ^These routines return the name assigned to a particular column

** in the result set of a [SELECT] statement. ^The sqlite3_column_name()

** interface returns a pointer to a zero-terminated UTF-8 string

** and sqlite3_column_name16() returns a pointer to a zero-terminated

** UTF-16 string. ^The first parameter is the [prepared statement]

** that implements the [SELECT] statement. ^The second parameter is the

** column number. ^The leftmost column is number 0.

** ^The first argument to the sqlite3_bind_*() routines is always

** a pointer to the [sqlite3_stmt] object returned from

** [sqlite3_prepare_v2()] or its variants.


sqlITE_API int sqlite3_prepare(

sqlite3 *db,/* Database handle */

const char *zsql,/* sql statement,UTF-8 encoded */

int nByte,/* Maximum length of zsql in bytes. */

sqlite3_stmt **ppStmt,/* OUT: Statement handle */

const char **pzTail /* OUT: Pointer to unused portion of zsql */

);

** The first argument,"db",is a [database connection] obtained from a

** prior successful call to [sqlite3_open()],[sqlite3_open_v2()] or

** [sqlite3_open16()]. The database connection must not have been closed.

** The second argument,"zsql",is the statement to be compiled,encoded

** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2()

** interfaces use UTF-8,and sqlite3_prepare16() and sqlite3_prepare16_v2()

** use UTF-16.

/*

** CAPI3REF: sql Statement Object

** KEYWORDS: {prepared statement} {prepared statements}

** An instance of this object represents a single sql statement.

** This object is varIoUsly known as a "prepared statement" or a

** "compiled sql statement" or simply as a "statement".

** The life of a statement object goes something like this:

** <ol>

** <li> Create the object using [sqlite3_prepare_v2()] or a related

** function.

** <li> Bind values to [host parameters] using the sqlite3_bind_*()

** interfaces.

** <li> Run the sql by calling [sqlite3_step()] one or more times.

** <li> Reset the statement using [sqlite3_reset()] then go back

** to step 2. Do this zero or more times.

** <li> Destroy the object using [sqlite3_finalize()].

** </ol>

** Refer to documentation on individual methods above for additional

** information.

*/

typedef struct sqlite3_stmt sqlite3_stmt;


sqlITE_API int sqlite3_open(

const char *filename,/* Database filename (UTF-8) */

sqlite3 **ppDb /* OUT: sqlite db handle */

);

** CAPI3REF: opening A New Database Connection

** ^These routines open an sqlite database file as specified by the

** filename argument. ^The filename argument is interpreted as UTF-8 for

** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte

** order for sqlite3_open16(). ^(A [database connection] handle is usually

** returned in *ppDb,even if an error occurs. The only exception is that

** if sqlite is unable to allocate memory to hold the [sqlite3] object,

** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]

** object.)^ ^(If the database is opened (and/or created) successfully,then

** [sqlITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The

** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain

** an English language description of the error following a failure of any

** of the sqlite3_open() routines.

sqlITE_API void sqlite3_free(void*);

** ^Calling sqlite3_free() with a pointer prevIoUsly returned

** by sqlite3_malloc() or sqlite3_realloc() releases that memory so

** that it might be reused. ^The sqlite3_free() routine is

** a no-op if is called with a NULL pointer. Passing a NULL pointer

** to sqlite3_free() is harmless. After being freed,memory

** should neither be read nor written. Even reading prevIoUsly freed

** memory might result in a segmentation fault or other severe error.

** Memory corruption,a segmentation fault,or other severe error

** might result if sqlite3_free() is called with a non-NULL pointer that

** was not obtained from sqlite3_malloc() or sqlite3_realloc().

sqlITE_API int sqlite3_exec(

sqlite3*,/* An open database */

const char *sql,/* sql to be evaluated */

int (*callback)(void*,int,char**,char**),/* Callback function */

void *,/* 1st argument to callback */

char **errmsg /* Error msg written here */

** <ul>

** <li> The application must insure that the 1st parameter to sqlite3_exec()

** is a valid and open [database connection].

** <li> The application must not close [database connection] specified by

** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.

** <li> The application must not modify the sql statement text passed into

** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.

** </ul>

** The sqlite3_exec() interface is a convenience wrapper around

** [sqlite3_prepare_v2()],[sqlite3_step()],and [sqlite3_finalize()],87)"> ** that allows an application to run multiple statements of sql

** without having to use a lot of C code.

sqlITE_API int sqlite3_close(sqlite3 *);

** CAPI3REF: Closing A Database Connection

** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.

** ^Calls to sqlite3_close() return sqlITE_OK if the [sqlite3] object is

** successfully destroyed and all associated resources are deallocated.

typedef struct sqlite3 sqlite3;

** CAPI3REF: Database Connection Handle

** KEYWORDS: {database connection} {database connections}


#define sqlITE_OK 0 /* Successful result */

/* beginning-of-error-codes */

#define sqlITE_ERROR 1 /* sql error or missing database */

#define sqlITE_INTERNAL 2 /* Internal logic error in sqlite */

#define sqlITE_PERM 3 /* Access permission denied */

#define sqlITE_ABORT 4 /* Callback routine requested an abort */

#define sqlITE_BUSY 5 /* The database file is locked */

#define sqlITE_LOCKED 6 /* A table in the database is locked */

#define sqlITE_NOMEM 7 /* A malloc() Failed */

#define sqlITE_READONLY 8 /* Attempt to write a readonly database */

#define sqlITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/

#define sqlITE_IOERR 10 /* Some kind of disk I/O error occurred */

#define sqlITE_CORRUPT 11 /* The database disk image is malformed */

#define sqlITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */

#define sqlITE_FULL 13 /* Insertion Failed because database is full */

#define sqlITE_CANTOPEN 14 /* Unable to open the database file */

#define sqlITE_PROTOCOL 15 /* Database lock protocol error */

#define sqlITE_EMPTY 16 /* Database is empty */

#define sqlITE_SCHEMA 17 /* The database schema changed */

#define sqlITE_TOOBIG 18 /* String or BLOB exceeds size limit */

#define sqlITE_CONSTRAINT 19 /* Abort due to constraint violation */

#define sqlITE_MISMATCH 20 /* Data type mismatch */

#define sqlITE_MISUSE 21 /* Library used incorrectly */

#define sqlITE_NOLFS 22 /* Uses OS features not supported on host */

#define sqlITE_AUTH 23 /* Authorization denied */

#define sqlITE_FORMAT 24 /* Auxiliary database format error */

#define sqlITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */

#define sqlITE_NOTADB 26 /* File opened that is not a database file */

#define sqlITE_ROW 100 /* sqlite3_step() has another row ready */

#define sqlITE_DONE 101 /* sqlite3_step() has finished executing */

/* end-of-error-codes */



** CAPI3REF: Find the next prepared statement

** ^This interface returns a pointer to the next [prepared statement] after

** pStmt associated with the [database connection] pDb. ^If pStmt is NULL

** then this interface returns a pointer to the first prepared statement

** associated with the database connection pDb. ^If no prepared statement

** satisfies the conditions of this routine,it returns NULL.

** The [database connection] pointer D in a call to

** [sqlite3_next_stmt(D,S)] must refer to an open database

** connection and in particular must not be a NULL pointer.

*/

sqlITE_API @H_591_502@sqlite3_stmt *sqlite3_next_stmt(@H_591_502@sqlite3 *pDb,@H_591_502@sqlite3_stmt *pStmt);

原文链接:https://www.f2er.com/sqlite/200076.html

猜你在找的Sqlite相关文章