Subject: | incomplete testing for transaction statements |
Statements such as "\nCOMMIT" do not reset AutoCommit properly, because you only
check for the literal "COMMIT" or "commit".
I've attached a test that demonstrates this.
I recommend rewriting this part in pure perl and using a regex to match all possible
variations of the "BEGIN TRAN" and "COMMIT" statements, with any amount of
whitespace.
Subject: | sqlite_whitespace_commit.patch |
Index: t/54_literal_txn.t
===================================================================
--- t/54_literal_txn.t (revision 0)
+++ t/54_literal_txn.t (working copy)
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+BEGIN {
+ $| = 1;
+ $^W = 1;
+}
+
+use t::lib::Test qw/connect_ok/;
+use Test::More;
+
+my $dbh = connect_ok();
+
+is $dbh->{AutoCommit}, 1,
+ 'AutoCommit=1 at connection';
+
+$dbh->do('BEGIN TRANSACTION');
+
+is $dbh->{AutoCommit}, '',
+ "AutoCommit='' after 'BEGIN TRANSACTION'";
+
+$dbh->do("SELECT 1 FROM sqlite_master LIMIT 1");
+
+$dbh->do("\nCOMMIT");
+
+is $dbh->{AutoCommit}, 1,
+ 'AutoCommit=1 after "\nCOMMIT"';
+
+done_testing;