SQLite

Check-in [1a91f3fd58]
Login

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

Overview
Comment:Modifications to bind.test to account for different values of SQLITE_MAX_VARIABLE_NUMBER. Ticket #3409. (CVS 5765)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1a91f3fd58608e258b60305d1d18c3d07d2e9c46
User & Date: danielk1977 2008-10-03 09:10:46.000
Context
2008-10-06
05:32
Allow INDEXED BY and NOT INDEXED clauses in SELECT statements. (CVS 5766) (check-in: 98ca5580f5 user: danielk1977 tags: trunk)
2008-10-03
09:10
Modifications to bind.test to account for different values of SQLITE_MAX_VARIABLE_NUMBER. Ticket #3409. (CVS 5765) (check-in: 1a91f3fd58 user: danielk1977 tags: trunk)
08:44
Change one of the test cases in incrblob2.test to avoid allocating a 10MB block of heap memory. (CVS 5764) (check-in: 83b7dd737a user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/bind.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2003 September 6
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script testing the sqlite_bind API.
#
# $Id: bind.test,v 1.44 2008/07/09 01:39:44 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

proc sqlite_step {stmt N VALS COLS} {
  upvar VALS vals













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2003 September 6
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script testing the sqlite_bind API.
#
# $Id: bind.test,v 1.45 2008/10/03 09:10:46 danielk1977 Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

proc sqlite_step {stmt N VALS COLS} {
  upvar VALS vals
415
416
417
418
419
420
421


422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440

441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
  catch { sqlite3_bind_double $VM 4 6.0 }
} {1}

do_test bind-8.99 {
  sqlite3_finalize $VM
} SQLITE_OK



do_test bind-9.1 {
  execsql {
    CREATE TABLE t2(a,b,c,d,e,f);
  }
  set rc [catch {
    sqlite3_prepare $DB {
      INSERT INTO t2(a) VALUES(?0)
    } -1 TAIL
  } msg]
  lappend rc $msg
} {1 {(1) variable number must be between ?1 and ?999}}
do_test bind-9.2 {
  set rc [catch {
    sqlite3_prepare $DB {
      INSERT INTO t2(a) VALUES(?1000)
    } -1 TAIL
  } msg]
  lappend rc $msg
} {1 {(1) variable number must be between ?1 and ?999}}

do_test bind-9.3.1 {
  set VM [
    sqlite3_prepare $DB {
      INSERT INTO t2(a,b) VALUES(?1,?999)
    } -1 TAIL
  ]
  sqlite3_bind_parameter_count $VM
} {999}
catch {sqlite3_finalize $VM}
do_test bind-9.3.2 {
  set VM [
    sqlite3_prepare $DB {
      INSERT INTO t2(a,b) VALUES(?2,?998)
    } -1 TAIL
  ]
  sqlite3_bind_parameter_count $VM
} {998}
catch {sqlite3_finalize $VM}
do_test bind-9.4 {
  set VM [
    sqlite3_prepare $DB {
      INSERT INTO t2(a,b,c,d) VALUES(?1,?997,?,?)
    } -1 TAIL
  ]
  sqlite3_bind_parameter_count $VM
} {999}
do_test bind-9.5 {
  sqlite3_bind_int $VM 1 1
  sqlite3_bind_int $VM 997 999
  sqlite3_bind_int $VM 998 1000
  sqlite3_bind_int $VM 999 1001
  sqlite3_step $VM
} SQLITE_DONE
do_test bind-9.6 {
  sqlite3_finalize $VM
} SQLITE_OK
do_test bind-9.7 {
  execsql {SELECT * FROM t2}







>
>










|


|
<
<


<
>


|
|
|


|



|
|
|


|



|
|
|


|


|
|
|







415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437


438
439

440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
  catch { sqlite3_bind_double $VM 4 6.0 }
} {1}

do_test bind-8.99 {
  sqlite3_finalize $VM
} SQLITE_OK

set iMaxVar $SQLITE_MAX_VARIABLE_NUMBER
set zError "(1) variable number must be between ?1 and ?$iMaxVar"
do_test bind-9.1 {
  execsql {
    CREATE TABLE t2(a,b,c,d,e,f);
  }
  set rc [catch {
    sqlite3_prepare $DB {
      INSERT INTO t2(a) VALUES(?0)
    } -1 TAIL
  } msg]
  lappend rc $msg
} [list 1 $zError]
do_test bind-9.2 {
  set rc [catch {
    sqlite3_prepare $DB "INSERT INTO t2(a) VALUES(?[expr $iMaxVar+1])" -1 TAIL


  } msg]
  lappend rc $msg

} [list 1 $zError]
do_test bind-9.3.1 {
  set VM [
    sqlite3_prepare $DB "
      INSERT INTO t2(a,b) VALUES(?1,?$iMaxVar)
    " -1 TAIL
  ]
  sqlite3_bind_parameter_count $VM
} $iMaxVar
catch {sqlite3_finalize $VM}
do_test bind-9.3.2 {
  set VM [
    sqlite3_prepare $DB "
      INSERT INTO t2(a,b) VALUES(?2,?[expr $iMaxVar - 1])
    " -1 TAIL
  ]
  sqlite3_bind_parameter_count $VM
} [expr {$iMaxVar - 1}]
catch {sqlite3_finalize $VM}
do_test bind-9.4 {
  set VM [
    sqlite3_prepare $DB "
      INSERT INTO t2(a,b,c,d) VALUES(?1,?[expr $iMaxVar - 2],?,?)
    " -1 TAIL
  ]
  sqlite3_bind_parameter_count $VM
} $iMaxVar
do_test bind-9.5 {
  sqlite3_bind_int $VM 1 1
  sqlite3_bind_int $VM [expr $iMaxVar - 2] 999
  sqlite3_bind_int $VM [expr $iMaxVar - 1] 1000
  sqlite3_bind_int $VM $iMaxVar 1001
  sqlite3_step $VM
} SQLITE_DONE
do_test bind-9.6 {
  sqlite3_finalize $VM
} SQLITE_OK
do_test bind-9.7 {
  execsql {SELECT * FROM t2}