-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'Improve changes() and total_changes() functions and add tests'…
… from Ben Li #144 - The previous `changes()` function returns 1 no matter what - Modified `changes()` and `total_changes()` to be closer to the sqlite implementation - Store local `n_change` counter in the `Program` struct - Update `last_change` and `total_changes` values in `Connection` struct on halt - Add `change_cnt_on` flag to `Program` struct that is `true` for insert and delete (also need later on for update) - Added TCL tests Closes #749
- Loading branch information
Showing
8 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env tclsh | ||
|
||
set testdir [file dirname $argv0] | ||
source $testdir/tester.tcl | ||
|
||
do_execsql_test_on_specific_db {:memory:} changes-on-basic-insert { | ||
create table temp (t1 integer, primary key (t1)); | ||
insert into temp values (1); | ||
select changes(); | ||
} {1} | ||
|
||
do_execsql_test_on_specific_db {:memory:} changes-on-multiple-row-insert { | ||
create table temp (t1 integer, primary key (t1)); | ||
insert into temp values (1), (2), (3); | ||
select changes(); | ||
} {3} | ||
|
||
do_execsql_test_on_specific_db {:memory:} changes-shows-most-recent { | ||
create table temp (t1 integer, primary key (t1)); | ||
insert into temp values (1), (2), (3); | ||
insert into temp values (4), (5), (6), (7); | ||
select changes(); | ||
} {4} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env tclsh | ||
|
||
set testdir [file dirname $argv0] | ||
source $testdir/tester.tcl | ||
|
||
do_execsql_test_on_specific_db {:memory:} total-changes-on-basic-insert { | ||
create table temp (t1 integer, primary key (t1)); | ||
insert into temp values (1); | ||
select total_changes(); | ||
} {1} | ||
|
||
do_execsql_test_on_specific_db {:memory:} total-changes-on-multiple-row-insert { | ||
create table temp (t1 integer, primary key (t1)); | ||
insert into temp values (1), (2), (3); | ||
select total_changes(); | ||
} {3} | ||
|
||
do_execsql_test_on_specific_db {:memory:} total-changes-on-multiple-inserts { | ||
create table temp (t1 integer, primary key (t1)); | ||
insert into temp values (1), (2), (3); | ||
insert into temp values (4), (5), (6), (7); | ||
select total_changes(); | ||
} {7} |