CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
bindxfer.test77 linesDownload Raw Back to test
1# 2005 April 212#3# The author disclaims copyright to this source code.  In place of4# a legal notice, here is a blessing:5#6#    May you do good and not evil.7#    May you find forgiveness for yourself and forgive others.8#    May you share freely, never taking more than you give.9#10#***********************************************************************11# This file implements regression tests for SQLite library.  The12# focus of this script testing the sqlite_transfer_bindings() API.13#14# $Id: bindxfer.test,v 1.9 2009/04/17 11:56:28 drh Exp $15#16 17set testdir [file dirname $argv0]18source $testdir/tester.tcl19 20proc sqlite_step {stmt VALS COLS} {21  upvar #0 $VALS vals22  upvar #0 $COLS cols23  set vals [list]24  set cols [list]25 26  set rc [sqlite3_step $stmt]27  for {set i 0} {$i < [sqlite3_column_count $stmt]} {incr i} {28    lappend cols [sqlite3_column_name $stmt $i]29  }30  for {set i 0} {$i < [sqlite3_data_count $stmt]} {incr i} {31    lappend vals [sqlite3_column_text $stmt $i]32  }33 34  return $rc35}36 37do_test bindxfer-1.1 {38  set DB [sqlite3_connection_pointer db]39  execsql {CREATE TABLE t1(a,b,c);}40  set VM1 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL]41  set TAIL42} {}43do_test bindxfer-1.2 {44  sqlite3_bind_parameter_count $VM145} 346do_test bindxfer-1.3 {47  set VM2 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL]48  set TAIL49} {}50do_test bindxfer-1.4 {51  sqlite3_bind_parameter_count $VM252} 353ifcapable deprecated {54  do_test bindxfer-1.5 {55    sqlite_bind $VM1 1 one normal56    set sqlite_static_bind_value two57    sqlite_bind $VM1 2 {} static58    sqlite_bind $VM1 3 {} null59    sqlite3_transfer_bindings $VM1 $VM260    sqlite_step $VM1 VALUES COLNAMES61  } SQLITE_ROW62  do_test bindxfer-1.6 {63    set VALUES64  } {{} {} {}}65  do_test bindxfer-1.7 {66    sqlite_step $VM2 VALUES COLNAMES67  } SQLITE_ROW68  do_test bindxfer-1.8 {69    set VALUES70  } {one two {}}71}72catch {sqlite3_finalize $VM1}73catch {sqlite3_finalize $VM2}74 75 76finish_test77