/ Check-in [9affe7f3]
Login

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

Overview
Comment:Merge latest trunk changes with this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | insert-select-opt
Files: files | file ages | folders
SHA1: 9affe7f3f9ccb4fd93d428d6c1c2370b09ad0383
User & Date: dan 2015-03-21 15:04:27
Context
2015-03-21
15:26
Do not use sorters for INSERT statements that insert multiple rows using the VALUES clause. check-in: 93e28ea1 user: dan tags: insert-select-opt
15:04
Merge latest trunk changes with this branch. check-in: 9affe7f3 user: dan tags: insert-select-opt
12:25
Remove an unreachable branch from the OP_VCreate opcode (merge accidental fork in trunk). check-in: 2fbfec62 user: dan tags: trunk
07:16
Merge recent trunk changes with this branch. check-in: 35eef4dd user: dan tags: insert-select-opt
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3.c.

   906    906   **
   907    907   ** If *pp does not being with a decimal digit SQLITE_ERROR is returned and
   908    908   ** the output value undefined. Otherwise SQLITE_OK is returned.
   909    909   **
   910    910   ** This function is used when parsing the "prefix=" FTS4 parameter.
   911    911   */
   912    912   static int fts3GobbleInt(const char **pp, int *pnOut){
          913  +  const MAX_NPREFIX = 10000000;
   913    914     const char *p;                  /* Iterator pointer */
   914    915     int nInt = 0;                   /* Output value */
   915    916   
   916    917     for(p=*pp; p[0]>='0' && p[0]<='9'; p++){
   917    918       nInt = nInt * 10 + (p[0] - '0');
          919  +    if( nInt>MAX_NPREFIX ){
          920  +      nInt = 0;
          921  +      break;
          922  +    }
   918    923     }
   919    924     if( p==*pp ) return SQLITE_ERROR;
   920    925     *pnOut = nInt;
   921    926     *pp = p;
   922    927     return SQLITE_OK;
   923    928   }
   924    929   
................................................................................
   962    967     }
   963    968   
   964    969     memset(aIndex, 0, sizeof(struct Fts3Index) * nIndex);
   965    970     if( zParam ){
   966    971       const char *p = zParam;
   967    972       int i;
   968    973       for(i=1; i<nIndex; i++){
   969         -      int nPrefix;
          974  +      int nPrefix = 0;
   970    975         if( fts3GobbleInt(&p, &nPrefix) ) return SQLITE_ERROR;
   971         -      if( nPrefix<=0 ){
          976  +      assert( nPrefix>=0 );
          977  +      if( nPrefix==0 ){
   972    978           nIndex--;
   973    979           i--;
   974    980         }else{
   975    981           aIndex[i].nPrefix = nPrefix;
   976    982         }
   977    983         p++;
   978    984       }

Changes to src/vdbe.c.

  6033   6033   /* Opcode: VCreate P1 P2 * * *
  6034   6034   **
  6035   6035   ** P2 is a register that holds the name of a virtual table in database 
  6036   6036   ** P1. Call the xCreate method for that table.
  6037   6037   */
  6038   6038   case OP_VCreate: {
  6039   6039     Mem sMem;          /* For storing the record being decoded */
         6040  +  const char *zTab;  /* Name of the virtual table */
         6041  +
  6040   6042     memset(&sMem, 0, sizeof(sMem));
  6041   6043     sMem.db = db;
         6044  +  /* Because P2 is always a static string, it is impossible for the
         6045  +  ** sqlite3VdbeMemCopy() to fail */
         6046  +  assert( (aMem[pOp->p2].flags & MEM_Str)!=0 );
         6047  +  assert( (aMem[pOp->p2].flags & MEM_Static)!=0 );
  6042   6048     rc = sqlite3VdbeMemCopy(&sMem, &aMem[pOp->p2]);
  6043         -  if( rc==SQLITE_OK ){
  6044         -    const char *zTab = (const char*)sqlite3_value_text(&sMem);
  6045         -    assert( zTab || db->mallocFailed );
  6046         -    if( zTab ){
  6047         -      rc = sqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg);
  6048         -    }
         6049  +  assert( rc==SQLITE_OK );
         6050  +  zTab = (const char*)sqlite3_value_text(&sMem);
         6051  +  assert( zTab || db->mallocFailed );
         6052  +  if( zTab ){
         6053  +    rc = sqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg);
  6049   6054     }
  6050   6055     sqlite3VdbeMemRelease(&sMem);
  6051   6056     break;
  6052   6057   }
  6053   6058   #endif /* SQLITE_OMIT_VIRTUALTABLE */
  6054   6059   
  6055   6060   #ifndef SQLITE_OMIT_VIRTUALTABLE

Changes to test/shell4.test.

   118    118   } {1 {Usage: .trace FILE|off}}
   119    119   do_test shell4-2.2 {
   120    120     catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace off\n.trace off\n"
   121    121   } {0 {}}
   122    122   do_test shell4-2.3 {
   123    123     catchcmd ":memory:" ".trace stdout\n.trace\n.trace off\n.dump\n"
   124    124   } {/^1 {PRAGMA.*Usage:.*}$/}
          125  +ifcapable trace {
   125    126   do_test shell4-2.4 {
   126    127     catchcmd ":memory:" ".trace stdout\nCREATE TABLE t1(x);SELECT * FROM t1;"
   127    128   } {0 {CREATE TABLE t1(x);
   128    129   SELECT * FROM t1;}}
   129    130   do_test shell4-2.5 {
   130    131     catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace stdout\nSELECT * FROM t1;"
   131    132   } {0 {SELECT * FROM t1;}}
          133  +}
   132    134   
   133    135   
   134    136   finish_test

Changes to test/vtab2.test.

   131    131   } {}
   132    132   do_test vtab2-4.5 {
   133    133     execsql { SELECT * FROM fkey }
   134    134   } {t1 a}
   135    135   
   136    136   #-------------------------------------------------------------------------
   137    137   #
   138         -reset_db
   139         -do_execsql_test 5.1 {
   140         -  PRAGMA encoding='UTF16';
   141         -}
          138  +ifcapable fts3 {
          139  +  reset_db
          140  +  do_execsql_test 5.1 {
          141  +    PRAGMA encoding='UTF16';
          142  +  }
   142    143   
   143         -do_test 5.2 {
   144         -  sqlite3_exec_hex db { CREATE VIRTUAL TABLE %C8 USING fts3 }
   145         -} {0 {}}
          144  +  do_test 5.2 {
          145  +    sqlite3_exec_hex db { CREATE VIRTUAL TABLE %C8 USING fts3 }
          146  +  } {0 {}}
   146    147   
   147         -do_test 5.3 {
   148         -  sqlite3_exec_hex db { CREATE VIRTUAL TABLE %C9 USING s }
   149         -} {/1 {malformed database schema.* already exists}/}
          148  +  do_test 5.3 {
          149  +    sqlite3_exec_hex db { CREATE VIRTUAL TABLE %C9 USING s }
          150  +  } {/1 {malformed database schema.* already exists}/}
          151  +}
   150    152   
   151    153   
   152    154   
   153    155   finish_test
   154    156