SQLite

Check-in [3980379069]
Login

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

Overview
Comment:New bind tests (check-ins (2797) and (2798)) only work right on a UTF8 database. So make sure they are only run when the database is UTF8. (CVS 2812)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 398037906956f0274ca35cbff6961f6df5149295
User & Date: drh 2005-12-09 20:54:35.000
Context
2005-12-10
21:19
Add the "exists" method to the TCL interface. (CVS 2813) (check-in: 8a355d7aad user: drh tags: trunk)
2005-12-09
20:54
New bind tests (check-ins (2797) and (2798)) only work right on a UTF8 database. So make sure they are only run when the database is UTF8. (CVS 2812) (check-in: 3980379069 user: drh tags: trunk)
20:21
More annoying and pointless signedness warnings fixed. (CVS 2811) (check-in: 590578bef8 user: drh 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.34 2005/12/05 13:20:03 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.35 2005/12/09 20:54:35 drh Exp $
#

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

proc sqlite_step {stmt N VALS COLS} {
  upvar VALS vals
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
#
ifcapable tclvar {
  do_test bind-11.1 {
    catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;}
  } {1 {unrecognized token: "$abc(123"}}
}


# Test the ability to bind text that contains embedded '\000' characters.
# Make sure we can recover the enter input string.
#
do_test bind-12.1 {
  execsql {
    CREATE TABLE t3(x BLOB);
  }
  set VM [sqlite3_prepare $DB {INSERT INTO t3 VALUES(?)} -1 TAIL]
  sqlite_bind  $VM 1 not-used blob10
  sqlite3_step $VM
  sqlite3_finalize $VM
  execsql {
    SELECT typeof(x), length(x), quote(x),
           length(cast(x AS BLOB)), quote(cast(x AS BLOB)) FROM t3
  }
} {text 3 'abc' 10 X'6162630078797A007071'}
do_test bind-12.2 {
  sqlite3_create_function $DB
  execsql {
    SELECT quote(cast(x_coalesce(x) AS blob)) FROM t3
  }
} {X'6162630078797A007071'}


finish_test







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>

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
527
528
#
ifcapable tclvar {
  do_test bind-11.1 {
    catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;}
  } {1 {unrecognized token: "$abc(123"}}
}

if {[execsql {pragma encoding}]=="UTF-8"} {
  # Test the ability to bind text that contains embedded '\000' characters.
  # Make sure we can recover the enter input string.
  #
  do_test bind-12.1 {
    execsql {
      CREATE TABLE t3(x BLOB);
    }
    set VM [sqlite3_prepare $DB {INSERT INTO t3 VALUES(?)} -1 TAIL]
    sqlite_bind  $VM 1 not-used blob10
    sqlite3_step $VM
    sqlite3_finalize $VM
    execsql {
      SELECT typeof(x), length(x), quote(x),
             length(cast(x AS BLOB)), quote(cast(x AS BLOB)) FROM t3
    }
  } {text 3 'abc' 10 X'6162630078797A007071'}
  do_test bind-12.2 {
    sqlite3_create_function $DB
    execsql {
      SELECT quote(cast(x_coalesce(x) AS blob)) FROM t3
    }
  } {X'6162630078797A007071'}
}

finish_test