SQLite

Check-in [d1592d201a]
Login

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

Overview
Comment:Small simplification to the EXPLAIN QUERY PLAN logic.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d1592d201afea20cb2ca94fe2bf5ae031bd29ede
User & Date: drh 2015-09-02 16:51:37.514
Context
2015-09-02
17:55
Change sqlite3_sql() so that it always returns the SQL text of the prepared statement, if the text is available, even if the the prepared statement was generated using sqlite3_prepare() instead of sqlite3_prepare_v2(). Also include some minor comment fixes and code simplifications. (check-in: 2f5472cfda user: drh tags: trunk)
16:51
Small simplification to the EXPLAIN QUERY PLAN logic. (check-in: d1592d201a user: drh tags: trunk)
15:37
Use sqlite3XPrintf() instead of sqlite3StrAccumAppend() in a few places for better performance and a smaller footprint. (check-in: 82355e4108 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wherecode.c.
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  Column *aCol = pTab->aCol;
  i16 *aiColumn = pIndex->aiColumn;

  if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
  sqlite3StrAccumAppend(pStr, " (", 2);
  for(i=0; i<nEq; i++){
    char *z = aiColumn[i] < 0 ? "rowid" : aCol[aiColumn[i]].zName;
    if( i>=nSkip ){
      explainAppendTerm(pStr, i, z, "=");
    }else{
      if( i ) sqlite3StrAccumAppend(pStr, " AND ", 5);
      sqlite3XPrintf(pStr, 0, "ANY(%s)", z);
    }
  }

  j = i;
  if( pLoop->wsFlags&WHERE_BTM_LIMIT ){
    char *z = aiColumn[j] < 0 ? "rowid" : aCol[aiColumn[j]].zName;
    explainAppendTerm(pStr, i++, z, ">");
  }







<
<
<
|
|
<







63
64
65
66
67
68
69



70
71

72
73
74
75
76
77
78
  Column *aCol = pTab->aCol;
  i16 *aiColumn = pIndex->aiColumn;

  if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
  sqlite3StrAccumAppend(pStr, " (", 2);
  for(i=0; i<nEq; i++){
    char *z = aiColumn[i] < 0 ? "rowid" : aCol[aiColumn[i]].zName;



    if( i ) sqlite3StrAccumAppend(pStr, " AND ", 5);
    sqlite3XPrintf(pStr, 0, i>=nSkip ? "%s=?" : "ANY(%s)", z);

  }

  j = i;
  if( pLoop->wsFlags&WHERE_BTM_LIMIT ){
    char *z = aiColumn[j] < 0 ? "rowid" : aCol[aiColumn[j]].zName;
    explainAppendTerm(pStr, i++, z, ">");
  }