Fix up a branch in sqlite3ValueFromExpr() so that we can achieve full

branch test coverage regardless of whether or not SQLITE_ENABLE_STAT2 is
used.

FossilOrigin-Name: af471ed79f539ff495f6d4cb3b69188c8af7ae3d
This commit is contained in:
drh 2010-06-25 14:17:58 +00:00
parent d36f660d5b
commit 4a466d3ef3
3 changed files with 20 additions and 13 deletions

View File

@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Change\sthe\sname\sof\sthe\sshared-memory\sfile\son\swindows\sfrom\s*-wal-index\sto\n*-shm,\sfor\sconsistency\swith\sunix.
D 2010-06-25T12:52:47
C Fix\sup\sa\sbranch\sin\ssqlite3ValueFromExpr()\sso\sthat\swe\scan\sachieve\sfull\nbranch\stest\scoverage\sregardless\sof\swhether\sor\snot\sSQLITE_ENABLE_STAT2\sis\nused.
D 2010-06-25T14:17:58
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -226,7 +226,7 @@ F src/vdbeInt.h 19ebc8c2a2e938340051ee65af3f377fb99102d1
F src/vdbeapi.c dc3138f10afbc95ed3c21dd25abb154504b1db9d
F src/vdbeaux.c 4e96a5169b988a8697d4a417f902277b4152e43e
F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
F src/wal.c a6648b66a8990439d5d5c124191590b00929b9e4
@ -828,14 +828,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P daea6c054cee3564d8460d876b78a325ebc382dd
R 4354913e444fd82168be80b3bdcdc646
P 5995cb15080cfb707ddda501f975673f658106f7
R b293a589c96868961d62e21f054fc0b8
U drh
Z a36a85791020dd7903c25fa65a26078e
Z 4fc1bd811dc80b4ce7415da853fc1e91
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMJKaioxKgR168RlERAgyzAJ4t9rMtvmHDwyWrnMVHVYaI1Ao/rgCfdA+H
fjjllhGtv+TwuqIzTAvwBAw=
=QxW5
iD8DBQFMJLqZoxKgR168RlERAkSsAJ4tTxR+vXkcVc8afivjpTTCf6qYLACfVFaM
B4uK0hleb5qyn2q3SH3rYII=
=XoGT
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
5995cb15080cfb707ddda501f975673f658106f7
af471ed79f539ff495f6d4cb3b69188c8af7ae3d

View File

@ -1015,9 +1015,16 @@ int sqlite3ValueFromExpr(
return SQLITE_OK;
}
op = pExpr->op;
if( op==TK_REGISTER ){
op = pExpr->op2; /* This only happens with SQLITE_ENABLE_STAT2 */
}
/* op can only be TK_REGISTER is we have compiled with SQLITE_ENABLE_STAT2.
** The ifdef here is to enable us to achieve 100% branch test coverage even
** when SQLITE_ENABLE_STAT2 is omitted.
*/
#ifdef SQLITE_ENABLE_STAT2
if( op==TK_REGISTER ) op = pExpr->op2;
#else
if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
#endif
if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
pVal = sqlite3ValueNew(db);