-C Refactoring\sof\sthe\svdbe\sMem\sfunctions\sand\sthe\sAPIs\sthat\sdeal\swith\sthem.\nThe\scode\swill\snot\scompile\sin\sits\scurrent\sstate.\s(CVS\s1465)
-D 2004-05-26T23:25:31
+C Break\sMem.flags\sinto\sMem.type\sand\sMem.enc.\s(CVS\s1466)
+D 2004-05-26T23:43:12
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
F src/vdbe.c 4419d3b7e4d56b0c1d973ebf4de40ee5045e612e
F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb
-F src/vdbeInt.h d7eda2403e11de5e0c581f91bd202cc952190a97
+F src/vdbeInt.h 8647afb4c3889c827a4c0aa310a54c5ec0ebc934
F src/vdbeapi.c 36d4c78bc765dc89cac07ff975b26256e0ac90fc
F src/vdbeaux.c 677317be4021eadce96365b16d9deeda9e565bef
F src/vdbemem.c c92c41c80c333b3cd405a08ebfd014d02a9f7b8c
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 36e031625995b2f7baf7654d771ca8fb764a0085
-R f8551815839ed9151ff9855a8a833baa
+P bba6684d502ba1ecd9614d2470ec94296e3c07c2
+R 3631e4c50022e315d656f5e4e18ecf0f
U drh
-Z af6c613d004b8ea284a0c6f10b3031e5
+Z 55bf782fc149a5ef1b23628e3441dfe2
struct Mem {
i64 i; /* Integer value */
int n; /* Number of characters in string value, including '\0' */
- int flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
+ u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
+ u8 type; /* One of MEM_Null, MEM_Str, etc. */
+ u8 enc; /* TEXT_Utf8, TEXT_Utf16le, or TEXT_Utf16be */
double r; /* Real value */
char *z; /* String or BLOB value */
char zShort[NBFS]; /* Space for short strings */
};
typedef struct Mem Mem;
-/* One or more of the following flags are set to indicate the valid
+/* One or more of the following flags are set to indicate the validOK
** representations of the value stored in the Mem struct.
**
** If the MEM_Null flag is set, then the value is an SQL NULL value.
** database (see below for exceptions). If the MEM_Term flag is also
** set, then the string is nul terminated. The MEM_Int and MEM_Real
** flags may coexist with the MEM_Str flag.
-**
+**
+** Multiple of these values can appear in Mem.flags. But only one
+** at a time can appear in Mem.type.
*/
#define MEM_Null 0x0001 /* Value is NULL */
#define MEM_Str 0x0002 /* Value is a string */
#define MEM_Real 0x0008 /* Value is a real number */
#define MEM_Blob 0x0010 /* Value is a BLOB */
-#define MEM_Term 0x0100 /* String rep is nul terminated */
-
-/* Values with type NULL or BLOB can have only one representation. But
-** values with a manifest type of REAL, INTEGER or STRING may have one
-** or more representation cached in the Mem struct at any one time. The
-** flags MEM_IntVal, MEM_RealVal and MEM_StrVal are true whenever the real,
-** integer or string representation stored in a Mem struct is valid.
-**
-** When MEM_StrVal is set, then MEM_Term may also be set. This indicates
-** that the string is terminated with a nul-terminator character.
-*/
-#define MEM_TypeInt 0x0020 /* Value type is an integer */
-#define MEM_TypeReal 0x0040 /* Value type is real */
-#define MEM_TypeStr 0x0080 /* Value type is string */
-
-
/* Whenever Mem contains a valid string or blob representation, one of
** the following flags must be set to determine the memory management
-** policy for Mem.z
-*/
-#define MEM_Dyn 0x0200 /* Need to call sqliteFree() on Mem.z */
-#define MEM_Static 0x0400 /* Mem.z points to a static string */
-#define MEM_Ephem 0x0800 /* Mem.z points to an ephemeral string */
-#define MEM_Short 0x1000 /* Mem.z points to Mem.zShort */
-
-/* Internally, all strings manipulated by the VDBE are encoded using the
-** native encoding for the main database. Therefore the following three
-** flags, which describe the text encoding of the string if the MEM_Str
-** flag is true, are not generally valid for Mem* objects handled by the
-** VDBE.
-**
-** When a user-defined function is called (see OP_Function), the Mem*
-** objects that store the argument values for the function call are
-** passed to the user-defined function routine cast to sqlite3_value*.
-** The user routine may then call sqlite3_value_text() or
-** sqlite3_value_text16() to request a UTF-8 or UTF-16 string. If the
-** string representation currently stored in Mem.z is not the requested
-** encoding, then a translation occurs. To keep track of things, the
-** MEM_Utf* flags are set correctly for the database encoding before a
-** user-routine is called, and kept up to date if any translations occur
-** thereafter.
-**
-** When sqlite3_step() returns SQLITE3_ROW, indicating that a row of data
-** is ready for processing by the caller, the data values are stored
-** internally as Mem* objects. Before sqlite3_step() returns, the MEM_Utf*
-** flags are set correctly for the database encoding. A translation may
-** take place if the user requests a non-native encoding via
-** sqlite3_column_text() or sqlite3_column_text16(). If this occurs, then
-** the MEM_Utf* flags are updated accordingly.
+** policy for Mem.z. The MEM_Term flag tells us whether or not the
+** string is \000 or \u0000 terminated
*/
-#define MEM_Utf8 0x2000 /* String uses UTF-8 encoding */
-#define MEM_Utf16be 0x4000 /* String uses UTF-16 big-endian */
-#define MEM_Utf16le 0x8000 /* String uses UTF-16 little-endian */
+#define MEM_Term 0x0020 /* String rep is nul terminated */
+#define MEM_Dyn 0x0040 /* Need to call sqliteFree() on Mem.z */
+#define MEM_Static 0x0080 /* Mem.z points to a static string */
+#define MEM_Ephem 0x0100 /* Mem.z points to an ephemeral string */
+#define MEM_Short 0x0200 /* Mem.z points to Mem.zShort */
/* The following MEM_ value appears only in AggElem.aMem.s.flag fields.
** It indicates that the corresponding AggElem.aMem.z points to a
** aggregate function context that needs to be finalized.
*/
-#define MEM_AggCtx 0x10000 /* Mem.z points to an agg function context */
+#define MEM_AggCtx 0x0400 /* Mem.z points to an agg function context */
/*
** The "context" argument for a installable function. A pointer to an