CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
fts4lastrowid.test73 linesDownload Raw Back to test
1# 2017 Feb 272#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#12# Tests of the last_insert_rowid functionality with fts4.13#14 15set testdir [file dirname $argv0]16source [file join [file dirname [info script]] tester.tcl]17set testprefix fts4lastrowid18 19ifcapable !fts3 {20  finish_test21  return22}23 24do_execsql_test 1.0 {25  CREATE VIRTUAL TABLE t1 USING fts4(str);26}27 28do_execsql_test 1.1 {29  INSERT INTO t1 VALUES('one string');30  INSERT INTO t1 VALUES('two string');31  INSERT INTO t1 VALUES('three string');32  SELECT last_insert_rowid();33} {3}34 35do_execsql_test 1.2 {36  BEGIN;37    INSERT INTO t1 VALUES('one string');38    INSERT INTO t1 VALUES('two string');39    INSERT INTO t1 VALUES('three string');40  COMMIT;41  SELECT last_insert_rowid();42} {6}43 44do_execsql_test 1.3 {45  INSERT INTO t1(rowid, str) VALUES(-22, 'some more text');46  SELECT last_insert_rowid();47} {-22}48 49do_execsql_test 1.4 {50  BEGIN;51    INSERT INTO t1(rowid, str) VALUES(45, 'some more text');52    INSERT INTO t1(rowid, str) VALUES(46, 'some more text');53    INSERT INTO t1(rowid, str) VALUES(222, 'some more text');54    SELECT last_insert_rowid();55  COMMIT;56  SELECT last_insert_rowid();57} {222 222}58 59do_execsql_test 1.5 {60  CREATE TABLE x1(x);61  INSERT INTO x1 VALUES('john'), ('paul'), ('george'), ('ringo');62  INSERT INTO t1 SELECT x FROM x1;63  SELECT last_insert_rowid();64} {226}65 66do_execsql_test 1.6 {67  INSERT INTO t1(rowid, str) SELECT rowid+10, x FROM x1;68  SELECT last_insert_rowid();69} {14}70 71 72finish_test73