⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptrchng.test

📁 sqlite-3.4.1,嵌入式数据库.是一个功能强大的开源数据库,给学习和研发以及小型公司的发展带来了全所未有的好处.
💻 TEST
字号:
# 2007 April 27## 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 the tests in this file are to verify that the# underlying TEXT or BLOB representation of an sqlite3_value# changes appropriately when APIs from the following set are# called:##     sqlite3_value_text()#     sqlite3_value_text16()#     sqlite3_value_blob()#     sqlite3_value_bytes()#     sqlite3_value_bytes16()## $Id: ptrchng.test,v 1.1 2007/04/27 17:16:22 drh Exp $set testdir [file dirname $argv0]source $testdir/tester.tcl# Register the "pointer_change" SQL function.#sqlite3_create_function dbdo_test ptrchng-1.1 {  execsql {    CREATE TABLE t1(x INTEGER PRIMARY KEY, y BLOB);    INSERT INTO t1 VALUES(1, 'abc');    INSERT INTO t1 VALUES(2,        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234356789');    INSERT INTO t1 VALUES(3, x'626c6f62');    INSERT INTO t1 VALUES(4, x'000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324'    );    SELECT count(*) FROM t1;  }} {4}# For the short entries that fit in the Mem.zBuf[], the pointer should# never change regardless of what type conversions occur.#do_test ptrchng-2.1 {  execsql {    SELECT pointer_change(y, 'text', 'noop', 'blob') FROM t1 WHERE x=1  }} {0}do_test ptrchng-2.2 {  execsql {    SELECT pointer_change(y, 'blob', 'noop', 'text') FROM t1 WHERE x=1  }} {0}ifcapable utf16 {  do_test ptrchng-2.3 {    execsql {      SELECT pointer_change(y, 'text', 'noop', 'text16') FROM t1 WHERE x=1    }  } {0}  do_test ptrchng-2.4 {    execsql {      SELECT pointer_change(y, 'blob', 'noop', 'text16') FROM t1 WHERE x=1    }  } {0}  do_test ptrchng-2.5 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'blob') FROM t1 WHERE x=1    }  } {0}  do_test ptrchng-2.6 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'text') FROM t1 WHERE x=1    }  } {0}}do_test ptrchng-2.11 {  execsql {    SELECT pointer_change(y, 'text', 'noop', 'blob') FROM t1 WHERE x=3  }} {0}do_test ptrchng-2.12 {  execsql {    SELECT pointer_change(y, 'blob', 'noop', 'text') FROM t1 WHERE x=3  }} {0}ifcapable utf16 {  do_test ptrchng-2.13 {    execsql {      SELECT pointer_change(y, 'text', 'noop', 'text16') FROM t1 WHERE x=3    }  } {0}  do_test ptrchng-2.14 {    execsql {      SELECT pointer_change(y, 'blob', 'noop', 'text16') FROM t1 WHERE x=3    }  } {0}  do_test ptrchng-2.15 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'blob') FROM t1 WHERE x=3    }  } {0}  do_test ptrchng-2.16 {btree_breakpoint    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'text') FROM t1 WHERE x=3    }  } {0}}# For the long entries that do not fit in the Mem.zBuf[], the pointer# should change sometimes.#do_test ptrchng-3.1 {  execsql {    SELECT pointer_change(y, 'text', 'noop', 'blob') FROM t1 WHERE x=2  }} {0}do_test ptrchng-3.2 {  execsql {    SELECT pointer_change(y, 'blob', 'noop', 'text') FROM t1 WHERE x=2  }} {0}ifcapable utf16 {  do_test ptrchng-3.3 {    execsql {      SELECT pointer_change(y, 'text', 'noop', 'text16') FROM t1 WHERE x=2    }  } {1}  do_test ptrchng-3.4 {    execsql {      SELECT pointer_change(y, 'blob', 'noop', 'text16') FROM t1 WHERE x=2    }  } {1}  do_test ptrchng-3.5 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'blob') FROM t1 WHERE x=2    }  } {0}  do_test ptrchng-3.6 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'text') FROM t1 WHERE x=2    }  } {1}}do_test ptrchng-3.11 {  execsql {    SELECT pointer_change(y, 'text', 'noop', 'blob') FROM t1 WHERE x=4  }} {0}do_test ptrchng-3.12 {  execsql {    SELECT pointer_change(y, 'blob', 'noop', 'text') FROM t1 WHERE x=4  }} {0}ifcapable utf16 {  do_test ptrchng-3.13 {    execsql {      SELECT pointer_change(y, 'text', 'noop', 'text16') FROM t1 WHERE x=4    }  } {1}  do_test ptrchng-3.14 {    execsql {      SELECT pointer_change(y, 'blob', 'noop', 'text16') FROM t1 WHERE x=4    }  } {1}  do_test ptrchng-3.15 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'blob') FROM t1 WHERE x=4    }  } {0}  do_test ptrchng-3.16 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'text') FROM t1 WHERE x=4    }  } {1}}# A call to _bytes() should never reformat a _text() or _blob().#do_test ptrchng-4.1 {  execsql {    SELECT pointer_change(y, 'text', 'bytes', 'text') FROM t1  }} {0 0 0 0}do_test ptrchng-4.2 {  execsql {    SELECT pointer_change(y, 'blob', 'bytes', 'blob') FROM t1  }} {0 0 0 0}# A call to _blob() should never trigger a reformat#do_test ptrchng-5.1 {  execsql {    SELECT pointer_change(y, 'text', 'bytes', 'blob') FROM t1  }} {0 0 0 0}ifcapable utf16 {  do_test ptrchng-5.2 {    execsql {      SELECT pointer_change(y, 'text16', 'noop', 'blob') FROM t1    }  } {0 0 0 0}  do_test ptrchng-5.3 {    execsql {      SELECT pointer_change(y, 'text16', 'bytes16', 'blob') FROM t1    }  } {0 0 0 0}}finish_test

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -