1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Avoid using the transient value in the UTF-16 collation needed callback. (CVS 2816)

FossilOrigin-Name: ab6241af29b2e9f5f094b83c13afebe44a8ad6bc
This commit is contained in:
drh
2005-12-14 22:51:16 +00:00
parent 268803a95b
commit 26abcb1eef
3 changed files with 13 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: callback.c,v 1.6 2005/12/14 20:11:30 drh Exp $
** $Id: callback.c,v 1.7 2005/12/14 22:51:17 drh Exp $
*/
#include "sqliteInt.h"
@@ -35,11 +35,13 @@ static void callCollNeeded(sqlite3 *db, const char *zName, int nName){
#ifndef SQLITE_OMIT_UTF16
if( db->xCollNeeded16 ){
char const *zExternal;
sqlite3_value *pTmp = sqlite3GetTransientValue(db);
sqlite3_value *pTmp = sqlite3ValueNew();
sqlite3ValueSetStr(pTmp, nName, zName, SQLITE_UTF8, SQLITE_STATIC);
zExternal = sqlite3ValueText(pTmp, SQLITE_UTF16NATIVE);
if( !zExternal ) return;
db->xCollNeeded16(db->pCollNeededArg, db, (int)db->enc, zExternal);
if( zExternal ){
db->xCollNeeded16(db->pCollNeededArg, db, (int)db->enc, zExternal);
}
sqlite3ValueFree(pTmp);
}
#endif
}