From: Nikita Tatunov <hollow653@gmail.com>
To: tarantool-patches@freelists.org
Cc: alexander.turenko@tarantool.org
Subject: [tarantool-patches] Re: [PATCH] sql: Remove 'BEGIN TRANSACTION'
Date: Thu, 5 Jul 2018 14:48:35 +0300 [thread overview]
Message-ID: <CAEi+_aos7hkcr+JaNwFK-0t=HfYfUUA7Cn+LnWwk9yyuBdCbnQ@mail.gmail.com> (raw)
In-Reply-To: <1530787337-18302-1-git-send-email-hollow653@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2988 bytes --]
Forgot tests, sorry.
Here they are:
diff --git a/test/sql-tap/start-transaction.test.lua
b/test/sql-tap/start-transaction.test.lua
new file mode 100755
index 0000000..a2a622e
--- /dev/null
+++ b/test/sql-tap/start-transaction.test.lua
@@ -0,0 +1,147 @@
+#!/usr/bin/env tarantool
+test = require("sqltester")
+test:plan(10)
+
+test:do_catchsql_test(
+ "start-transaction-1.0",
+ [[
+ BEGIN;
+ CREATE TABLE IF NOT EXISTS t(id int PRIMARY KEY);
+ COMMIT;
+ ]], {
+ -- <start-transaction-1.0>
+ 1, "near \"BEGIN\": syntax error"
+ -- <start-transaction-1.0>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.1",
+ [[
+ BEGIN TRANSACTION;
+ CREATE TABLE IF NOT EXISTS t(id int PRIMARY KEY);
+ COMMIT;
+ ]], {
+ -- <start-transaction-1.1>
+ 1, "near \"BEGIN\": syntax error"
+ -- <start-transaction-1.1>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.2",
+ [[
+ CREATE TABLE IF NOT EXISTS t(id int PRIMARY KEY);
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ COMMIT;
+ ]], {
+ -- <start-transaction-1.2>
+ 0
+ -- <start-transaction-1.2>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.3",
+ [[
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ COMMIT TRANSACTION;
+ ]], {
+ -- <start-transaction-1.3>
+ 1, "keyword \"TRANSACTION\" is reserved"
+ -- <start-transaction-1.3>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.4",
+ [[
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ END;
+ ]], {
+ -- <start-transaction-1.4>
+ 1, "keyword \"END\" is reserved"
+ -- <start-transaction-1.4>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.5",
+ [[
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ END TRANSACTION;
+ ]], {
+ -- <start-transaction-1.5>
+ 1, "keyword \"END\" is reserved"
+ -- <start-transaction-1.5>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.6",
+ [[
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ ROLLBACK;
+ ]], {
+ -- <start-transaction-1.6>
+ 0
+ -- <start-transaction-1.6>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.7",
+ [[
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ ROLLBACK TRANSACTION;
+ COMMIT;
+ ]], {
+ -- <start-transaction-1.7>
+ 1, "keyword \"TRANSACTION\" is reserved"
+ -- <start-transaction-1.7>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.8",
+ [[
+ COMMIT;
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ SAVEPOINT s1;
+ INSERT INTO t VALUES (2);
+ DELETE FROM t;
+ ROLLBACK TO s1;
+ COMMIT;
+ ]], {
+ -- <start-transaction-1.8>
+ 0
+ -- <start-transaction-1.8>
+ })
+
+test:do_catchsql_test(
+ "start-transaction-1.9",
+ [[
+ START TRANSACTION;
+ INSERT INTO t VALUES (1);
+ DELETE FROM t;
+ SAVEPOINT s1;
+ INSERT INTO t VALUES (2);
+ DELETE FROM t;
+ ROLLBACK TRANSACTION TO s1;
+ COMMIT;
+ ]], {
+ -- <start-transaction-1.9>
+ 1, "keyword \"TRANSACTION\" is reserved"
+ -- <start-transaction-1.9>
+ })
+
+test:finish_test()
[-- Attachment #2: Type: text/html, Size: 9517 bytes --]
next prev parent reply other threads:[~2018-07-05 11:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-05 10:42 [tarantool-patches] " N.Tatunov
2018-07-05 11:48 ` Nikita Tatunov [this message]
2018-07-09 15:35 ` [tarantool-patches] " Alexander Turenko
2018-07-13 2:15 ` n.pettik
2018-07-16 12:22 ` Nikita Tatunov
2018-07-19 0:24 ` n.pettik
2018-07-19 11:48 ` Nikita Tatunov
2018-07-19 14:03 ` n.pettik
2018-07-19 15:44 ` Vladislav Shpilevoy
2018-07-19 18:08 ` Nikita Tatunov
2018-07-19 18:13 ` Vladislav Shpilevoy
2018-07-20 13:24 ` Kirill Yukhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAEi+_aos7hkcr+JaNwFK-0t=HfYfUUA7Cn+LnWwk9yyuBdCbnQ@mail.gmail.com' \
--to=hollow653@gmail.com \
--cc=alexander.turenko@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH] sql: Remove '\''BEGIN TRANSACTION'\''' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox