CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
107 lines
2.2 KiB
Plaintext
107 lines
2.2 KiB
Plaintext
# 2013 July 04
|
|
#
|
|
# 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 tests that filter callbacks work as required.
|
|
#
|
|
|
|
if {![info exists testdir]} {
|
|
set testdir [file join [file dirname [info script]] .. .. test]
|
|
}
|
|
source [file join [file dirname [info script]] session_common.tcl]
|
|
source $testdir/tester.tcl
|
|
ifcapable !session {finish_test; return}
|
|
set testprefix sessionA
|
|
|
|
|
|
forcedelete test.db2
|
|
sqlite3 db2 test.db2
|
|
foreach {tn db} {1 db 2 db2} {
|
|
do_test 1.$tn.1 {
|
|
execsql {
|
|
CREATE TABLE t1(a PRIMARY KEY, b);
|
|
CREATE TABLE t2(a PRIMARY KEY, b);
|
|
CREATE TABLE t3(a PRIMARY KEY, b);
|
|
} $db
|
|
} {}
|
|
}
|
|
|
|
proc tbl_filter {zTbl} {
|
|
return $::table_filter($zTbl)
|
|
}
|
|
|
|
do_test 2.1 {
|
|
set ::table_filter(t1) 1
|
|
set ::table_filter(t2) 0
|
|
set ::table_filter(t3) 1
|
|
|
|
sqlite3session S db main
|
|
S table_filter tbl_filter
|
|
|
|
execsql {
|
|
INSERT INTO t1 VALUES('a', 'b');
|
|
INSERT INTO t2 VALUES('c', 'd');
|
|
INSERT INTO t3 VALUES('e', 'f');
|
|
}
|
|
|
|
set changeset [S changeset]
|
|
S delete
|
|
sqlite3changeset_apply db2 $changeset xConflict
|
|
|
|
execsql {
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
SELECT * FROM t3;
|
|
} db2
|
|
} {a b e f}
|
|
|
|
#-------------------------------------------------------------------------
|
|
# Test that filter callbacks passed to sqlite3changeset_apply() are
|
|
# invoked correctly.
|
|
#
|
|
reset_db
|
|
do_execsql_test 3.1 {
|
|
CREATE TABLE t1(a PRIMARY KEY, b);
|
|
CREATE TABLE t2(x PRIMARY KEY, y);
|
|
}
|
|
|
|
do_test 3.2 {
|
|
execsql BEGIN
|
|
set ::cs [changeset_from_sql {
|
|
INSERT INTO t1 VALUES(1, 2);
|
|
INSERT INTO t2 VALUES('x', 'y');
|
|
}]
|
|
execsql ROLLBACK
|
|
set {} {}
|
|
} {}
|
|
|
|
proc filter {x y} {
|
|
return [string equal $x $y]
|
|
}
|
|
|
|
do_test 3.3 {
|
|
sqlite3changeset_apply db $::cs {} [list filter t1]
|
|
execsql {
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
}
|
|
} {1 2}
|
|
|
|
do_test 3.4 {
|
|
execsql { DELETE FROM t1 }
|
|
sqlite3changeset_apply db $::cs {} [list filter t2]
|
|
execsql {
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
}
|
|
} {x y}
|
|
|
|
finish_test
|