diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2005-08-28 16:53:27 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2005-08-28 16:53:27 +0000 |
| commit | c6aae12cc16e79cbeb51032f5b2822d29410c142 (patch) | |
| tree | 8d91708ece9721666e4db5dca50cd74f9fba48f9 /ext/pdo_sqlite/sqlite/src/vdbemem.c | |
| parent | 3a21310f37054961066eec5752775c173d1dc1d7 (diff) | |
| download | php-git-c6aae12cc16e79cbeb51032f5b2822d29410c142.tar.gz | |
Upgraded bundled SQLite library for PDO:SQLite to 3.2.5 (step 1)
Diffstat (limited to 'ext/pdo_sqlite/sqlite/src/vdbemem.c')
| -rw-r--r-- | ext/pdo_sqlite/sqlite/src/vdbemem.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/pdo_sqlite/sqlite/src/vdbemem.c b/ext/pdo_sqlite/sqlite/src/vdbemem.c index f08671f249..416beb6c78 100644 --- a/ext/pdo_sqlite/sqlite/src/vdbemem.c +++ b/ext/pdo_sqlite/sqlite/src/vdbemem.c @@ -174,7 +174,7 @@ int sqlite3VdbeMemStringify(Mem *pMem, int enc){ ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16. */ if( fg & MEM_Real ){ - sqlite3_snprintf(NBFS, z, "%.15g", pMem->r); + sqlite3_snprintf(NBFS, z, "%!.15g", pMem->r); }else{ assert( fg & MEM_Int ); sqlite3_snprintf(NBFS, z, "%lld", pMem->i); @@ -256,12 +256,14 @@ double sqlite3VdbeRealValue(Mem *pMem){ }else if( pMem->flags & MEM_Int ){ return (double)pMem->i; }else if( pMem->flags & (MEM_Str|MEM_Blob) ){ + double val = 0.0; if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8) || sqlite3VdbeMemNulTerminate(pMem) ){ return SQLITE_NOMEM; } assert( pMem->z ); - return sqlite3AtoF(pMem->z, 0); + sqlite3AtoF(pMem->z, &val); + return val; }else{ return 0.0; } @@ -406,6 +408,7 @@ int sqlite3VdbeMemSetStr( switch( enc ){ case 0: pMem->flags |= MEM_Blob; + pMem->enc = SQLITE_UTF8; break; case SQLITE_UTF8: @@ -666,9 +669,9 @@ void sqlite3VdbeMemSanity(Mem *pMem, u8 db_enc){ /* MEM_Null excludes all other types */ assert( (pMem->flags&(MEM_Str|MEM_Int|MEM_Real|MEM_Blob))==0 || (pMem->flags&MEM_Null)==0 ); - if( (pMem->flags & (MEM_Int|MEM_Real))==(MEM_Int|MEM_Real) ){ - assert( pMem->r==pMem->i ); - } + /* If the MEM is both real and integer, the values are equal */ + assert( (pMem->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real) + || pMem->r==pMem->i ); } #endif |
