Separate the column NULL value constant into a separate routine for greater

commonality with the sessions branch.

FossilOrigin-Name: 12cbebb997705e37769460e00a4aaa52c12f305e
This commit is contained in:
drh 2014-03-05 12:47:55 +00:00
parent ef4668bc05
commit b1a1c29a07
3 changed files with 33 additions and 30 deletions

View File

@ -1,5 +1,5 @@
C Remove\sthe\sredundant\smemType\sfield\sfrom\sstruct\sMem.
D 2014-03-05T11:48:35.825
C Separate\sthe\scolumn\sNULL\svalue\sconstant\sinto\sa\sseparate\sroutine\sfor\sgreater\ncommonality\swith\sthe\ssessions\sbranch.
D 2014-03-05T12:47:55.519
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -280,7 +280,7 @@ F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
F src/vdbe.c 8c6fc7bb9f2218c0e43f24d847e596effa8671e2
F src/vdbe.h d189f92468a17a6f04daeec9df3b767f50557b21
F src/vdbeInt.h e54fc4f289fce48e81b3371128446033d097733b
F src/vdbeapi.c a5c48f2b015679ddb7c25ae866abf5e2d6e42857
F src/vdbeapi.c 77fbd57c0340a7d548a61b666143637fff726e06
F src/vdbeaux.c 43bee29ac866f7ce6af90c4f084bb22c160b8b70
F src/vdbeblob.c d939997de046b8fcc607cfee4248f3d33dbcca50
F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447
@ -1155,7 +1155,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 378b290da85cadc1acba081322d1f0e8d7694e17 bac2820e13a79d91d0f8938c643134a9d6900327
R 0b493f27b646031be527e01b67828619
U dan
Z 2c30198d39dfe9f58d28fb7d11ffc819
P 9e8528578966e4f1a16d63333de648fd8cdaf0f2
R cd61be35c414ec0c232f9ea3f0efe193
U drh
Z d8b63809d3f1784ecbab68dab389a740

View File

@ -1 +1 @@
9e8528578966e4f1a16d63333de648fd8cdaf0f2
12cbebb997705e37769460e00a4aaa52c12f305e

View File

@ -727,6 +727,30 @@ int sqlite3_data_count(sqlite3_stmt *pStmt){
return pVm->nResColumn;
}
/*
** Return a pointer to static memory containing an SQL NULL value.
*/
static const Mem *columnNullValue(void){
/* Even though the Mem structure contains an element
** of type i64, on certain architectures (x86) with certain compiler
** switches (-Os), gcc may align this Mem object on a 4-byte boundary
** instead of an 8-byte one. This all works fine, except that when
** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s
** that a Mem structure is located on an 8-byte boundary. To prevent
** these assert()s from failing, when building with SQLITE_DEBUG defined
** using gcc, we force nullMem to be 8-byte aligned using the magical
** __attribute__((aligned(8))) macro. */
static const Mem nullMem
#if defined(SQLITE_DEBUG) && defined(__GNUC__)
__attribute__((aligned(8)))
#endif
= {0, "", (double)0, {0}, 0, MEM_Null, 0,
#ifdef SQLITE_DEBUG
0, 0, /* pScopyFrom, pFiller */
#endif
0, 0 };
return &nullMem;
}
/*
** Check to see if column iCol of the given statement is valid. If
@ -743,32 +767,11 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){
sqlite3_mutex_enter(pVm->db->mutex);
pOut = &pVm->pResultSet[i];
}else{
/* If the value passed as the second argument is out of range, return
** a pointer to the following static Mem object which contains the
** value SQL NULL. Even though the Mem structure contains an element
** of type i64, on certain architectures (x86) with certain compiler
** switches (-Os), gcc may align this Mem object on a 4-byte boundary
** instead of an 8-byte one. This all works fine, except that when
** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s
** that a Mem structure is located on an 8-byte boundary. To prevent
** these assert()s from failing, when building with SQLITE_DEBUG defined
** using gcc, we force nullMem to be 8-byte aligned using the magical
** __attribute__((aligned(8))) macro. */
static const Mem nullMem
#if defined(SQLITE_DEBUG) && defined(__GNUC__)
__attribute__((aligned(8)))
#endif
= {0, "", (double)0, {0}, 0, MEM_Null, 0,
#ifdef SQLITE_DEBUG
0, 0, /* pScopyFrom, pFiller */
#endif
0, 0 };
if( pVm && ALWAYS(pVm->db) ){
sqlite3_mutex_enter(pVm->db->mutex);
sqlite3Error(pVm->db, SQLITE_RANGE, 0);
}
pOut = (Mem*)&nullMem;
pOut = (Mem*)columnNullValue();
}
return pOut;
}