364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
int i;
if(info->nOrderBy==1 && (info->aOrderBy->iColumn==-1 || !info->aOrderBy->iColumn) && !info->aOrderBy->desc) info->orderByConsumed=1;
for(i=0;i<info->nConstraint;i++) {
if((info->aConstraint[i].iColumn==-1 || !info->aConstraint[i].iColumn) && info->aConstraint[i].op==SQLITE_INDEX_CONSTRAINT_EQ && info->aConstraint[i].usable) {
info->aConstraintUsage[i].argvIndex=1;
info->aConstraintUsage[i].omit=1;
info->idxFlags=SQLITE_INDEX_SCAN_UNIQUE;
break;
}
}
return SQLITE_OK;
}
static int vt0_open(sqlite3_vtab*vt,sqlite3_vtab_cursor**cur) {
|
>
>
|
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
int i;
if(info->nOrderBy==1 && (info->aOrderBy->iColumn==-1 || !info->aOrderBy->iColumn) && !info->aOrderBy->desc) info->orderByConsumed=1;
for(i=0;i<info->nConstraint;i++) {
if((info->aConstraint[i].iColumn==-1 || !info->aConstraint[i].iColumn) && info->aConstraint[i].op==SQLITE_INDEX_CONSTRAINT_EQ && info->aConstraint[i].usable) {
info->aConstraintUsage[i].argvIndex=1;
info->aConstraintUsage[i].omit=1;
info->idxFlags=SQLITE_INDEX_SCAN_UNIQUE;
info->estimatedCost=1.0;
info->estimatedRows=1;
break;
}
}
return SQLITE_OK;
}
static int vt0_open(sqlite3_vtab*vt,sqlite3_vtab_cursor**cur) {
|
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
|
cur->eof=1;
break;
}
if(objects[cur->rowid]) break;
}
}
cur->arg[1]=1;
} else if((cur->arg[0]&0x0006) && !cur->arg[1]) {
// Find top/bottom at location
cur->arg[1]=1;
atxy:
cur->rowid=playfield[cur->arg[2]+cur->arg[3]*64-65];
if(cur->rowid==VOIDLINK) goto nextxy;
if(cur->arg[0]&0x0020) {
while(cur->rowid!=VOIDLINK && objects[cur->rowid]->up!=VOIDLINK) cur->rowid=objects[cur->rowid]->up;
|
|
|
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
|
cur->eof=1;
break;
}
if(objects[cur->rowid]) break;
}
}
cur->arg[1]=1;
} else if((cur->arg[0]&0x0066) && !cur->arg[1]) {
// Find top/bottom at location
cur->arg[1]=1;
atxy:
cur->rowid=playfield[cur->arg[2]+cur->arg[3]*64-65];
if(cur->rowid==VOIDLINK) goto nextxy;
if(cur->arg[0]&0x0020) {
while(cur->rowid!=VOIDLINK && objects[cur->rowid]->up!=VOIDLINK) cur->rowid=objects[cur->rowid]->up;
|
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
|
info->aConstraintUsage[i].omit=1;
info->aConstraintUsage[i].argvIndex=++arg;
info->idxFlags=SQLITE_INDEX_SCAN_UNIQUE;
sqlite3_str_appendchar(str,1,'a');
info->estimatedCost/=10000.0;
} else if(j==SQLITE_INDEX_CONSTRAINT_GT || j==SQLITE_INDEX_CONSTRAINT_GE) {
info->idxNum|=0x0008;
info->aConstraintUsage[i].omit=1;
info->aConstraintUsage[i].argvIndex=++arg;
sqlite3_str_appendchar(str,1,j==SQLITE_INDEX_CONSTRAINT_GT?'b':'c');
info->estimatedCost/=1200.0;
}
break;
case 7: // X
if(info->idxNum&0x0013) break;
|
|
|
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
|
info->aConstraintUsage[i].omit=1;
info->aConstraintUsage[i].argvIndex=++arg;
info->idxFlags=SQLITE_INDEX_SCAN_UNIQUE;
sqlite3_str_appendchar(str,1,'a');
info->estimatedCost/=10000.0;
} else if(j==SQLITE_INDEX_CONSTRAINT_GT || j==SQLITE_INDEX_CONSTRAINT_GE) {
info->idxNum|=0x0008;
//info->aConstraintUsage[i].omit=1;
info->aConstraintUsage[i].argvIndex=++arg;
sqlite3_str_appendchar(str,1,j==SQLITE_INDEX_CONSTRAINT_GT?'b':'c');
info->estimatedCost/=1200.0;
}
break;
case 7: // X
if(info->idxNum&0x0013) break;
|