Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add some comments for sqlite3_bind_*() APIs. (CVS 1411) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
46b0942239dde9982abaaa7f77d5cf83 |
User & Date: | danielk1977 2004-05-20 01:40:19.000 |
Context
2004-05-20
| ||
02:01 | VACUUM works again. (CVS 1412) (check-in: c4e1d02ffd user: drh tags: trunk) | |
01:40 | Add some comments for sqlite3_bind_*() APIs. (CVS 1411) (check-in: 46b0942239 user: danielk1977 tags: trunk) | |
01:12 | Add support for the new sqlite3_bind_*() APIs. (CVS 1410) (check-in: e8f980d842 user: danielk1977 tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.176 2004/05/20 01:40:19 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** A pointer to this structure is used to communicate information |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | /* ** sqlite3_step */ int sqlite3_step(sqlite3_stmt *pStmt){ return sqlite3_step(pStmt); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | /* ** sqlite3_step */ int sqlite3_step(sqlite3_stmt *pStmt){ return sqlite3_step(pStmt); } int sqlite3_column_count(sqlite3_stmt*){ } int sqlite3_column_type(sqlite3_stmt*,int){ } |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the SQLite library ** presents to client programs. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the SQLite library ** presents to client programs. ** ** @(#) $Id: sqlite.h.in,v 1.65 2004/05/20 01:40:19 danielk1977 Exp $ */ #ifndef _SQLITE_H_ #define _SQLITE_H_ #include <stdarg.h> /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. |
︙ | ︙ | |||
859 860 861 862 863 864 865 866 867 868 869 | ** The "in" and "out" parameters may point to the same buffer in order ** to decode a string in place. */ int sqlite_decode_binary(const unsigned char *in, unsigned char *out); typedef sqlite_vm sqlite3_stmt; int sqlite3_bind_int32(sqlite3_stmt*, int i, int iValue); int sqlite3_bind_int64(sqlite3_stmt*, int i, long long int iValue); int sqlite3_bind_double(sqlite3_stmt*, int i, double iValue); int sqlite3_bind_null(sqlite3_stmt*, int i); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > | > | 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | ** The "in" and "out" parameters may point to the same buffer in order ** to decode a string in place. */ 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); /* ** 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 /* ** Below this point are the new sqlite3 APIs. At present these are ** implemented in terms of the sqlite2 API above. This is to get the TCL ** interface and other testing infrastructure in place for when |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | memcpy(pVar->z, zVal, bytes); } } return SQLITE_OK; } int sqlite3_bind_int64(sqlite3_stmt *p, int i, long long int iValue){ int rc; Vdbe *v = (Vdbe *)p; rc = vdbeUnbind(v, i); if( rc==SQLITE_OK ){ Mem *pVar = &v->apVar[i-1]; pVar->flags = MEM_Int; pVar->i = iValue; } return SQLITE_OK; } int sqlite3_bind_int32(sqlite3_stmt *p, int i, int iValue){ return sqlite3_bind_int64(p, i, (long long int)iValue); } int sqlite3_bind_double(sqlite3_stmt *p, int i, double iValue){ int rc; Vdbe *v = (Vdbe *)p; rc = vdbeUnbind(v, i); if( rc==SQLITE_OK ){ Mem *pVar = &v->apVar[i-1]; pVar->flags = MEM_Real; pVar->r = iValue; } return SQLITE_OK; } int sqlite3_bind_null(sqlite3_stmt* p, int i){ return vdbeUnbind((Vdbe *)p, i); } int sqlite3_bind_text( sqlite3_stmt *p, int i, const char *zData, int nData, int eCopy ){ int flags = MEM_Str|MEM_Utf8; if( zData ){ if( nData<0 ){ nData = strlen(zData)+1; flags |= MEM_Term; }else if( !zData[nData-1] ){ flags |= MEM_Term; } } return vdbeBindBlob((Vdbe *)p, i, zData, nData, eCopy, flags); } int sqlite3_bind_text16( sqlite3_stmt *p, int i, const void *zData, int nData, int eCopy ){ | > > > > > > > > > > > > > > > > > > | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | memcpy(pVar->z, zVal, bytes); } } 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; rc = vdbeUnbind(v, i); if( rc==SQLITE_OK ){ Mem *pVar = &v->apVar[i-1]; pVar->flags = MEM_Int; pVar->i = 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; rc = vdbeUnbind(v, i); if( rc==SQLITE_OK ){ Mem *pVar = &v->apVar[i-1]; pVar->flags = MEM_Real; pVar->r = 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, const char *zData, int nData, int eCopy ){ int flags = MEM_Str|MEM_Utf8; if( zData ){ if( nData<0 ){ nData = strlen(zData)+1; flags |= MEM_Term; }else if( !zData[nData-1] ){ flags |= MEM_Term; } } 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, const void *zData, int nData, int eCopy ){ |
︙ | ︙ | |||
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | } } } return vdbeBindBlob((Vdbe *)p, i, zData, nData, eCopy, flags); } int sqlite3_bind_blob( sqlite3_stmt *p, int i, const void *zData, int nData, int eCopy ){ | > > > | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | } } } 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, const void *zData, int nData, int eCopy ){ |
︙ | ︙ |