Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix metadata UTF-16 string length calculations on Linux. Fix for forum post [eeaefb84ec]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6cda6ab5ab4bcee586b1aca5dbb3c7c3 |
User & Date: | mistachkin 2021-10-14 20:48:09 |
Context
2021-10-31
| ||
19:24 | Update Eagle in externals to the beta 49 release. check-in: 3b9e2fdc06 user: mistachkin tags: trunk | |
2021-10-14
| ||
20:48 | Fix metadata UTF-16 string length calculations on Linux. Fix for forum post [eeaefb84ec]. check-in: 6cda6ab5ab user: mistachkin tags: trunk | |
02:36 | Update SQLite core library to the latest trunk code. check-in: a5ec29acc4 user: mistachkin tags: trunk | |
Changes
Changes to Doc/Extra/Provider/version.html.
︙ | ︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <div id="mainSection"> <div id="mainBody"> <h1 class="heading">Version History</h1> <p><b>1.0.115.5 - October XX, 2021 <font color="red">(release scheduled)</font></b></p> <ul> <li>Updated to <a href="https://www.sqlite.org/src/info/02656760406add06">SQLite trunk</a>.</li> <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/08a52f61fc">[08a52f61fc]</a>.</li> </ul> <p><b>1.0.115.0 - August 25, 2021</b></p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_36_0.html">SQLite 3.36.0</a>.</li> </ul> <p><b>1.0.114.0 - May 22, 2021</b></p> <ul> | > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <div id="mainSection"> <div id="mainBody"> <h1 class="heading">Version History</h1> <p><b>1.0.115.5 - October XX, 2021 <font color="red">(release scheduled)</font></b></p> <ul> <li>Updated to <a href="https://www.sqlite.org/src/info/02656760406add06">SQLite trunk</a>.</li> <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/08a52f61fc">[08a52f61fc]</a>.</li> <li>Fix metadata UTF-16 string length calculations on Linux. Fix for forum post <a href="https://www.sqlite.org/forum/forumpost/eeaefb84ec">[eeaefb84ec]</a>.</li> </ul> <p><b>1.0.115.0 - August 25, 2021</b></p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_36_0.html">SQLite 3.36.0</a>.</li> </ul> <p><b>1.0.114.0 - May 22, 2021</b></p> <ul> |
︙ | ︙ |
Changes to SQLite.Interop/src/generic/interop.c.
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #if SQLITE_OS_WIN #if SQLITE_OS_WINCE #define VOLATILE #else #define VOLATILE volatile #endif #else typedef long LONG; #define InterlockedIncrement(p) (*((LONG*)(p)))++ #define InterlockedDecrement(p) (*((LONG*)(p)))-- #endif #if !SQLITE_OS_WIN #include <wchar.h> | > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #if SQLITE_OS_WIN #if SQLITE_OS_WINCE #define VOLATILE #else #define VOLATILE volatile #endif #else #define VOLATILE volatile typedef long LONG; #define InterlockedIncrement(p) (*((LONG*)(p)))++ #define InterlockedDecrement(p) (*((LONG*)(p)))-- #endif #if !SQLITE_OS_WIN #include <wchar.h> |
︙ | ︙ | |||
186 187 188 189 190 191 192 193 194 195 196 197 198 199 | #ifdef SQLITE_VERSION_NUMBER "VERSION_NUMBER=" CTIMEOPT_VAL(SQLITE_VERSION_NUMBER), #endif #ifdef INTEROP_VIRTUAL_TABLE "VIRTUAL_TABLE", #endif }; /* ** Given the name of a compile-time option, return true if that option ** was used and false if not. ** ** The name can optionally begin with "SQLITE_" or "INTEROP_" but those ** prefixes are not required for a match. | > > > > > > > > > > > > > > > > > > > > > > > > > > | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | #ifdef SQLITE_VERSION_NUMBER "VERSION_NUMBER=" CTIMEOPT_VAL(SQLITE_VERSION_NUMBER), #endif #ifdef INTEROP_VIRTUAL_TABLE "VIRTUAL_TABLE", #endif }; /* ** Returns the number of 16-bit code points present in the specified ** string pointer, stopping when a zero terminator is found. If the ** string pointer is NULL, the return value is undefined. */ size_t u16_str_len(const u16 *str){ size_t len = 0; if( str!=NULL ){ while( (*str)!=0 ){ str++; len++; } } return len; } /* ** Returns the number of code points present in the specified string ** pointer, stopping when a zero terminator is found. If the string ** pointer is NULL, the return value is undefined. */ size_t utf16_str_len(const void *str){ assert( sizeof(u16)==2 ); #if SQLITE_OS_WIN assert( sizeof(wchar_t)==sizeof(u16) ); return wcslen((wchar_t *)str); #else return u16_str_len((u16 *)str); #endif } /* ** Given the name of a compile-time option, return true if that option ** was used and false if not. ** ** The name can optionally begin with "SQLITE_" or "INTEROP_" but those ** prefixes are not required for a match. |
︙ | ︙ | |||
564 565 566 567 568 569 570 | int n; #if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_PREPARE16) sqlite3InteropDebug("[%d] sqlite3_prepare_interop(): calling sqlite3_prepare16(%p, \"%s\", %d, %p)...\n", GETPID(), db, sql, nchars, ppstmt); #endif #if SQLITE_VERSION_NUMBER >= 3003009 | | | | | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | int n; #if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_PREPARE16) sqlite3InteropDebug("[%d] sqlite3_prepare_interop(): calling sqlite3_prepare16(%p, \"%s\", %d, %p)...\n", GETPID(), db, sql, nchars, ppstmt); #endif #if SQLITE_VERSION_NUMBER >= 3003009 n = sqlite3_prepare16_v2(db, sql, nchars * sizeof(u16), ppstmt, pztail); #else n = sqlite3_prepare16(db, sql, nchars * sizeof(u16), ppstmt, pztail); #endif #if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_PREPARE16) sqlite3InteropDebug("[%d] sqlite3_prepare_interop(): sqlite3_prepare16(%p, \"%s\", %d, %p) returned %d.\n", GETPID(), db, sql, nchars, ppstmt, n); #endif if (plen) *plen = (pztail && *pztail) ? utf16_str_len(*pztail) * sizeof(u16) : 0; return n; } #if defined(INTEROP_VIRTUAL_TABLE) && SQLITE_VERSION_NUMBER >= 3004001 #ifdef _WIN32 __declspec(dllexport) |
︙ | ︙ | |||
678 679 680 681 682 683 684 | if (plen) *plen = pval ? strlen(pval) : 0; return pval; } SQLITE_API const void * WINAPI sqlite3_column_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const void *pval = sqlite3_column_name16(stmt, iCol); | | | | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | if (plen) *plen = pval ? strlen(pval) : 0; return pval; } SQLITE_API const void * WINAPI sqlite3_column_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const void *pval = sqlite3_column_name16(stmt, iCol); if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0; return pval; } SQLITE_API const char * WINAPI sqlite3_column_decltype_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const char *pval = sqlite3_column_decltype(stmt, iCol); if (plen) *plen = pval ? strlen(pval) : 0; return pval; } SQLITE_API const void * WINAPI sqlite3_column_decltype16_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const void *pval = sqlite3_column_decltype16(stmt, iCol); if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0; return pval; } SQLITE_API void WINAPI sqlite3_column_double_interop(sqlite3_stmt *stmt, int iCol, double *val) { if (!val) return; *val = sqlite3_column_double(stmt,iCol); |
︙ | ︙ | |||
974 975 976 977 978 979 980 | if (plen) *plen = pval ? strlen(pval) : 0; return pval; } SQLITE_API const void * WINAPI sqlite3_column_database_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const void *pval = sqlite3_column_database_name16(stmt, iCol); | | | | | 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 | if (plen) *plen = pval ? strlen(pval) : 0; return pval; } SQLITE_API const void * WINAPI sqlite3_column_database_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const void *pval = sqlite3_column_database_name16(stmt, iCol); if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0; return pval; } SQLITE_API const char * WINAPI sqlite3_column_table_name_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const char *pval = sqlite3_column_table_name(stmt, iCol); if (plen) *plen = pval ? strlen(pval) : 0; return pval; } SQLITE_API const void * WINAPI sqlite3_column_table_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const void *pval = sqlite3_column_table_name16(stmt, iCol); if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0; return pval; } SQLITE_API const char * WINAPI sqlite3_column_origin_name_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const char *pval = sqlite3_column_origin_name(stmt, iCol); if (plen) *plen = pval ? strlen(pval) : 0; return pval; } SQLITE_API const void * WINAPI sqlite3_column_origin_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen) { const void *pval = sqlite3_column_origin_name16(stmt, iCol); if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0; return pval; } SQLITE_API int WINAPI sqlite3_table_column_metadata_interop(sqlite3 *db, const char *zDbName, const char *zTableName, const char *zColumnName, char const **pzDataType, char const **pzCollSeq, int *pNotNull, int *pPrimaryKey, int *pAutoinc, int *pdtLen, int *pcsLen) { int n; |
︙ | ︙ |
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
︙ | ︙ | |||
326 327 328 329 330 331 332 333 334 335 336 337 338 339 | throw new SQLiteException(SQLiteErrorCode.NoMem, GetLastError()); #if !SQLITE_STANDARD return UTF16ToString(p, len); #else return UTF16ToString(p, -1); #endif } internal override string GetText(SQLiteStatement stmt, int index) { #if !SQLITE_STANDARD int len = 0; return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16_interop(stmt._sqlite_stmt, index, ref len), len); #else | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | throw new SQLiteException(SQLiteErrorCode.NoMem, GetLastError()); #if !SQLITE_STANDARD return UTF16ToString(p, len); #else return UTF16ToString(p, -1); #endif } internal override string ColumnType(SQLiteStatement stmt, int index, ref TypeAffinity nAffinity) { int len; #if !SQLITE_STANDARD len = 0; IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype16_interop(stmt._sqlite_stmt, index, ref len); #else len = -1; IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype16(stmt._sqlite_stmt, index); #endif nAffinity = ColumnAffinity(stmt, index); if ((p != IntPtr.Zero) && ((len > 0) || (len == -1))) { string declType = UTF16ToString(p, len); if (!String.IsNullOrEmpty(declType)) return declType; } string[] ar = stmt.TypeDefinitions; if (ar != null) { if (index < ar.Length && ar[index] != null) return ar[index]; } return String.Empty; } internal override string GetText(SQLiteStatement stmt, int index) { #if !SQLITE_STANDARD int len = 0; return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16_interop(stmt._sqlite_stmt, index, ref len), len); #else |
︙ | ︙ |
Added Tests/pst-eeaefb84ec.eagle.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | ############################################################################### # # pst-eeaefb84ec.eagle -- # # Written by Joe Mistachkin. # Released to the public domain, use at your own risk! # ############################################################################### package require Eagle package require Eagle.Library package require Eagle.Test runTestPrologue ############################################################################### package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### set character(1) \U1F5FD; # NOTE: This is little-endian. set character(2) \U1F409; # NOTE: This is little-endian. ############################################################################### runTest {test pst-eeaefb84ec-1.1 {UTF-16 string lengths} -setup { set fileName pst-eeaefb84ec-1.1.db setupDb $fileName "" "" "" "" UseUTF16Encoding=True } -body { sql execute $db [appendArgs \ "CREATE TABLE t1(x TEXT, \"" $character(1) "\" \"" \ $character(2) "\");"] sql execute $db [appendArgs \ "INSERT INTO t1 (x, \"" $character(1) "\") VALUES(?, ?);"] \ [list param1 String $character(1)] [list param2 String x] set dataReader [sql execute -execute reader -format datareader \ -alias $db [appendArgs "SELECT x, \"" $character(1) "\" FROM t1;"]] set result [list] lappend result [sql execute -execute scalar $db "PRAGMA encoding;"] while {[$dataReader Read]} { lappend result \ [list [$dataReader GetName 0] [$dataReader GetOrdinal x] \ [$dataReader GetDataTypeName 0] [$dataReader GetDatabaseName 0] \ [$dataReader GetTableName 0] [$dataReader GetOriginalName 0] \ [$dataReader Item x]] \ [list [$dataReader GetName 1] [$dataReader GetOrdinal $character(1)] \ [$dataReader GetDataTypeName 1] [$dataReader GetDatabaseName 1] \ [$dataReader GetTableName 1] [$dataReader GetOriginalName 1] \ [$dataReader Item $character(1)]] } set result } -cleanup { unset -nocomplain dataReader cleanupDb $fileName unset -nocomplain result db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite} -result [list UTF-16le [list x 0 TEXT main t1 x \ $character(1)] [list $character(1) 1 $character(2) main t1 $character(1) x]]} ############################################################################### unset -nocomplain character ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to readme.htm.
︙ | ︙ | |||
209 210 211 212 213 214 215 216 217 218 219 220 221 222 | <p> <b>1.0.115.5 - October XX, 2021 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="https://www.sqlite.org/src/info/02656760406add06">SQLite trunk</a>.</li> <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post [08a52f61fc].</li> </ul> <p> <b>1.0.115.0 - August 25, 2021</b> </p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_36_0.html">SQLite 3.36.0</a>.</li> </ul> | > | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | <p> <b>1.0.115.5 - October XX, 2021 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="https://www.sqlite.org/src/info/02656760406add06">SQLite trunk</a>.</li> <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post [08a52f61fc].</li> <li>Fix metadata UTF-16 string length calculations on Linux. Fix for forum post [eeaefb84ec].</li> </ul> <p> <b>1.0.115.0 - August 25, 2021</b> </p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_36_0.html">SQLite 3.36.0</a>.</li> </ul> |
︙ | ︙ |
Changes to www/news.wiki.
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | <p> <b>1.0.115.5 - October XX, 2021 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to [https://www.sqlite.org/src/info/02656760406add06|SQLite trunk].</li> <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/08a52f61fc|08a52f61fc].</li> </ul> <p> <b>1.0.115.0 - August 25, 2021</b> </p> <ul> <li>Updated to [https://www.sqlite.org/releaselog/3_36_0.html|SQLite 3.36.0].</li> </ul> | > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | <p> <b>1.0.115.5 - October XX, 2021 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to [https://www.sqlite.org/src/info/02656760406add06|SQLite trunk].</li> <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/08a52f61fc|08a52f61fc].</li> <li>Fix metadata UTF-16 string length calculations on Linux. Fix for forum post [https://www.sqlite.org/forum/forumpost/eeaefb84ec|eeaefb84ec].</li> </ul> <p> <b>1.0.115.0 - August 25, 2021</b> </p> <ul> <li>Updated to [https://www.sqlite.org/releaselog/3_36_0.html|SQLite 3.36.0].</li> </ul> |
︙ | ︙ |