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

📄 sqlite3.h

📁 SQLite使用demo
💻 H
📖 第 1 页 / 共 5 页
字号:
**** The value returned may or may not include allocation** overhead, depending on which built-in memory allocator** implementation is used.*/sqlite3_int64 sqlite3_memory_used(void);sqlite3_int64 sqlite3_memory_highwater(int resetFlag);/*** CAPI3REF: Compile-Time Authorization Callbacks***** This routine registers a authorizer callback with the SQLite library.  ** The authorizer callback is invoked as SQL statements are being compiled** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  At various** points during the compilation process, as logic is being created** to perform various actions, the authorizer callback is invoked to** see if those actions are allowed.  The authorizer callback should** return SQLITE_OK to allow the action, [SQLITE_IGNORE] to disallow the** specific action but allow the SQL statement to continue to be** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be** rejected with an error.  **** Depending on the action, the [SQLITE_IGNORE] and [SQLITE_DENY] return** codes might mean something different or they might mean the same** thing.  If the action is, for example, to perform a delete opertion,** then [SQLITE_IGNORE] and [SQLITE_DENY] both cause the statement compilation** to fail with an error.  But if the action is to read a specific column** from a specific table, then [SQLITE_DENY] will cause the entire** statement to fail but [SQLITE_IGNORE] will cause a NULL value to be** read instead of the actual column value.**** The first parameter to the authorizer callback is a copy of** the third parameter to the sqlite3_set_authorizer() interface.** The second parameter to the callback is an integer ** [SQLITE_COPY | action code] that specifies the particular action** to be authorized.  The available action codes are** [SQLITE_COPY | documented separately].  The third through sixth** parameters to the callback are strings that contain additional** details about the action to be authorized.**** An authorizer is used when preparing SQL statements from an untrusted** source, to ensure that the SQL statements do not try to access data** that they are not allowed to see, or that they do not try to** execute malicious statements that damage the database.  For** example, an application may allow a user to enter arbitrary** SQL queries for evaluation by a database.  But the application does** not want the user to be able to make arbitrary changes to the** database.  An authorizer could then be put in place while the** user-entered SQL is being prepared that disallows everything** except SELECT statements.  **** Only a single authorizer can be in place on a database connection** at a time.  Each call to sqlite3_set_authorizer overrides the** previous call.  A NULL authorizer means that no authorization** callback is invoked.  The default authorizer is NULL.**** Note that the authorizer callback is invoked only during ** [sqlite3_prepare()] or its variants.  Authorization is not** performed during statement evaluation in [sqlite3_step()].*/int sqlite3_set_authorizer(  sqlite3*,  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),  void *pUserData);/*** CAPI3REF: Authorizer Return Codes**** The [sqlite3_set_authorizer | authorizer callback function] must** return either [SQLITE_OK] or one of these two constants in order** to signal SQLite whether or not the action is permitted.  See the** [sqlite3_set_authorizer | authorizer documentation] for additional** information.*/#define SQLITE_DENY   1   /* Abort the SQL statement with an error */#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error *//*** CAPI3REF: Authorizer Action Codes**** The [sqlite3_set_authorizer()] interface registers a callback function** that is invoked to authorizer certain SQL statement actions.  The** second parameter to the callback is an integer code that specifies** what action is being authorized.  These are the integer action codes that** the authorizer callback may be passed.**** These action code values signify what kind of operation is to be ** authorized.  The 3rd and 4th parameters to the authorization callback** function will be parameters or NULL depending on which of these** codes is used as the second parameter.  The 5th parameter to the** authorizer callback is the name of the database ("main", "temp", ** etc.) if applicable.  The 6th parameter to the authorizer callback** is the name of the inner-most trigger or view that is responsible for** the access attempt or NULL if this access attempt is directly from ** top-level SQL code.*//******************************************* 3rd ************ 4th ***********/#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */#define SQLITE_DELETE                9   /* Table Name      NULL            */#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */#define SQLITE_INSERT               18   /* Table Name      NULL            */#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */#define SQLITE_READ                 20   /* Table Name      Column Name     */#define SQLITE_SELECT               21   /* NULL            NULL            */#define SQLITE_TRANSACTION          22   /* NULL            NULL            */#define SQLITE_UPDATE               23   /* Table Name      Column Name     */#define SQLITE_ATTACH               24   /* Filename        NULL            */#define SQLITE_DETACH               25   /* Database Name   NULL            */#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */#define SQLITE_REINDEX              27   /* Index Name      NULL            */#define SQLITE_ANALYZE              28   /* Table Name      NULL            */#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */#define SQLITE_FUNCTION             31   /* Function Name   NULL            */#define SQLITE_COPY                  0   /* No longer used *//*** CAPI3REF: Tracing And Profiling Functions**** These routines register callback functions that can be used for** tracing and profiling the execution of SQL statements.** The callback function registered by sqlite3_trace() is invoked** at the first [sqlite3_step()] for the evaluation of an SQL statement.** The callback function registered by sqlite3_profile() is invoked** as each SQL statement finishes and includes** information on how long that statement ran.**** The sqlite3_profile() API is currently considered experimental and** is subject to change.*/void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);void *sqlite3_profile(sqlite3*,   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);/*** CAPI3REF: Query Progress Callbacks**** This routine configures a callback function - the progress callback - that** is invoked periodically during long running calls to [sqlite3_exec()],** [sqlite3_step()] and [sqlite3_get_table()].  An example use for this ** interface is to keep a GUI updated during a large query.**** The progress callback is invoked once for every N virtual machine opcodes,** where N is the second argument to this function. The progress callback** itself is identified by the third argument to this function. The fourth** argument to this function is a void pointer passed to the progress callback** function each time it is invoked.**** If a call to [sqlite3_exec()], [sqlite3_step()], or [sqlite3_get_table()]** results in fewer than N opcodes being executed, then the progress ** callback is never invoked.** ** Only a single progress callback function may be registered for each** open database connection.  Every call to sqlite3_progress_handler()** overwrites the results of the previous call.** To remove the progress callback altogether, pass NULL as the third** argument to this function.**** If the progress callback returns a result other than 0, then the current ** query is immediately terminated and any database changes rolled back.** The containing [sqlite3_exec()], [sqlite3_step()], or** [sqlite3_get_table()] call returns SQLITE_INTERRUPT.   This feature** can be used, for example, to implement the "Cancel" button on a** progress dialog box in a GUI.*/void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);/*** CAPI3REF: Opening A New Database Connection**** Open the sqlite database file "filename".  The "filename" is UTF-8** encoded for [sqlite3_open()] and [sqlite3_open_v2()] and UTF-16 encoded** in the native byte order for [sqlite3_open16()].** An [sqlite3*] handle is returned in *ppDb, even** if an error occurs. If the database is opened (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.**** The default encoding for the database will be UTF-8 if** [sqlite3_open()] or [sqlite3_open_v2()] is called and** UTF-16 if [sqlite3_open16()] is used.**** Whether or not an error occurs when it is opened, resources associated** with the [sqlite3*] handle should be released by passing it to** [sqlite3_close()] when it is no longer required.**** The [sqlite3_open_v2()] interface works like [sqlite3_open()] except that** provides two additional parameters for additional control over the** new database connection.  The flags parameter can be one of:**** <ol>** <li>  [SQLITE_OPEN_READONLY]** <li>  [SQLITE_OPEN_READWRITE]** <li>  [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]** </ol>**** The first value opens the database read-only.  If the database does** not previously exist, an error is returned.  The second option opens** the database for reading and writing if possible, or reading only if** if the file is write protected.  In either case the database must already** exist or an error is returned.  The third option opens the database** for reading and writing and creates it if it does not already exist.** The third options is behavior that is always used for [sqlite3_open()]** and [sqlite3_open16()].**** If the filename is ":memory:", then an private** in-memory database is created for the connection.  This in-memory** database will vanish when the database connection is closed.  Future** version of SQLite might make use of additional special filenames** that begin with the ":" character.  It is recommended that ** when a database filename really does begin with** ":" that you prefix the filename with a pathname like "./" to** avoid ambiguity.**** If the filename is an empty string, then a private temporary** on-disk database will be created.  This private database will be** automatically deleted as soon as the database connection is closed.**** The fourth parameter to sqlite3_open_v2() is the name of the** [sqlite3_vfs] object that defines the operating system ** interface that the new database connection should use.  If the** fourth parameter is a NULL pointer then the default [sqlite3_vfs]** object is used.**** <b>Note to windows users:</b>  The encoding used for the filename argument** of [sqlite3_open()] and [sqlite3_open_v2()] must be UTF-8, not whatever** codepage is currently defined.  Filenames containing international** characters must be converted to UTF-8 prior to passing them into** [sqlite3_open()] or [sqlite3_open_v2()].*/int sqlite3_open(  const char *filename,   /* Database filename (UTF-8) */  sqlite3 **ppDb          /* OUT: SQLite db handle */);int sqlite3_open16(  const void *filename,   /* Database filename (UTF-16) */  sqlite3 **ppDb          /* OUT: SQLite db handle */);int sqlite3_open_v2(  const char *filename,   /* Database filename (UTF-8) */  sqlite3 **ppDb,         /* OUT: SQLite db handle */  int flags,              /* Flags */  const char *zVfs        /* Name of VFS module to use */);/*** CAPI3REF: Error Codes And Messages**** The sqlite3_errcode() interface returns the numeric** [SQLITE_OK | result code] or [SQLITE_IOERR_READ | extended result code]** for the most recent failed sqlite3_* API call associated** with [sqlite3] handle 'db'.  If a prior API call failed but the** most recent API call succeeded, the return value from sqlite3_errcode()** is undefined. **** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language** text that describes the error, as either UTF8 or UTF16 respectively.** Memory to hold the error message string is managed internally.  The ** string may be overwritten or deallocated by subsequent calls to SQLite** interface functions.**** Calls to many sqlite3_* functions set the error code and string returned** by [sqlite3_errcode()], [sqlite3_errmsg()], and [sqlite3_errmsg16()]** (overwriting the previous values). Note that calls to [sqlite3_errcode()],** [sqlite3_errmsg()], and [sqlite3_errmsg16()] themselves do not affect the** results of future invocations.  Calls to API routines that do not return** an error code (example: [sqlite3_data_count()]) do not** change the error code returned by this routine.  Interfaces that are** not associated with a specific database connection (examples:** [sqlite3_mprintf()] or [sqlite3_enable_shared_cache()] do not change** the return code.  **** Assuming no other intervening sqlite3_* API calls are made, the error** code returne

⌨️ 快捷键说明

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