Add some comments for sqlite3_bind_*() APIs. (CVS 1411)
FossilOrigin-Name: 46b0942239dde9982abaaa7f77d5cf8375eb4209
This commit is contained in:
parent
51e3d8e204
commit
e3209e4eb6
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Add\ssupport\sfor\sthe\snew\ssqlite3_bind_*()\sAPIs.\s(CVS\s1410)
|
||||
D 2004-05-20T01:12:34
|
||||
C Add\ssome\scomments\sfor\ssqlite3_bind_*()\sAPIs.\s(CVS\s1411)
|
||||
D 2004-05-20T01:40:19
|
||||
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -36,7 +36,7 @@ F src/func.c cfbb7096efb58e2857e3b312a8958a12774b625a
|
||||
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
|
||||
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
|
||||
F src/insert.c 0ee4c4039fede2b9ab594c4d2db24c9b22e0fbc5
|
||||
F src/main.c 4b82d7e78f4c9799343b02740a5ba9768d5e464d
|
||||
F src/main.c 2bfbddaea0a1db592967f4b0844473a24adce2fe
|
||||
F src/md5.c 8e39fdae6d8776b87558e91dcc94740c9b635a9c
|
||||
F src/os.c ddcda92f7fd71b4513c57c1ec797917f206d504e
|
||||
F src/os.h fbb2f6595fc34fa351830d88fe1c6b85118f0383
|
||||
@ -48,7 +48,7 @@ F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
|
||||
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
||||
F src/select.c d01c03462d57b9d1ea25eea297bbd2c1b1c70e47
|
||||
F src/shell.c 0c4662e13bfbfd3d13b066c5859cc97ad2f95d21
|
||||
F src/sqlite.h.in 8c62076ea226b1870df977d7438bf99383d02387
|
||||
F src/sqlite.h.in f9c9ffd435312810a59a4af055021b1a22d78c28
|
||||
F src/sqliteInt.h 6b43ef88542c242b39ed41a84055e4504571a9f0
|
||||
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
|
||||
F src/tclsqlite.c fbf0fac73624ae246551a6c671f1de0235b5faa1
|
||||
@ -66,7 +66,7 @@ F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476
|
||||
F src/vdbe.c 973ffe763e40b0a5c993d5f5632de58a37c411db
|
||||
F src/vdbe.h 314e9c07db73a42a6ba91ab7539e27652fc88870
|
||||
F src/vdbeInt.h 97b95c622ea467d39879ae97d07732ebb4891b76
|
||||
F src/vdbeaux.c 4cd7291c34ff21079d4ddd62df4390b8bc22d1fb
|
||||
F src/vdbeaux.c 0039a786c6d1c1eeff36f50ad2c528de70e11b26
|
||||
F src/where.c 626b2cbc4290d8be6c04ad7c8395f46d4e21d0d8
|
||||
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
||||
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
|
||||
@ -193,7 +193,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 7eb3f29e305d0f455f6544560c567fa6b6e24986
|
||||
R 1fcae74675628dbbea5a8739e50916af
|
||||
P e8f980d842fcd793552acd32708db55c8f014634
|
||||
R ff1d476628b978b3ce61cabdfeaf9500
|
||||
U danielk1977
|
||||
Z 6bd7c10a30f56d031b982fa43af23d80
|
||||
Z 9e5c0dffac260fbbd261d4d8a7cf1b3b
|
||||
|
@ -1 +1 @@
|
||||
e8f980d842fcd793552acd32708db55c8f014634
|
||||
46b0942239dde9982abaaa7f77d5cf8375eb4209
|
62
src/main.c
62
src/main.c
@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.175 2004/05/12 11:24:03 danielk1977 Exp $
|
||||
** $Id: main.c,v 1.176 2004/05/20 01:40:19 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -1149,66 +1149,6 @@ int sqlite3_step(sqlite3_stmt *pStmt){
|
||||
return sqlite3_step(pStmt);
|
||||
}
|
||||
|
||||
/*
|
||||
** sqlite3_bind_text
|
||||
*/
|
||||
int sqlite3_bind_text(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
const char *zVal,
|
||||
int n,
|
||||
int eCopy
|
||||
){
|
||||
return sqlite3_bind(pStmt, i, zVal, n, eCopy);
|
||||
}
|
||||
|
||||
int sqlite3_bind_text16(
|
||||
sqlite3_stmt *pStmt,
|
||||
int i,
|
||||
void *zVal,
|
||||
int n,
|
||||
int eCopy
|
||||
){
|
||||
int rc;
|
||||
char * zVal8;
|
||||
|
||||
/* convert the first n bytes of the UTF-16 string to UTF-8 */
|
||||
zVal8 = sqlite3utf16to8(zVal, n);
|
||||
if( !zVal8 ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
/* Pass -1 as the length of the UTF-8 string. It is guaranteed to be
|
||||
** NULL-terminated by sqlite3utf16to8().
|
||||
*/
|
||||
rc = sqlite3_bind_text(pStmt, i, zVal8, -1, eCopy);
|
||||
sqliteFree(filename8);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** sqlite3_bind_null
|
||||
*/
|
||||
int sqlite3_bind_null(sqlite3_stmt*, int iParm){
|
||||
return sqlite3_bind(pStmt, i, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
int sqlite3_bind_int32(sqlite3_stmt*, int iParm, int iValue){
|
||||
assert(!"TODO");
|
||||
}
|
||||
int sqlite3_bind_int64(sqlite3_stmt*, int iParm, long long int iValue){
|
||||
assert(!"TODO");
|
||||
}
|
||||
int sqlite3_bind_double(sqlite3_stmt*, int iParm, double iValue){
|
||||
assert(!"TODO");
|
||||
}
|
||||
int sqlite3_bind_blob(sqlite3_stmt*, int i, const void*, int n, int eCopy){
|
||||
assert(!"TODO");
|
||||
}
|
||||
|
||||
|
||||
int sqlite3_column_count(sqlite3_stmt*){
|
||||
}
|
||||
|
||||
|
114
src/sqlite.h.in
114
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.64 2004/05/19 10:34:52 danielk1977 Exp $
|
||||
** @(#) $Id: sqlite.h.in,v 1.65 2004/05/20 01:40:19 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef _SQLITE_H_
|
||||
#define _SQLITE_H_
|
||||
@ -863,13 +863,119 @@ int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
|
||||
|
||||
typedef sqlite_vm sqlite3_stmt;
|
||||
|
||||
/*
|
||||
** This routine is used to bind a 32-bit integer value to a variable
|
||||
** in an SQL statement compiled by sqlite3_compile(). See comments for
|
||||
** sqlite3_compile() for more details on SQL statement variables.
|
||||
**
|
||||
** The first argument is a pointer to an SQL statement previously
|
||||
** obtained from a call to sqlite3_compile(). The second parameter "i"
|
||||
** determines the parameter to bind the value "iValue" to.
|
||||
*/
|
||||
int sqlite3_bind_int32(sqlite3_stmt*, int i, int iValue);
|
||||
|
||||
/*
|
||||
** This routine is used to bind a 64-bit integer value to a variable
|
||||
** in an SQL statement compiled by sqlite3_compile(). See comments for
|
||||
** sqlite3_compile() for more details on SQL statement variables.
|
||||
**
|
||||
** The first argument is a pointer to an SQL statement previously
|
||||
** obtained from a call to sqlite3_compile(). The second parameter "i"
|
||||
** determines the parameter to bind the value "iValue" to.
|
||||
*/
|
||||
int sqlite3_bind_int64(sqlite3_stmt*, int i, long long int iValue);
|
||||
|
||||
/*
|
||||
** This routine is used to bind a real (floating point) value to a variable
|
||||
** in an SQL statement compiled by sqlite3_compile(). See comments for
|
||||
** sqlite3_compile() for more details on SQL statement variables.
|
||||
**
|
||||
** The first argument is a pointer to an SQL statement previously obtained
|
||||
** from a call to sqlite3_compile(). The second parameter "i" determines
|
||||
** the parameter to bind the value "iValue" to. Internally, SQLite will
|
||||
** manipulate the value as a 64-bit IEEE float.
|
||||
*/
|
||||
int sqlite3_bind_double(sqlite3_stmt*, int i, double iValue);
|
||||
|
||||
/*
|
||||
** This routine is used to bind a NULL value to a variable in an SQL
|
||||
** statement compiled by sqlite3_compile(). See comments for
|
||||
** sqlite3_compile() for more details on SQL statement variables.
|
||||
**
|
||||
** The first argument is a pointer to an SQL statement previously obtained
|
||||
** from a call to sqlite3_compile(). The second parameter "i" determines
|
||||
** the parameter to bind the NULL value to.
|
||||
*/
|
||||
int sqlite3_bind_null(sqlite3_stmt*, int i);
|
||||
int sqlite3_bind_text(sqlite3_stmt*, int i, const char*, int n, int eCopy);
|
||||
int sqlite3_bind_text16(sqlite3_stmt*, int i, const void*, int, int eCopy);
|
||||
int sqlite3_bind_blob(sqlite3_stmt*, int i, const void*, int n, int eCopy);
|
||||
|
||||
/*
|
||||
** This routine is used to bind a UTF-8 string value to a variable in an
|
||||
** SQL statement compiled by sqlite3_compile(). See comments for
|
||||
** sqlite3_compile() for more details on SQL statement variables.
|
||||
**
|
||||
** The first argument is a pointer to an SQL statement previously obtained
|
||||
** from a call to sqlite3_compile(). The second parameter "i" determines
|
||||
** the parameter to bind the value to. Parameter three "z" is a pointer
|
||||
** to the UTF-8 string.
|
||||
**
|
||||
** The fourth "n" parameter is the number of bytes (not characters) in the
|
||||
** string pointed to by "z". "n" may or may not include any nul terminator
|
||||
** character. If "n" is less than zero, then SQLite assumes that "z" is
|
||||
** a nul terminated string.
|
||||
**
|
||||
** If paramater "eCopy" is true, then SQLite makes a copy of the string
|
||||
** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
|
||||
** the original string data. In this case the caller must ensure that the
|
||||
** string data remains stable until after the SQL statement has been
|
||||
** finalised or another value bound to variable "i".
|
||||
*/
|
||||
int sqlite3_bind_text(sqlite3_stmt*, int i, const char* z, int n, int eCopy);
|
||||
|
||||
/*
|
||||
** This routine is used to bind a UTF-16 string value to a variable in an
|
||||
** SQL statement compiled by sqlite3_compile(). See comments for
|
||||
** sqlite3_compile() for more details on SQL statement variables.
|
||||
**
|
||||
** The first argument is a pointer to an SQL statement previously obtained
|
||||
** from a call to sqlite3_compile(). The second parameter "i" determines
|
||||
** the parameter to bind the value to. Parameter three "z" is a pointer to
|
||||
** the UTF-16 string. If the string does not begin with a byte-order-mark,
|
||||
** it is assumed to be encoded in the native byte order of the machine.
|
||||
**
|
||||
** The fourth "n" parameter is the number of bytes (not characters) in the
|
||||
** string pointed to by "z". "n" may or may not include any nul terminator
|
||||
** character. If "n" is less than zero, then SQLite assumes that "z" is
|
||||
** terminated by a pair of 0x00 characters.
|
||||
**
|
||||
** If paramater "eCopy" is true, then SQLite makes a copy of the string
|
||||
** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
|
||||
** the original string data. In this case the caller must ensure that the
|
||||
** string data remains stable until after the SQL statement has been
|
||||
** finalised or another value bound to variable "i".
|
||||
*/
|
||||
int sqlite3_bind_text16(sqlite3_stmt*, int i, const void *z, int, int eCopy);
|
||||
|
||||
/*
|
||||
** This routine is used to bind a blob value to a variable in an
|
||||
** SQL statement compiled by sqlite3_compile(). See comments for
|
||||
** sqlite3_compile() for more details on SQL statement variables.
|
||||
**
|
||||
** The first argument is a pointer to an SQL statement previously obtained
|
||||
** from a call to sqlite3_compile(). The second parameter "i" determines
|
||||
** the parameter to bind the value to. Parameter three "z" is a pointer to
|
||||
** the blob of data.
|
||||
**
|
||||
** The fourth "n" parameter is the number of bytes in the blob pointed to
|
||||
** by "z". "n" may not be less than zero.
|
||||
**
|
||||
** If paramater "eCopy" is true, then SQLite makes a copy of the blob
|
||||
** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
|
||||
** the original blob data. In this case the caller must ensure that the
|
||||
** blob data remains stable until after the SQL statement has been
|
||||
** finalised or another value bound to variable "i".
|
||||
*/
|
||||
int sqlite3_bind_blob(sqlite3_stmt*, int i, const void *z, int n, int eCopy);
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
@ -1004,6 +1004,9 @@ static int vdbeBindBlob(
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a 64 bit integer to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_int64(sqlite3_stmt *p, int i, long long int iValue){
|
||||
int rc;
|
||||
Vdbe *v = (Vdbe *)p;
|
||||
@ -1016,10 +1019,16 @@ int sqlite3_bind_int64(sqlite3_stmt *p, int i, long long int iValue){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a 32 bit integer to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_int32(sqlite3_stmt *p, int i, int iValue){
|
||||
return sqlite3_bind_int64(p, i, (long long int)iValue);
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a double (real) to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_double(sqlite3_stmt *p, int i, double iValue){
|
||||
int rc;
|
||||
Vdbe *v = (Vdbe *)p;
|
||||
@ -1032,10 +1041,16 @@ int sqlite3_bind_double(sqlite3_stmt *p, int i, double iValue){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a NULL value to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_null(sqlite3_stmt* p, int i){
|
||||
return vdbeUnbind((Vdbe *)p, i);
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a UTF-8 text value to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_text(
|
||||
sqlite3_stmt *p,
|
||||
int i,
|
||||
@ -1055,6 +1070,9 @@ int sqlite3_bind_text(
|
||||
return vdbeBindBlob((Vdbe *)p, i, zData, nData, eCopy, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a UTF-16 text value to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_text16(
|
||||
sqlite3_stmt *p,
|
||||
int i,
|
||||
@ -1084,6 +1102,9 @@ int sqlite3_bind_text16(
|
||||
return vdbeBindBlob((Vdbe *)p, i, zData, nData, eCopy, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a blob value to an SQL statement variable.
|
||||
*/
|
||||
int sqlite3_bind_blob(
|
||||
sqlite3_stmt *p,
|
||||
int i,
|
||||
|
Loading…
Reference in New Issue
Block a user