/ Check-in [7fffcee0]
Login

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

Overview
Comment:Fix a problem with virtual table "fsdir" and some join queries.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7fffcee0fc3fe8d036f0d93ec17673992c3edcf2bb454dc90d80142435b37946
User & Date: dan 2018-11-16 08:36:15
Context
2018-11-16
13:06
Fix comments and make magic numbers into #defines in the fsdir implementation. check-in: c537c9c3 user: drh tags: trunk
08:36
Fix a problem with virtual table "fsdir" and some join queries. check-in: 7fffcee0 user: dan tags: trunk
01:42
Improvements to the CSV virtual table. check-in: 0406ecbb user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/fileio.c.

   831    831     int idx4 = -1;
   832    832     int idx5 = -1;
   833    833     const struct sqlite3_index_constraint *pConstraint;
   834    834   
   835    835     (void)tab;
   836    836     pConstraint = pIdxInfo->aConstraint;
   837    837     for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
   838         -    if( pConstraint->usable==0 ) continue;
   839    838       if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
   840         -    if( pConstraint->iColumn==4 ) idx4 = i;
          839  +    if( pConstraint->iColumn==4 && pConstraint->usable ) idx4 = i;
   841    840       if( pConstraint->iColumn==5 ) idx5 = i;
   842    841     }
   843    842   
   844         -  if( idx4<0 ){
          843  +  if( idx4<0 || (idx5>=0 && pIdxInfo->aConstraint[idx5].usable==0) ){
   845    844       pIdxInfo->idxNum = 0;
   846         -    pIdxInfo->estimatedCost = (double)(((sqlite3_int64)1) << 50);
          845  +    pIdxInfo->estimatedCost = (double)(((sqlite3_int64)1) << 60);
   847    846     }else{
   848    847       pIdxInfo->aConstraintUsage[idx4].omit = 1;
   849    848       pIdxInfo->aConstraintUsage[idx4].argvIndex = 1;
   850    849       if( idx5>=0 ){
   851    850         pIdxInfo->aConstraintUsage[idx5].omit = 1;
   852    851         pIdxInfo->aConstraintUsage[idx5].argvIndex = 2;
   853    852         pIdxInfo->idxNum = 2;

Changes to test/zipfile.test.

   757    757     SELECT name, data FROM z ORDER BY name;
   758    758   } {b0 two b2 one}
   759    759   do_execsql_test 11.11 {
   760    760     UPDATE z SET name = name || 'suffix';
   761    761     SELECT name, data FROM z ORDER BY name;
   762    762   } {b0suffix two b2suffix one}
   763    763   
          764  +
          765  +if {$tcl_platform(platform)!="windows"} {
          766  +  do_test 12.0 {
          767  +    catch { file delete -force subdir }
          768  +    foreach {path sz} {
          769  +      subdir/x1.txt     143
          770  +      subdir/x2.txt     153
          771  +    } {
          772  +      set dir [file dirname $path]
          773  +      catch { file mkdir $dir }
          774  +      set fd [open $path w]
          775  +      puts -nonewline $fd [string repeat 1 $sz]
          776  +      close $fd
          777  +    }
          778  +  } {}
          779  +  
          780  +  do_execsql_test 12.1 {
          781  +    SELECT name FROM fsdir('subdir') ORDER BY 1;
          782  +  } {subdir subdir/x1.txt subdir/x2.txt}
          783  +  
          784  +  do_execsql_test 12.2 {
          785  +    CREATE TABLE d AS SELECT 'subdir' d;
          786  +    CREATE TABLE x AS SELECT 1 x;
          787  +  }
          788  +  
          789  +  do_execsql_test 12.4 {
          790  +    SELECT name FROM d JOIN x JOIN fsdir(d) ORDER BY 1;
          791  +  } {subdir subdir/x1.txt subdir/x2.txt}
          792  +
          793  +  do_execsql_test 12.5 {
          794  +    SELECT name FROM d JOIN x JOIN fsdir('.', d) ORDER BY 1;
          795  +  } {. ./x1.txt ./x2.txt}
          796  +}
          797  +
   764    798   finish_test