Add the sqlite3_value_*() access functions. (CVS 1447)
FossilOrigin-Name: 4bf925fcfccb18e66be031f8a234f370d581e9ea
This commit is contained in:
parent
bd7e46086e
commit
0ffba6b269
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sfor\sretrieving\sUTF-16\slittle-endian\stext\sfrom\sa\sbig-endian\sdatabase.\s(CVS\s1446)
|
||||
D 2004-05-24T07:34:48
|
||||
C Add\sthe\ssqlite3_value_*()\saccess\sfunctions.\s(CVS\s1447)
|
||||
D 2004-05-24T09:10:11
|
||||
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -54,7 +54,7 @@ F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
|
||||
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
||||
F src/select.c 7d77a8bed7eeac23216d42fc1be006fb4352fcdc
|
||||
F src/shell.c ed4d237b3e52a0a42512bfcc53530e46de20c28f
|
||||
F src/sqlite.h.in 69393dbaa5b11853685ae656d1bef6a98b808bbb
|
||||
F src/sqlite.h.in 73a20794a2f65c7b07e770c6b7adac10c2fb0246
|
||||
F src/sqliteInt.h e1191166ac9055d6c99c97771d3f35212ef2cff2
|
||||
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
|
||||
F src/tclsqlite.c f241854328ee2b06006efded270d84799159f760
|
||||
@ -69,7 +69,7 @@ F src/update.c 1a5e9182596f3ea8c7a141e308a3d2a7e5689fee
|
||||
F src/utf.c 441c5918ee3777cd8e9611cbb810312ed314737d
|
||||
F src/util.c 4c0adcbc9ce6678dd046931253e45d623c6d279f
|
||||
F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
|
||||
F src/vdbe.c 58ba70a2216d720a25fe5fc8dbea9e8102f74cd3
|
||||
F src/vdbe.c 8030d32775e2c6bb2bc7d50408926c7c6ab8994a
|
||||
F src/vdbe.h 391d5642a83af686f35c228fcd36cb4456d68f44
|
||||
F src/vdbeInt.h 6c2444a60fc030b275dc0cff407cdaa79d84ce86
|
||||
F src/vdbeaux.c 7f0c4ad22d5e61465d509467e2535293b468373a
|
||||
@ -202,7 +202,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P b7155db2b13aa3ca5f6c68e948d9e8740ebcac47
|
||||
R 126af0b27186d92fd9082fbe410f6f8b
|
||||
P 8104baf23dd28fc982cf260e3e8c90f0c582f602
|
||||
R de171e08cb8ad22dd0f7f4b92735f6a5
|
||||
U danielk1977
|
||||
Z b2514b88eb1049ff9f7f80c33c5b5ddd
|
||||
Z 3878ff3f2482ddd072015da408058403
|
||||
|
@ -1 +1 @@
|
||||
8104baf23dd28fc982cf260e3e8c90f0c582f602
|
||||
4bf925fcfccb18e66be031f8a234f370d581e9ea
|
@ -12,7 +12,7 @@
|
||||
** This header file defines the interface that the SQLite library
|
||||
** presents to client programs.
|
||||
**
|
||||
** @(#) $Id: sqlite.h.in,v 1.71 2004/05/23 13:30:58 danielk1977 Exp $
|
||||
** @(#) $Id: sqlite.h.in,v 1.72 2004/05/24 09:10:11 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef _SQLITE_H_
|
||||
#define _SQLITE_H_
|
||||
@ -1342,12 +1342,75 @@ double sqlite3_column_float(sqlite3_stmt*,int);
|
||||
|
||||
typedef struct Mem sqlite3_value;
|
||||
|
||||
/*
|
||||
** Return the type of the sqlite3_value* passed as the first argument.
|
||||
** The type is one of SQLITE3_NULL, SQLITE3_INTEGER, SQLITE3_FLOAT,
|
||||
** SQLITE3_TEXT or SQLITE3_BLOB.
|
||||
*/
|
||||
int sqlite3_value_type(sqlite3_value*);
|
||||
int sqlite3_value_bytes(sqlite3_value*);
|
||||
int sqlite3_value_bytes16(sqlite3_value*);
|
||||
|
||||
/*
|
||||
** Return the value of the sqlite3_value* passed as the first argument.
|
||||
** The value returned depends on the type of the value, as returned by
|
||||
** sqlite3_value_type():
|
||||
**
|
||||
** SQLITE3_NULL A Null pointer.
|
||||
** SQLITE3_INTEGER String representation of the integer, UTF-8 encoded.
|
||||
** SQLITE3_FLOAT String representation of the real, UTF-8 encoded.
|
||||
** SQLITE3_TEXT The string UTF-8 encoded.
|
||||
** SQLITE3_BLOB A pointer to the blob of data.
|
||||
*/
|
||||
const unsigned char *sqlite3_value_data(sqlite3_value*);
|
||||
|
||||
/*
|
||||
** Return the number of bytes in the string or blob returned by a call
|
||||
** to sqlite3_value_data() on the same sqlite3_value* object.
|
||||
*/
|
||||
int sqlite3_value_bytes(sqlite3_value*);
|
||||
|
||||
/*
|
||||
** Return the value of the sqlite3_value* passed as the first argument.
|
||||
** The value returned depends on the type of the value, as returned by
|
||||
** sqlite3_value_type():
|
||||
**
|
||||
** SQLITE3_NULL A Null pointer.
|
||||
** SQLITE3_INTEGER String representation of the integer, UTF-16 encoded.
|
||||
** SQLITE3_FLOAT String representation of the real, UTF-16 encoded.
|
||||
** SQLITE3_TEXT The string UTF-16 encoded.
|
||||
** SQLITE3_BLOB A pointer to the blob of data.
|
||||
*/
|
||||
const void *sqlite3_value_data16(sqlite3_value*);
|
||||
|
||||
/*
|
||||
** Return the number of bytes in the string or blob returned by a call
|
||||
** to sqlite3_value_data16() on the same sqlite3_value* object.
|
||||
*/
|
||||
int sqlite3_value_bytes16(sqlite3_value*);
|
||||
|
||||
/*
|
||||
** Return the value of the sqlite3_value* passed as the first argument.
|
||||
** The value returned depends on the type of the value, as returned by
|
||||
** sqlite3_value_type():
|
||||
**
|
||||
** SQLITE3_NULL 0
|
||||
** SQLITE3_INTEGER The integer value.
|
||||
** SQLITE3_FLOAT The integer component of the real (2^63 if too large)
|
||||
** SQLITE3_TEXT Integer conversion of string, or 0
|
||||
** SQLITE3_BLOB 0
|
||||
*/
|
||||
long long int sqlite3_value_int(sqlite3_value*);
|
||||
|
||||
/*
|
||||
** Return the value of the sqlite3_value* passed as the first argument.
|
||||
** The value returned depends on the type of the value, as returned by
|
||||
** sqlite3_value_type():
|
||||
**
|
||||
** SQLITE3_NULL 0.0
|
||||
** SQLITE3_INTEGER The value of the integer. Some rounding may occur.
|
||||
** SQLITE3_FLOAT The value of the float.
|
||||
** SQLITE3_TEXT Real number conversion of string, or 0.0
|
||||
** SQLITE3_BLOB 0.0
|
||||
*/
|
||||
double sqlite3_value_float(sqlite3_value*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
74
src/vdbe.c
74
src/vdbe.c
@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.323 2004/05/24 07:34:48 danielk1977 Exp $
|
||||
** $Id: vdbe.c,v 1.324 2004/05/24 09:10:11 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -630,6 +630,48 @@ const void *sqlite3_value_data16(sqlite3_value* pVal){
|
||||
return (const void *)(pVal->z);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the number of bytes of data that will be returned by the
|
||||
** equivalent sqlite3_value_data() call.
|
||||
*/
|
||||
int sqlite3_value_bytes(sqlite3_value *pVal){
|
||||
if( sqlite3_value_data(pVal) ){
|
||||
return ((Mem *)pVal)->n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the number of bytes of data that will be returned by the
|
||||
** equivalent sqlite3_value_data16() call.
|
||||
*/
|
||||
int sqlite3_value_bytes(sqlite3_value *pVal){
|
||||
if( sqlite3_value_data16(pVal) ){
|
||||
return ((Mem *)pVal)->n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the value of the sqlite_value* argument coerced to a 64-bit
|
||||
** integer.
|
||||
*/
|
||||
long long int sqlite3_value_int(sqlite3_value *pVal){
|
||||
Mem *pMem = (Mem *)pVal;
|
||||
Integerify(pMem, flagsToEnc(pMem->flags));
|
||||
return pVal->i;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the value of the sqlite_value* argument coerced to a 64-bit
|
||||
** IEEE float.
|
||||
*/
|
||||
double sqlite3_value_float(sqlite3_value*){
|
||||
pVal = &pVm->pTos[(1-vals)+i];
|
||||
Realify(pVal, flagsToEnc(pMem->flags));
|
||||
return pVal->r;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the number of bytes of data that will be returned by the
|
||||
** equivalent sqlite3_column_data() call.
|
||||
@ -674,8 +716,7 @@ long long int sqlite3_column_int(sqlite3_stmt *pStmt, int i){
|
||||
}
|
||||
|
||||
pVal = &pVm->pTos[(1-vals)+i];
|
||||
Integerify(pVal, pVm->db->enc);
|
||||
return pVal->i;
|
||||
return sqlite3_value_int(pVal);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -693,9 +734,7 @@ double sqlite3_column_float(sqlite3_stmt *pStmt, int i){
|
||||
return 0;
|
||||
}
|
||||
|
||||
pVal = &pVm->pTos[(1-vals)+i];
|
||||
Realify(pVal, pVm->db->enc);
|
||||
return pVal->r;
|
||||
return sqlite3_value_float(pVal);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -713,6 +752,29 @@ const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
|
||||
return p->azColName[N];
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the type of the value stored in the sqlite_value* object.
|
||||
*/
|
||||
int sqlite3_value_type(sqlite3_value* pVal){
|
||||
int f = ((Mem *)pVal)->flags;
|
||||
if( f&MEM_Null ){
|
||||
return SQLITE3_NULL;
|
||||
}
|
||||
if( f&MEM_Int ){
|
||||
return SQLITE3_INTEGER;
|
||||
}
|
||||
if( f&MEM_Real ){
|
||||
return SQLITE3_FLOAT;
|
||||
}
|
||||
if( f&MEM_Str ){
|
||||
return SQLITE3_TEXT;
|
||||
}
|
||||
if( f&MEM_Blob ){
|
||||
return SQLITE3_BLOB;
|
||||
}
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the type of the 'i'th column of the current row of the currently
|
||||
** executing statement pStmt.
|
||||
|
Loading…
x
Reference in New Issue
Block a user