SQLite

Check-in [af471ed79f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: af471ed79f539ff495f6d4cb3b69188c8af7ae3d
User & Date: drh 2010-06-25 14:17:58.000
Context
2010-06-25
15:16
Reduce the size of the large allocation (approx 8KB for every 4000 frames in the log) that occurs during checkpoint. Use the 'scratch' memory for this allocation instead of the general purpose allocation. (check-in: 29887487ed user: dan tags: trunk)
14:17
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. (check-in: af471ed79f user: drh tags: trunk)
12:52
Change the name of the shared-memory file on windows from *-wal-index to *-shm, for consistency with unix. (check-in: 5995cb1508 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbemem.c.
1011
1012
1013
1014
1015
1016
1017






1018

1019
1020

1021
1022
1023
1024
1025
1026
1027
  sqlite3_value *pVal = 0;

  if( !pExpr ){
    *ppVal = 0;
    return SQLITE_OK;
  }
  op = pExpr->op;






  if( op==TK_REGISTER ){

    op = pExpr->op2;  /* This only happens with SQLITE_ENABLE_STAT2 */
  }


  if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
    pVal = sqlite3ValueNew(db);
    if( pVal==0 ) goto no_mem;
    if( ExprHasProperty(pExpr, EP_IntValue) ){
      sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue);
    }else{







>
>
>
>
>
>
|
>
|
<
>







1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026

1027
1028
1029
1030
1031
1032
1033
1034
  sqlite3_value *pVal = 0;

  if( !pExpr ){
    *ppVal = 0;
    return SQLITE_OK;
  }
  op = pExpr->op;

  /* 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);
    if( pVal==0 ) goto no_mem;
    if( ExprHasProperty(pExpr, EP_IntValue) ){
      sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue);
    }else{