mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-19 21:43:15 +03:00
Use the new API calls more consistently. (CVS 1459)
FossilOrigin-Name: 17e7db488dac6b30d174f2272edf1046c2bb9990
This commit is contained in:
124
src/sqlite.h.in
124
src/sqlite.h.in
@@ -12,7 +12,7 @@
|
||||
** This header file defines the interface that the SQLite library
|
||||
** presents to client programs.
|
||||
**
|
||||
** @(#) $Id: sqlite.h.in,v 1.78 2004/05/26 00:07:25 danielk1977 Exp $
|
||||
** @(#) $Id: sqlite.h.in,v 1.79 2004/05/26 02:04:57 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef _SQLITE_H_
|
||||
#define _SQLITE_H_
|
||||
@@ -542,112 +542,6 @@ int sqlite3_set_authorizer(
|
||||
*/
|
||||
void *sqlite3_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
|
||||
|
||||
/*** The Callback-Free API
|
||||
**
|
||||
** The following routines implement a new way to access SQLite that does not
|
||||
** involve the use of callbacks.
|
||||
**
|
||||
** An sqlite_vm is an opaque object that represents a single SQL statement
|
||||
** that is ready to be executed.
|
||||
*/
|
||||
typedef struct sqlite_vm sqlite_vm;
|
||||
|
||||
/*
|
||||
** To execute an SQLite query without the use of callbacks, you first have
|
||||
** to compile the SQL using this routine. The 1st parameter "db" is a pointer
|
||||
** to an sqlite object obtained from sqlite3_open(). The 2nd parameter
|
||||
** "zSql" is the text of the SQL to be compiled. The remaining parameters
|
||||
** are all outputs.
|
||||
**
|
||||
** *pzTail is made to point to the first character past the end of the first
|
||||
** SQL statement in zSql. This routine only compiles the first statement
|
||||
** in zSql, so *pzTail is left pointing to what remains uncompiled.
|
||||
**
|
||||
** *ppVm is left pointing to a "virtual machine" that can be used to execute
|
||||
** the compiled statement. Or if there is an error, *ppVm may be set to NULL.
|
||||
** If the input text contained no SQL (if the input is and empty string or
|
||||
** a comment) then *ppVm is set to NULL.
|
||||
**
|
||||
** If any errors are detected during compilation, an error message is written
|
||||
** into space obtained from malloc() and *pzErrMsg is made to point to that
|
||||
** error message. The calling routine is responsible for freeing the text
|
||||
** of this message when it has finished with it. Use sqlite3_freemem() to
|
||||
** free the message. pzErrMsg may be NULL in which case no error message
|
||||
** will be generated.
|
||||
**
|
||||
** On success, SQLITE_OK is returned. Otherwise and error code is returned.
|
||||
*/
|
||||
int sqlite3_compile(
|
||||
sqlite *db, /* The open database */
|
||||
const char *zSql, /* SQL statement to be compiled */
|
||||
const char **pzTail, /* OUT: uncompiled tail of zSql */
|
||||
sqlite_vm **ppVm, /* OUT: the virtual machine to execute zSql */
|
||||
char **pzErrmsg /* OUT: Error message. */
|
||||
);
|
||||
|
||||
/*
|
||||
** This routine is called to delete a virtual machine after it has finished
|
||||
** executing. The return value is the result code. SQLITE_OK is returned
|
||||
** if the statement executed successfully and some other value is returned if
|
||||
** there was any kind of error. If an error occurred and pzErrMsg is not
|
||||
** NULL, then an error message is written into memory obtained from malloc()
|
||||
** and *pzErrMsg is made to point to that error message. The calling routine
|
||||
** should use sqlite3_freemem() to delete this message when it has finished
|
||||
** with it.
|
||||
**
|
||||
** 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(sqlite_vm*, char **pzErrMsg);
|
||||
|
||||
/*
|
||||
** This routine deletes the virtual machine, writes any error message to
|
||||
** *pzErrMsg and returns an SQLite return code in the same way as the
|
||||
** sqlite3_finalize() function.
|
||||
**
|
||||
** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual
|
||||
** machine loaded with the compiled version of the original query ready for
|
||||
** execution.
|
||||
**
|
||||
** If sqlite3_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.
|
||||
**
|
||||
******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
|
||||
*/
|
||||
int sqlite3_reset(sqlite_vm*, char **pzErrMsg);
|
||||
|
||||
/*
|
||||
** If the SQL that was handed to sqlite3_prepare contains variables that
|
||||
** are represeted in the SQL text by a question mark ('?'). This routine
|
||||
** is used to assign values to those variables.
|
||||
**
|
||||
** The first parameter is a virtual machine obtained from sqlite3_prepare().
|
||||
** The 2nd "idx" parameter determines which variable in the SQL statement
|
||||
** to bind the value to. The left most '?' is 1. The 3rd parameter is
|
||||
** the value to assign to that variable. The 4th parameter is the number
|
||||
** of bytes in the value, including the terminating \000 for strings.
|
||||
** Finally, the 5th "copy" parameter is TRUE if SQLite should make its
|
||||
** own private copy of this value, or false if the space that the 3rd
|
||||
** parameter points to will be unchanging and can be used directly by
|
||||
** SQLite.
|
||||
**
|
||||
** Unbound variables are treated as having a value of NULL. To explicitly
|
||||
** set a variable to NULL, call this routine with the 3rd parameter as a
|
||||
** NULL pointer.
|
||||
**
|
||||
** If the 4th "len" parameter is -1, then strlen() is used to find the
|
||||
** length.
|
||||
**
|
||||
** This routine can only be called immediately after sqlite3_prepare()
|
||||
** or sqlite3_reset() and before any calls to sqlite3_step().
|
||||
**
|
||||
******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
|
||||
*/
|
||||
int sqlite3_bind(sqlite_vm*, int idx, const char *value, int len, int copy);
|
||||
|
||||
/*
|
||||
** This routine configures a callback function - the progress callback - that
|
||||
** is invoked periodically during long running calls to sqlite3_exec(),
|
||||
@@ -664,7 +558,6 @@ int sqlite3_bind(sqlite_vm*, int idx, const char *value, int len, int copy);
|
||||
** in less than N opcodes being executed, then the progress callback is not
|
||||
** invoked.
|
||||
**
|
||||
** Calling this routine overwrites any previously installed progress callback.
|
||||
** To remove the progress callback altogether, pass NULL as the third
|
||||
** argument to this function.
|
||||
**
|
||||
@@ -755,10 +648,10 @@ int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out);
|
||||
int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
|
||||
|
||||
|
||||
/* FIX ME */
|
||||
typedef sqlite_vm sqlite3_stmt;
|
||||
typedef sqlite sqlite3;
|
||||
|
||||
typedef struct sqlite3_stmt sqlite3_stmt;
|
||||
|
||||
/*
|
||||
** This routine is used to bind a 32-bit integer value to a variable
|
||||
** in an SQL statement compiled by sqlite3_prepare(). See comments for
|
||||
@@ -1084,8 +977,15 @@ int sqlite3_step(sqlite3_stmt*);
|
||||
** 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_new(sqlite3_stmt *pStmt);
|
||||
int sqlite3_finalize(sqlite3_stmt *pStmt);
|
||||
|
||||
/*
|
||||
** The sqlite3_reset() function is called to reset a compiled SQL
|
||||
@@ -1094,7 +994,7 @@ int sqlite3_finalize_new(sqlite3_stmt *pStmt);
|
||||
** Any SQL statement variables that had values bound to them using
|
||||
** the sqlite3_bind_*() API retain their values.
|
||||
*/
|
||||
int sqlite3_reset_new(sqlite3_stmt *pStmt);
|
||||
int sqlite3_reset(sqlite3_stmt *pStmt);
|
||||
|
||||
/*
|
||||
** Open the sqlite database file "filename", where "filename" is UTF-8
|
||||
|
||||
Reference in New Issue
Block a user