Add sqlite3_win32_set_directory8() and sqlite3_win32_set_directory16() functions.
FossilOrigin-Name: 22089ea2bbea93eb1da7f08344789a5455077169443e40025f053d2a117f1c08
This commit is contained in:
parent
8c2e6c5fe0
commit
07430a8caf
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C The\sSQLITE_ALLOW_SQLITE_MASTER_INDEX\scompile-time\soption\sallows\sa\sCREATE\sINDEX\nstatement\sagainst\sthe\ssqlite_master\stable.\s\sOnce\screated,\sthe\sindex\sworks,\sand\nis\susable\sby\slegacy\sinstances\sof\sSQLite.
|
||||
D 2018-05-01T18:39:31.984
|
||||
C Add\ssqlite3_win32_set_directory8()\sand\ssqlite3_win32_set_directory16()\sfunctions.
|
||||
D 2018-05-02T03:01:50.355
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 5ce9343cba9c189046f1afe6d2bcc1f68079439febc05267b98aec6ecc752439
|
||||
@ -478,7 +478,7 @@ F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c 2b53b0b8ddc580db096252c721729e5f5f2f355b4fc056f8f3fb328aeb3c9e8a
|
||||
F src/os_win.c a8f39484f3b9162250f510bcceb2826638c00847c9c271b770289f672ebe5372
|
||||
F src/os_win.c ac29c25cde4cfb4adacc59cdec4aa45698ca0e29164ea127859585ccd9faa354
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 1bb6a57fa0465296a4d6109a1a64610a0e7adde1f3acf3ef539a9d972908ce8f
|
||||
F src/pager.h c571b064df842ec8f2e90855dead9acf4cbe0d1b2c05afe0ef0d0145f7fd0388
|
||||
@ -495,7 +495,7 @@ F src/resolve.c 6415381a0e9d22c0e7cba33ca4a53f81474190862f5d4838190f5eb5b0b47bc9
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c daf07d8defce3311f9e69f1280a874d78bc1d16c305f6aa689640f7afa02842f
|
||||
F src/shell.c.in 54b902ab7d840f60ddfabc13124c85d4980342c88aff7679f2cc25f67c21ade7
|
||||
F src/sqlite.h.in d669de545f18f2f01362de02e309cd7f15185958c71bac8f53cd5438b46d2bea
|
||||
F src/sqlite.h.in 469aed42e75193b7f5d88d812befa961c04746869475f96fcf434c9f67079f66
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 83a3c4ce93d650bedfd1aa558cb85a516bd6d094445ee989740827d0d944368d
|
||||
F src/sqliteInt.h 8ac0138eae10337b745b03dad0124fd63ae911c0503e795729503e7fc6234d57
|
||||
@ -1727,7 +1727,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 08665a9e2e50a0a1e62529884cf65f8090debe89a306a3904b53268729ab5ad5
|
||||
R 65d0d1f1b897970475b65cf976ea92c3
|
||||
U drh
|
||||
Z fbedda4f45c8a34310211b3e1037138b
|
||||
P 853f3163597b9946c0cbeb808ea6fd33a0cf48ae6b8f4459c4165db377f33a9e
|
||||
R 7d36afb40ceca70451bc2c1787c2fa2c
|
||||
U mistachkin
|
||||
Z c462fe799d29c04b823cce6378b0f174
|
||||
|
@ -1 +1 @@
|
||||
853f3163597b9946c0cbeb808ea6fd33a0cf48ae6b8f4459c4165db377f33a9e
|
||||
22089ea2bbea93eb1da7f08344789a5455077169443e40025f053d2a117f1c08
|
55
src/os_win.c
55
src/os_win.c
@ -1911,15 +1911,12 @@ char *sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){
|
||||
}
|
||||
|
||||
/*
|
||||
** This function sets the data directory or the temporary directory based on
|
||||
** the provided arguments. The type argument must be 1 in order to set the
|
||||
** data directory or 2 in order to set the temporary directory. The zValue
|
||||
** argument is the name of the directory to use. The return value will be
|
||||
** SQLITE_OK if successful.
|
||||
** This function is the same as sqlite3_win32_set_directory (below); however,
|
||||
** it accepts a UTF-8 string.
|
||||
*/
|
||||
int sqlite3_win32_set_directory(
|
||||
int sqlite3_win32_set_directory8(
|
||||
unsigned long type, /* Identifier for directory being set or reset */
|
||||
void *zValue /* New value for directory being set or reset */
|
||||
const char *zValue /* New value for directory being set or reset */
|
||||
){
|
||||
char **ppDirectory = 0;
|
||||
#ifndef SQLITE_OMIT_AUTOINIT
|
||||
@ -1936,21 +1933,53 @@ int sqlite3_win32_set_directory(
|
||||
);
|
||||
assert( !ppDirectory || sqlite3MemdebugHasType(*ppDirectory, MEMTYPE_HEAP) );
|
||||
if( ppDirectory ){
|
||||
LPCWSTR zStrValue = zValue;
|
||||
char *zValueUtf8 = 0;
|
||||
if( zStrValue && zStrValue[0] ){
|
||||
zValueUtf8 = winUnicodeToUtf8(zStrValue);
|
||||
if ( zValueUtf8==0 ){
|
||||
char *zCopy = 0;
|
||||
if( zValue && zValue[0] ){
|
||||
zCopy = sqlite3_mprintf("%s", zValue);
|
||||
if ( zCopy==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
}
|
||||
}
|
||||
sqlite3_free(*ppDirectory);
|
||||
*ppDirectory = zValueUtf8;
|
||||
*ppDirectory = zCopy;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
** This function is the same as sqlite3_win32_set_directory (below); however,
|
||||
** it accepts a UTF-16 string.
|
||||
*/
|
||||
int sqlite3_win32_set_directory16(
|
||||
unsigned long type, /* Identifier for directory being set or reset */
|
||||
const void *zValue /* New value for directory being set or reset */
|
||||
){
|
||||
int rc;
|
||||
char *zUtf8 = 0;
|
||||
if( zValue ){
|
||||
zUtf8 = sqlite3_win32_unicode_to_utf8(zValue);
|
||||
if( zUtf8==0 ) return SQLITE_NOMEM_BKPT;
|
||||
}
|
||||
rc = sqlite3_win32_set_directory8(type, zUtf8);
|
||||
if( zUtf8 ) sqlite3_free(zUtf8);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** This function sets the data directory or the temporary directory based on
|
||||
** the provided arguments. The type argument must be 1 in order to set the
|
||||
** data directory or 2 in order to set the temporary directory. The zValue
|
||||
** argument is the name of the directory to use. The return value will be
|
||||
** SQLITE_OK if successful.
|
||||
*/
|
||||
int sqlite3_win32_set_directory(
|
||||
unsigned long type, /* Identifier for directory being set or reset */
|
||||
void *zValue /* New value for directory being set or reset */
|
||||
){
|
||||
return sqlite3_win32_set_directory16(type, zValue);
|
||||
}
|
||||
|
||||
/*
|
||||
** The return value of winGetLastErrorMsg
|
||||
** is zero if the error message fits in the buffer, or non-zero
|
||||
|
@ -5539,12 +5539,17 @@ SQLITE_EXTERN char *sqlite3_data_directory;
|
||||
** or [SQLITE_NOMEM] if memory could not be allocated. The value of the
|
||||
** [sqlite3_data_directory] variable is intended to act as a replacement for
|
||||
** the current directory on the sub-platforms of Win32 where that concept is
|
||||
** not present, e.g. WinRT and UWP.
|
||||
** not present, e.g. WinRT and UWP. The [sqlite3_win32_set_directory8] and
|
||||
** [sqlite3_win32_set_directory16] interfaces behave exactly the same as the
|
||||
** sqlite3_win32_set_directory interface except the string parameter must be
|
||||
** UTF-8 or UTF-16, respectively.
|
||||
*/
|
||||
int sqlite3_win32_set_directory(
|
||||
unsigned long type, /* Identifier for directory being set or reset */
|
||||
void *zValue /* New value for directory being set or reset */
|
||||
);
|
||||
int sqlite3_win32_set_directory8(unsigned long type, const char *zValue);
|
||||
int sqlite3_win32_set_directory16(unsigned long type, const void *zValue);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Win32 Directory Types
|
||||
|
Loading…
Reference in New Issue
Block a user