Uncomment the bind test

This commit is contained in:
Maas-Maarten Zeeman
2022-05-24 08:39:08 +02:00
parent 20ad5138a1
commit 8754c1c40b

View File

@@ -199,68 +199,67 @@ prepare2_test() ->
ok. ok.
%bind_test() -> bind_test() ->
% {ok, Db} = esqlite3:open(":memory:"), {ok, Db} = esqlite3:open(":memory:"),
%
% ok = esqlite3:exec("begin;", Db), ok = esqlite3:exec(Db, "begin;"),
% ok = esqlite3:exec("create table test_table(one varchar(10), two int);", Db), ok = esqlite3:exec(Db, "create table test_table(one varchar(10), two int);"),
% ok = esqlite3:exec("commit;", Db), ok = esqlite3:exec(Db, "commit;"),
%
% %% Create a prepared statement %% Create a prepared statement
% {ok, Statement} = esqlite3:prepare("insert into test_table values(?1, ?2)", Db), {ok, Statement} = esqlite3:prepare(Db, "insert into test_table values(?1, ?2)"),
%% esqlite3:bind(Statement, [one, 2]), esqlite3:bind(Statement, [one, 2]),
% esqlite3:step(Statement), esqlite3:step(Statement),
% esqlite3:bind(Statement, ["three", 4]), esqlite3:bind(Statement, ["three", 4]),
% esqlite3:step(Statement), esqlite3:step(Statement),
% esqlite3:bind(Statement, ["five", 6]), esqlite3:bind(Statement, ["five", 6]),
% esqlite3:step(Statement), esqlite3:step(Statement),
% esqlite3:bind(Statement, [[<<"se">>, $v, "en"], 8]), % iolist bound as text esqlite3:bind(Statement, [[<<"se">>, $v, "en"], 8]), % iolist bound as text
% esqlite3:step(Statement), esqlite3:step(Statement),
% esqlite3:bind(Statement, [<<"nine">>, 10]), % iolist bound as text esqlite3:bind(Statement, [<<"nine">>, 10]), % iolist bound as text
% esqlite3:step(Statement), esqlite3:step(Statement),
% esqlite3:bind(Statement, [{blob, [<<"eleven">>, 0]}, 12]), % iolist bound as blob with trailing eos. esqlite3:bind(Statement, [{blob, [<<"eleven">>, 0]}, 12]), % iolist bound as blob with trailing eos.
% esqlite3:step(Statement), esqlite3:step(Statement),
% esqlite3:bind(Statement, ["empty", undefined]), % 'undefined' is converted to SQL null esqlite3:bind(Statement, ["empty", undefined]), % 'undefined' is converted to SQL null
% esqlite3:step(Statement), esqlite3:step(Statement),
%% int64 %% int64
% esqlite3:bind(Statement, [int64, 308553449069486081]), esqlite3:bind(Statement, [int64, 308553449069486081]),
% esqlite3:step(Statement), esqlite3:step(Statement),
% %
%% negative int64 %% negative int64
% esqlite3:bind(Statement, [negative_int64, -308553449069486081]), esqlite3:bind(Statement, [negative_int64, -308553449069486081]),
% esqlite3:step(Statement), esqlite3:step(Statement),
%% utf-8 %% utf-8
% esqlite3:bind(Statement, [[<<228,184,138,230,181,183>>], 100]), esqlite3:bind(Statement, [[<<228,184,138,230,181,183>>], 100]),
% esqlite3:step(Statement), esqlite3:step(Statement),
% ?assertEqual([{<<"one">>, 2}], ?assertEqual([[<<"one">>, 2]],
% esqlite3:q("select one, two from test_table where two = '2'", Db)), esqlite3:q(Db, "select one, two from test_table where two = '2'")),
% ?assertEqual([{<<"three">>, 4}], ?assertEqual([[<<"three">>, 4]],
% esqlite3:q("select one, two from test_table where two = 4", Db)), esqlite3:q(Db, "select one, two from test_table where two = 4")),
% ?assertEqual([{<<"five">>, 6}], ?assertEqual([[<<"five">>, 6]],
% esqlite3:q("select one, two from test_table where two = 6", Db)), esqlite3:q(Db, "select one, two from test_table where two = 6")),
% ?assertEqual([{<<"seven">>, 8}], ?assertEqual([[<<"seven">>, 8]],
% esqlite3:q("select one, two from test_table where two = 8", Db)), esqlite3:q(Db, "select one, two from test_table where two = 8")),
% ?assertEqual([{<<"nine">>, 10}], ?assertEqual([[<<"nine">>, 10]],
% esqlite3:q("select one, two from test_table where two = 10", Db)), esqlite3:q(Db, "select one, two from test_table where two = 10")),
% ?assertEqual([{{blob, <<$e,$l,$e,$v,$e,$n,0>>}, 12}], ?assertEqual([[<<$e,$l,$e,$v,$e,$n,0>>, 12]],
% esqlite3:q("select one, two from test_table where two = 12", Db)), esqlite3:q(Db, "select one, two from test_table where two = 12")),
% ?assertEqual([{<<"empty">>, undefined}], ?assertEqual([[<<"empty">>, undefined]],
% esqlite3:q("select one, two from test_table where two is null", Db)), esqlite3:q(Db, "select one, two from test_table where two is null")),
% ?assertEqual([{<<"int64">>, 308553449069486081}], ?assertEqual([[<<"int64">>, 308553449069486081]],
% esqlite3:q("select one, two from test_table where one = 'int64';", Db)), esqlite3:q(Db, "select one, two from test_table where one = 'int64';")),
% ?assertEqual([{<<"negative_int64">>, -308553449069486081}], ?assertEqual([[<<"negative_int64">>, -308553449069486081]],
% esqlite3:q("select one, two from test_table where one = 'negative_int64';", Db)), esqlite3:q(Db, "select one, two from test_table where one = 'negative_int64';")),
%% utf-8 %% utf-8
% ?assertEqual([{<<228,184,138,230,181,183>>, 100}], ?assertEqual([[<<228,184,138,230,181,183>>, 100]],
% esqlite3:q("select one, two from test_table where two = 100", Db)), esqlite3:q(Db, "select one, two from test_table where two = 100")),
%
% ok. ok.
bind_for_queries_test() -> bind_for_queries_test() ->
{ok, Db} = esqlite3:open(":memory:"), {ok, Db} = esqlite3:open(":memory:"),