/ Check-in [61174aea]
Login

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

Overview
Comment:Fix a problem in the analyze3.test script.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1:61174aea74db59f6792e275aa366b7f0e1f2270b
User & Date: dan 2009-10-16 15:59:35
Context
2009-10-16
16:21
Merge the sqlite3_reoptimize() changes into the trunk. check-in: 50136840 user: drh tags: trunk
15:59
Fix a problem in the analyze3.test script. Closed-Leaf check-in: 61174aea user: dan tags: experimental
15:19
Remove a mutex reference leak from sqlite3_reoptimize(). check-in: 9f093706 user: dan tags: experimental
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/analyze3.test.

313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
...
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
...
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
...
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
...
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
...
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
...
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
} {}

do_test analyze3-3.2.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE b>?" -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.2.2 {
  sqlite3_bind_text $S 1 "abc" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.2.3 {
  test_reoptimize $S
} {0}
do_test analyze3-3.2.4 {
  sqlite3_finalize $S
................................................................................
} {SQLITE_OK}

do_test analyze3-3.2.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE b=?" -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.2.2 {
  sqlite3_bind_text $S 1 "abc" -1
  test_reoptimize $S
} {0}
do_test analyze3-3.2.3 {
  sqlite3_finalize $S
} {SQLITE_OK}

do_test analyze3-3.3.1 {
................................................................................
} {SQLITE_OK}

do_test analyze3-3.4.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE a=? AND b>?" -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.4.2 {
  sqlite3_bind_text $S 1 "abc" -1
  test_reoptimize $S
} {0}
do_test analyze3-3.4.3 {
  sqlite3_bind_text $S 2 "def" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.4.4 {
  sqlite3_bind_text $S 2 "ghi" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.4.5 {
  test_reoptimize $S
} {0}
do_test analyze3-3.4.6 {
  sqlite3_finalize $S
................................................................................
      ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20,
      ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31
    ) AND b>?32;
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.5.2 {
  sqlite3_bind_text $S 31 "abc" -1
  test_reoptimize $S
} {0}
do_test analyze3-3.5.3 {
  sqlite3_bind_text $S 32 "def" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.5.4 {
  test_reoptimize $S
} {0}
do_test analyze3-3.5.5 {
  sqlite3_finalize $S
................................................................................
      ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20,
      ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31, ?32
    ) AND b>?33;
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.6.2 {
  sqlite3_bind_text $S 32 "abc" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.6.3 {
  sqlite3_bind_text $S 33 "def" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.6.4 {
  test_reoptimize $S
} {0}
do_test analyze3-3.6.5 {
  sqlite3_finalize $S
................................................................................
      ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20,
      ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31, ?32
    ) AND b>?10;
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.7.2 {
  sqlite3_bind_text $S 32 "abc" -1
  test_reoptimize $S
} {0}
do_test analyze3-3.7.3 {
  sqlite3_bind_text $S 33 "def" -1
  test_reoptimize $S
} {0}
do_test analyze3-3.7.4 {
  sqlite3_bind_text $S 10 "def" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.7.5 {
  test_reoptimize $S
} {0}
do_test analyze3-3.7.6 {
  sqlite3_finalize $S
................................................................................
do_test analyze3-3.8.2 {
  set S [sqlite3_prepare_v2 db {
    SELECT * FROM t4 WHERE x != ? AND y LIKE ?
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.8.3 {
  sqlite3_bind_text $S 1 "abc" -1
  test_reoptimize $S
} {0}
do_test analyze3-3.8.4 {
  sqlite3_bind_text $S 2 "def" -1
  test_reoptimize $S
} {1}
do_test analyze3-3.8.5 {
  test_reoptimize $S
} {0}
do_test analyze3-3.8.6 {
  sqlite3_expired $S
} {0}
do_test analyze3-3.8.7 {
  sqlite3_bind_text $S 2 "ghi%" -1
  sqlite3_expired $S
} {0}
do_test analyze3-3.8.8 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.9 {
  sqlite3_bind_text $S 2 "ghi%def" -1
  sqlite3_expired $S
} {1}
do_test analyze3-3.8.10 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.11 {
  sqlite3_bind_text $S 2 "%ab" -1
  sqlite3_expired $S
} {1}
do_test analyze3-3.8.12 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.12 {
  sqlite3_bind_text $S 2 "%de" -1
  sqlite3_expired $S
} {0}
do_test analyze3-3.8.13 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.14 {
  sqlite3_finalize $S
................................................................................
# Check an schema error.
#
do_test analyze3-4.1.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE a=? AND b>?" -1 dummy]
  sqlite3_reoptimize $S
} {SQLITE_OK}
do_test analyze3-4.1.2 {
  sqlite3_bind_text $S 2 "abc" -1
  execsql { DROP TABLE t1 }
  sqlite3_reoptimize $S
} {SQLITE_SCHEMA}
do_test analyze3-4.1.3 {
  sqlite3_step $S
} {SQLITE_SCHEMA}
do_test analyze3-4.1.4 {
................................................................................
} {SQLITE_OK}
db auth auth
proc auth {args} {
  if {[lindex $args 0] == "SQLITE_READ"} {return SQLITE_DENY}
  return SQLITE_OK
}
do_test analyze3-4.2.2 {
  sqlite3_bind_text $S 2 "abc" -1
  sqlite3_reoptimize $S
} {SQLITE_SCHEMA}
do_test analyze3-4.2.3 {
  sqlite3_step $S
} {SQLITE_SCHEMA}
do_test analyze3-4.2.4 {
  sqlite3_finalize $S







|







 







|







 







|



|



|







 







|



|







 







|



|







 







|



|



|







 







|



|









|






|






|






|







 







|







 







|







313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
...
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
...
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
...
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
...
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
...
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
...
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
} {}

do_test analyze3-3.2.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE b>?" -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.2.2 {
  sqlite3_bind_text $S 1 "abc" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.2.3 {
  test_reoptimize $S
} {0}
do_test analyze3-3.2.4 {
  sqlite3_finalize $S
................................................................................
} {SQLITE_OK}

do_test analyze3-3.2.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE b=?" -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.2.2 {
  sqlite3_bind_text $S 1 "abc" 3
  test_reoptimize $S
} {0}
do_test analyze3-3.2.3 {
  sqlite3_finalize $S
} {SQLITE_OK}

do_test analyze3-3.3.1 {
................................................................................
} {SQLITE_OK}

do_test analyze3-3.4.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE a=? AND b>?" -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.4.2 {
  sqlite3_bind_text $S 1 "abc" 3
  test_reoptimize $S
} {0}
do_test analyze3-3.4.3 {
  sqlite3_bind_text $S 2 "def" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.4.4 {
  sqlite3_bind_text $S 2 "ghi" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.4.5 {
  test_reoptimize $S
} {0}
do_test analyze3-3.4.6 {
  sqlite3_finalize $S
................................................................................
      ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20,
      ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31
    ) AND b>?32;
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.5.2 {
  sqlite3_bind_text $S 31 "abc" 3
  test_reoptimize $S
} {0}
do_test analyze3-3.5.3 {
  sqlite3_bind_text $S 32 "def" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.5.4 {
  test_reoptimize $S
} {0}
do_test analyze3-3.5.5 {
  sqlite3_finalize $S
................................................................................
      ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20,
      ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31, ?32
    ) AND b>?33;
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.6.2 {
  sqlite3_bind_text $S 32 "abc" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.6.3 {
  sqlite3_bind_text $S 33 "def" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.6.4 {
  test_reoptimize $S
} {0}
do_test analyze3-3.6.5 {
  sqlite3_finalize $S
................................................................................
      ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20,
      ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28, ?29, ?30, ?31, ?32
    ) AND b>?10;
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.7.2 {
  sqlite3_bind_text $S 32 "abc" 3
  test_reoptimize $S
} {0}
do_test analyze3-3.7.3 {
  sqlite3_bind_text $S 33 "def" 3
  test_reoptimize $S
} {0}
do_test analyze3-3.7.4 {
  sqlite3_bind_text $S 10 "def" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.7.5 {
  test_reoptimize $S
} {0}
do_test analyze3-3.7.6 {
  sqlite3_finalize $S
................................................................................
do_test analyze3-3.8.2 {
  set S [sqlite3_prepare_v2 db {
    SELECT * FROM t4 WHERE x != ? AND y LIKE ?
  } -1 dummy]
  test_reoptimize $S
} {0}
do_test analyze3-3.8.3 {
  sqlite3_bind_text $S 1 "abc" 3
  test_reoptimize $S
} {0}
do_test analyze3-3.8.4 {
  sqlite3_bind_text $S 2 "def" 3
  test_reoptimize $S
} {1}
do_test analyze3-3.8.5 {
  test_reoptimize $S
} {0}
do_test analyze3-3.8.6 {
  sqlite3_expired $S
} {0}
do_test analyze3-3.8.7 {
  sqlite3_bind_text $S 2 "ghi%" 4
  sqlite3_expired $S
} {0}
do_test analyze3-3.8.8 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.9 {
  sqlite3_bind_text $S 2 "ghi%def" 7
  sqlite3_expired $S
} {1}
do_test analyze3-3.8.10 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.11 {
  sqlite3_bind_text $S 2 "%ab" 3
  sqlite3_expired $S
} {1}
do_test analyze3-3.8.12 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.12 {
  sqlite3_bind_text $S 2 "%de" 3
  sqlite3_expired $S
} {0}
do_test analyze3-3.8.13 {
  test_reoptimize $S
} {1}
do_test analyze3-3.8.14 {
  sqlite3_finalize $S
................................................................................
# Check an schema error.
#
do_test analyze3-4.1.1 {
  set S [sqlite3_prepare_v2 db "SELECT * FROM t1 WHERE a=? AND b>?" -1 dummy]
  sqlite3_reoptimize $S
} {SQLITE_OK}
do_test analyze3-4.1.2 {
  sqlite3_bind_text $S 2 "abc" 3
  execsql { DROP TABLE t1 }
  sqlite3_reoptimize $S
} {SQLITE_SCHEMA}
do_test analyze3-4.1.3 {
  sqlite3_step $S
} {SQLITE_SCHEMA}
do_test analyze3-4.1.4 {
................................................................................
} {SQLITE_OK}
db auth auth
proc auth {args} {
  if {[lindex $args 0] == "SQLITE_READ"} {return SQLITE_DENY}
  return SQLITE_OK
}
do_test analyze3-4.2.2 {
  sqlite3_bind_text $S 2 "abc" 3
  sqlite3_reoptimize $S
} {SQLITE_SCHEMA}
do_test analyze3-4.2.3 {
  sqlite3_step $S
} {SQLITE_SCHEMA}
do_test analyze3-4.2.4 {
  sqlite3_finalize $S