diff options
author | danielk1977 <danielk1977@noemail.net> | 2004-05-22 08:09:11 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2004-05-22 08:09:11 +0000 |
commit | 172bc3938a53b60e73dc75424a67b0f095a53d56 (patch) | |
tree | 70182bb0fec58113fa1071e4faa70da21372bbad /src | |
parent | 18f4189055e6def9bab0c080ffec154b237e32aa (diff) | |
download | sqlite-172bc3938a53b60e73dc75424a67b0f095a53d56.tar.gz sqlite-172bc3938a53b60e73dc75424a67b0f095a53d56.zip |
Store the text encoding in the database (as meta value 4). (CVS 1435)
FossilOrigin-Name: 7f00ca5801889724c0e768961aa15f5ce0b8e7b5
Diffstat (limited to 'src')
-rw-r--r-- | src/build.c | 4 | ||||
-rw-r--r-- | src/main.c | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/build.c b/src/build.c index fc0b70a53..679d019e9 100644 --- a/src/build.c +++ b/src/build.c @@ -23,7 +23,7 @@ ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.192 2004/05/21 13:39:50 drh Exp $ +** $Id: build.c,v 1.193 2004/05/22 08:09:11 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -543,6 +543,8 @@ void sqlite3StartTable( if( !isTemp ){ sqlite3VdbeAddOp(v, OP_Integer, db->file_format, 0); sqlite3VdbeAddOp(v, OP_SetCookie, 0, 1); + sqlite3VdbeAddOp(v, OP_Integer, db->enc, 0); + sqlite3VdbeAddOp(v, OP_SetCookie, 0, 4); } sqlite3OpenMasterTable(v, isTemp); sqlite3VdbeAddOp(v, OP_NewRecno, 0, 0); diff --git a/src/main.c b/src/main.c index bbbb2135f..0ffe00409 100644 --- a/src/main.c +++ b/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.182 2004/05/22 03:05:34 danielk1977 Exp $ +** $Id: main.c,v 1.183 2004/05/22 08:09:40 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -217,12 +217,15 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){ ** meta[1] File format of schema layer. ** meta[2] Size of the page cache. ** meta[3] Synchronous setting. 1:off, 2:normal, 3:full - ** meta[4] + ** meta[4] Db text encoding. 1:UTF-8 2:UTF-16 LE 3:UTF-16 BE ** meta[5] Pragma temp_store value. See comments on BtreeFactory ** meta[6] ** meta[7] ** meta[8] ** meta[9] + ** + ** Note: The hash defined TEXT_Utf* symbols in sqliteInt.h correspond to + ** the possible values of meta[4]. */ if( rc==SQLITE_OK ){ int i; @@ -241,6 +244,13 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){ if( iDb==0 ){ db->next_cookie = meta[0]; db->file_format = meta[1]; + if( meta[4] ){ + /* If meta[4] is still zero, then we are opening a previously empty + ** file. Leave db->enc to the default value set by the sqlite3_open() + ** call in this case. + */ + db->enc = (u8)meta[4]; + } size = meta[2]; if( size==0 ){ size = MAX_PAGES; } db->cache_size = size; |