4
%% Copyright Ericsson AB 2002-2011. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
22
-module(odbc_query_SUITE).
24
%% Note: This directive should only be used in test suites.
27
-include_lib("common_test/include/ct.hrl").
28
-include("test_server_line.hrl").
29
-include("odbc_test.hrl").
31
%%--------------------------------------------------------------------
32
%% all(Arg) -> [Doc] | [Case] | {skip, Comment}
36
%% Name of a test case function.
38
%% Description: Returns documentation/test cases in this test suite
39
%% or a skip tuple if the platform is not supported.
40
%%--------------------------------------------------------------------
41
suite() -> [{ct_hooks,[ts_install_cth]}].
44
case odbc_test_lib:odbc_check() of
46
[sql_query, first, last, next, prev, select_count,
47
select_next, select_relative, select_absolute,
48
create_table_twice, delete_table_twice, duplicate_key,
49
not_connection_owner, no_result_set, query_error,
50
multiple_select_result_sets, multiple_mix_result_sets,
51
multiple_result_sets_error,
52
{group, parameterized_queries}, {group, describe_table},
53
delete_nonexisting_row];
54
Other -> {skip, Other}
58
[{parameterized_queries, [],
59
[{group, param_integers}, param_insert_decimal,
60
param_insert_numeric, {group, param_insert_string},
61
param_insert_float, param_insert_real,
62
param_insert_double, param_insert_mix, param_update,
63
param_delete, param_select]},
65
[param_insert_tiny_int, param_insert_small_int,
66
param_insert_int, param_insert_integer]},
67
{param_insert_string, [],
68
[param_insert_char, param_insert_character,
69
param_insert_char_varying,
70
param_insert_character_varying]},
72
[describe_integer, describe_string, describe_floating,
73
describe_dec_num, describe_no_such_table]}].
75
init_per_group(_GroupName, Config) ->
78
end_per_group(_GroupName, Config) ->
84
%%--------------------------------------------------------------------
85
%% Function: init_per_suite(Config) -> Config
87
%% A list of key/value pairs, holding the test case configuration.
88
%% Description: Initiation before the whole suite
90
%% Note: This function is free to add any key/value pairs to the Config
91
%% variable, but should NOT alter/remove any existing entries.
92
%%--------------------------------------------------------------------
93
init_per_suite(Config) when is_list(Config) ->
94
application:start(odbc),
95
[{tableName, odbc_test_lib:unique_table_name()}| Config].
97
%%--------------------------------------------------------------------
98
%% Function: end_per_suite(Config) -> _
100
%% A list of key/value pairs, holding the test case configuration.
101
%% Description: Cleanup after the whole suite
102
%%--------------------------------------------------------------------
103
end_per_suite(_Config) ->
104
application:stop(odbc),
107
%%--------------------------------------------------------------------
108
%% Function: init_per_testcase(Case, Config) -> Config
110
%% Name of the test case that is about to be run.
111
%% Config - [tuple()]
112
%% A list of key/value pairs, holding the test case configuration.
114
%% Description: Initiation before each test case
116
%% Note: This function is free to add any key/value pairs to the Config
117
%% variable, but should NOT alter/remove any existing entries.
118
%%--------------------------------------------------------------------
119
init_per_testcase(_Case, Config) ->
120
{ok, Ref} = odbc:connect(?RDBMS:connection_string(), []),
121
Dog = test_server:timetrap(?default_timeout),
122
Temp = lists:keydelete(connection_ref, 1, Config),
123
NewConfig = lists:keydelete(watchdog, 1, Temp),
124
[{watchdog, Dog}, {connection_ref, Ref} | NewConfig].
126
%%--------------------------------------------------------------------
127
%% Function: end_per_testcase(Case, Config) -> _
129
%% Name of the test case that is about to be run.
130
%% Config - [tuple()]
131
%% A list of key/value pairs, holding the test case configuration.
132
%% Description: Cleanup after each test case
133
%%--------------------------------------------------------------------
134
end_per_testcase(_Case, Config) ->
135
Ref = ?config(connection_ref, Config),
136
ok = odbc:disconnect(Ref),
137
%% Clean up if needed
138
Table = ?config(tableName, Config),
139
{ok, NewRef} = odbc:connect(?RDBMS:connection_string(), []),
140
odbc:sql_query(NewRef, "DROP TABLE " ++ Table),
141
odbc:disconnect(NewRef),
142
Dog = ?config(watchdog, Config),
143
test_server:timetrap_cancel(Dog),
146
%%-------------------------------------------------------------------------
147
%% Test cases starts here.
148
%%-------------------------------------------------------------------------
150
["Test the common cases"];
151
sql_query(suite) -> [];
152
sql_query(Config) when is_list(Config) ->
153
Ref = ?config(connection_ref, Config),
154
Table = ?config(tableName, Config),
158
"CREATE TABLE " ++ Table ++
159
" (ID integer, DATA varchar(10))"),
162
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++ " VALUES(1,'bar')"),
164
true = odbc_test_lib:check_row_count(1, Count),
166
InsertResult = ?RDBMS:insert_result(),
168
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
170
{updated, NewCount} =
171
odbc:sql_query(Ref, "UPDATE " ++ Table ++
172
" SET DATA = 'foo' WHERE ID = 1"),
174
true = odbc_test_lib:check_row_count(1, NewCount),
176
UpdateResult = ?RDBMS:update_result(),
178
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
180
{updated, NewCount1} = odbc:sql_query(Ref, "DELETE FROM " ++ Table ++
183
true = odbc_test_lib:check_row_count(1, NewCount1),
185
{selected, Fields, []} =
186
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
188
["ID","DATA"] = odbc_test_lib:to_upper(Fields),
191
%%-------------------------------------------------------------------------
193
["Tests select_count/[2,3]'s timeout, "
194
" select_count's functionality will be better tested by other tests "
196
select_count(sute) -> [];
197
select_count(Config) when is_list(Config) ->
198
Ref = ?config(connection_ref, Config),
199
Table = ?config(tableName, Config),
201
{updated, _} = odbc:sql_query(Ref,
202
"CREATE TABLE " ++ Table ++
205
{updated, Count} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
207
true = odbc_test_lib:check_row_count(1, Count),
209
odbc:select_count(Ref, "SELECT * FROM " ++ Table, ?TIMEOUT),
210
{'EXIT', {function_clause, _}} =
211
(catch odbc:select_count(Ref, "SELECT * FROM ", -1)),
213
%%-------------------------------------------------------------------------
215
["Tests first/[1,2]"];
217
first(Config) when is_list(Config) ->
218
Ref = ?config(connection_ref, Config),
219
Table = ?config(tableName, Config),
221
{updated, _} = odbc:sql_query(Ref,
222
"CREATE TABLE " ++ Table ++
225
{updated, Count} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
227
true = odbc_test_lib:check_row_count(1, Count),
228
{updated, NewCount} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
230
true = odbc_test_lib:check_row_count(1, NewCount),
231
{ok, _} = odbc:select_count(Ref, "SELECT * FROM " ++ Table),
234
FirstResult = ?RDBMS:selected_ID(1, first),
235
FirstResult = odbc:first(Ref),
236
FirstResult = odbc:first(Ref, ?TIMEOUT),
237
{'EXIT', {function_clause, _}} = (catch odbc:first(Ref, -1)),
240
%%-------------------------------------------------------------------------
242
["Tests last/[1,2]"];
244
last(Config) when is_list(Config) ->
245
Ref = ?config(connection_ref, Config),
246
Table = ?config(tableName, Config),
248
{updated, _} = odbc:sql_query(Ref,
249
"CREATE TABLE " ++ Table ++
252
{updated, Count} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
254
true = odbc_test_lib:check_row_count(1, Count),
255
{updated, NewCount} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
257
true = odbc_test_lib:check_row_count(1, NewCount),
258
{ok, _} = odbc:select_count(Ref, "SELECT * FROM " ++ Table),
260
LastResult = ?RDBMS:selected_ID(2, last),
261
LastResult = odbc:last(Ref),
263
LastResult = odbc:last(Ref, ?TIMEOUT),
264
{'EXIT', {function_clause, _}} = (catch odbc:last(Ref, -1)),
267
%%-------------------------------------------------------------------------
269
["Tests next/[1,2]"];
271
next(Config) when is_list(Config) ->
272
Ref = ?config(connection_ref, Config),
273
Table = ?config(tableName, Config),
275
{updated, _} = odbc:sql_query(Ref,
276
"CREATE TABLE " ++ Table ++
279
{updated, Count} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
281
true = odbc_test_lib:check_row_count(1, Count),
282
{updated, NewCount} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
284
true = odbc_test_lib:check_row_count(1, NewCount),
285
{ok, _} = odbc:select_count(Ref, "SELECT * FROM " ++ Table),
287
NextResult = ?RDBMS:selected_ID(1, next),
288
NextResult = odbc:next(Ref),
289
NextResult2 = ?RDBMS:selected_ID(2, next),
290
NextResult2 = odbc:next(Ref, ?TIMEOUT),
291
{'EXIT', {function_clause, _}} = (catch odbc:next(Ref, -1)),
293
%%-------------------------------------------------------------------------
295
["Tests prev/[1,2]"];
297
prev(Config) when is_list(Config) ->
298
Ref = ?config(connection_ref, Config),
299
Table = ?config(tableName, Config),
301
{updated, _} = odbc:sql_query(Ref,
302
"CREATE TABLE " ++ Table ++
305
{updated, Count} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
307
true = odbc_test_lib:check_row_count(1, Count),
308
{updated, NewCount} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
310
true = odbc_test_lib:check_row_count(1, NewCount),
312
{ok, _} = odbc:select_count(Ref, "SELECT * FROM " ++ Table),
314
odbc:last(Ref), % Position cursor last so there will be a prev
315
PrevResult = ?RDBMS:selected_ID(1, prev),
316
PrevResult = odbc:prev(Ref),
318
odbc:last(Ref), % Position cursor last so there will be a prev
319
PrevResult = odbc:prev(Ref, ?TIMEOUT),
320
{'EXIT', {function_clause, _}} = (catch odbc:prev(Ref, -1)),
322
%%-------------------------------------------------------------------------
324
["Tests select/[4,5] with CursorRelation = next "];
325
select_next(suit) -> [];
326
select_next(Config) when is_list(Config) ->
327
Ref = ?config(connection_ref, Config),
328
Table = ?config(tableName, Config),
330
{updated, _} = odbc:sql_query(Ref,
331
"CREATE TABLE " ++ Table ++
334
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
336
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
338
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
340
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
342
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
345
{ok, _} = odbc:select_count(Ref, "SELECT * FROM " ++ Table),
347
SelectResult1 = ?RDBMS:selected_next_N(1),
348
SelectResult1 = odbc:select(Ref, next, 3),
350
%% Test that selecting stops at the end of the result set
351
SelectResult2 = ?RDBMS:selected_next_N(2),
352
SelectResult2 = odbc:select(Ref, next, 3, ?TIMEOUT),
353
{'EXIT',{function_clause, _}} =
354
(catch odbc:select(Ref, next, 2, -1)),
356
%% If you try fetching data beyond the the end of result set,
357
%% you get an empty list.
358
{selected, Fields, []} = odbc:select(Ref, next, 1),
360
["ID"] = odbc_test_lib:to_upper(Fields),
363
%%-------------------------------------------------------------------------
364
select_relative(doc) ->
365
["Tests select/[4,5] with CursorRelation = relative "];
366
select_relative(suit) -> [];
367
select_relative(Config) when is_list(Config) ->
368
Ref = ?config(connection_ref, Config),
369
Table = ?config(tableName, Config),
371
{updated, _} = odbc:sql_query(Ref,
372
"CREATE TABLE " ++ Table ++
375
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
377
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
379
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
381
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
383
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
385
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
387
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
389
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
392
{ok, _} = odbc:select_count(Ref, "SELECT * FROM " ++ Table),
394
SelectResult1 = ?RDBMS:selected_relative_N(1),
395
SelectResult1 = odbc:select(Ref, {relative, 2}, 3),
397
%% Test that selecting stops at the end of the result set
398
SelectResult2 = ?RDBMS:selected_relative_N(2),
399
SelectResult2 = odbc:select(Ref, {relative, 3}, 3, ?TIMEOUT),
400
{'EXIT',{function_clause, _}} =
401
(catch odbc:select(Ref, {relative, 3} , 2, -1)),
404
%%-------------------------------------------------------------------------
405
select_absolute(doc) ->
406
["Tests select/[4,5] with CursorRelation = absolute "];
407
select_absolute(suit) -> [];
408
select_absolute(Config) when is_list(Config) ->
409
Ref = ?config(connection_ref, Config),
410
Table = ?config(tableName, Config),
412
{updated, _} = odbc:sql_query(Ref,
413
"CREATE TABLE " ++ Table ++
416
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
418
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
420
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
422
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
424
{updated, 1} = odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
426
{ok, _} = odbc:select_count(Ref, "SELECT * FROM " ++ Table),
428
SelectResult1 = ?RDBMS:selected_absolute_N(1),
429
SelectResult1 = odbc:select(Ref, {absolute, 1}, 3),
431
%% Test that selecting stops at the end of the result set
432
SelectResult2 = ?RDBMS:selected_absolute_N(2),
433
SelectResult2 = odbc:select(Ref, {absolute, 1}, 6, ?TIMEOUT),
434
{'EXIT',{function_clause, _}} =
435
(catch odbc:select(Ref, {absolute, 1}, 2, -1)),
438
%%-------------------------------------------------------------------------
439
create_table_twice(doc) ->
440
["Test what happens if you try to create the same table twice."];
441
create_table_twice(suite) -> [];
442
create_table_twice(Config) when is_list(Config) ->
443
Ref = ?config(connection_ref, Config),
444
Table = ?config(tableName, Config),
448
"CREATE TABLE " ++ Table ++
449
" (ID integer, DATA varchar(10))"),
452
"CREATE TABLE " ++ Table ++
453
" (ID integer, DATA varchar(10))"),
454
is_driver_error(Error),
457
%%-------------------------------------------------------------------------
458
delete_table_twice(doc) ->
459
["Test what happens if you try to delete the same table twice."];
460
delete_table_twice(suite) -> [];
461
delete_table_twice(Config) when is_list(Config) ->
462
Ref = ?config(connection_ref, Config),
463
Table = ?config(tableName, Config),
467
"CREATE TABLE " ++ Table ++
468
" (ID integer, DATA varchar(10))"),
469
{updated, _} = odbc:sql_query(Ref, "DROP TABLE " ++ Table),
470
{error, Error} = odbc:sql_query(Ref, "DROP TABLE " ++ Table),
471
is_driver_error(Error),
474
%-------------------------------------------------------------------------
475
duplicate_key(doc) ->
476
["Test what happens if you try to use the same key twice"];
477
duplicate_key(suit) -> [];
478
duplicate_key(Config) when is_list(Config) ->
479
Ref = ?config(connection_ref, Config),
480
Table = ?config(tableName, Config),
484
"CREATE TABLE " ++ Table ++
485
" (ID integer, DATA char(10), PRIMARY KEY(ID))"),
488
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++ " VALUES(1,'bar')"),
491
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++ " VALUES(1,'foo')"),
492
is_driver_error(Error),
495
%%-------------------------------------------------------------------------
496
not_connection_owner(doc) ->
497
["Test what happens if a process that did not start the connection"
498
" tries to acess it."];
499
not_connection_owner(suite) -> [];
500
not_connection_owner(Config) when is_list(Config) ->
501
Ref = ?config(connection_ref, Config),
502
Table = ?config(tableName, Config),
504
spawn_link(?MODULE, not_owner, [self(), Ref, Table]),
511
not_owner(Pid, Ref, Table) ->
512
{error, process_not_owner_of_odbc_connection} =
513
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++ " (ID integer)"),
515
{error, process_not_owner_of_odbc_connection} =
516
odbc:disconnect(Ref),
520
%%-------------------------------------------------------------------------
521
no_result_set(doc) ->
522
["Tests what happens if you try to use a function that needs an "
523
"associated result set when there is none."];
524
no_result_set(suite) -> [];
525
no_result_set(Config) when is_list(Config) ->
526
Ref = ?config(connection_ref, Config),
528
{error, result_set_does_not_exist} = odbc:first(Ref),
529
{error, result_set_does_not_exist} = odbc:last(Ref),
530
{error, result_set_does_not_exist} = odbc:next(Ref),
531
{error, result_set_does_not_exist} = odbc:prev(Ref),
532
{error, result_set_does_not_exist} = odbc:select(Ref, next, 1),
533
{error, result_set_does_not_exist} =
534
odbc:select(Ref, {absolute, 2}, 1),
535
{error, result_set_does_not_exist} =
536
odbc:select(Ref, {relative, 2}, 1),
538
%%-------------------------------------------------------------------------
540
["Test what happens if there is an error in the query."];
541
query_error(suite) ->
543
query_error(Config) when is_list(Config) ->
544
Ref = ?config(connection_ref, Config),
545
Table = ?config(tableName, Config),
549
"CREATE TABLE " ++ Table ++
550
" (ID integer, DATA char(10), PRIMARY KEY(ID))"),
552
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++ " VALUES(1,'bar')"),
555
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++ " VALUES(1,'bar')"),
558
odbc:sql_query(Ref, "INSERT ONTO " ++ Table ++ " VALUES(1,'bar')"),
561
%%-------------------------------------------------------------------------
562
multiple_select_result_sets(doc) ->
563
["Test what happens if you have a batch of select queries."];
564
multiple_select_result_sets(suite) ->
566
multiple_select_result_sets(Config) when is_list(Config) ->
569
Ref = ?config(connection_ref, Config),
570
Table = ?config(tableName, Config),
574
"CREATE TABLE " ++ Table ++
575
" (ID integer, DATA varchar(10), "
578
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
582
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
583
" VALUES(2, 'foo')"),
585
MultipleResult = ?RDBMS:multiple_select(),
588
odbc:sql_query(Ref, "SELECT * FROM " ++ Table ++
589
"; SELECT DATA FROM "++ Table ++
593
{skip, "multiple result_set not supported"}
596
%%-------------------------------------------------------------------------
597
multiple_mix_result_sets(doc) ->
598
["Test what happens if you have a batch of select and other type of"
600
multiple_mix_result_sets(suite) ->
602
multiple_mix_result_sets(Config) when is_list(Config) ->
605
Ref = ?config(connection_ref, Config),
606
Table = ?config(tableName, Config),
610
"CREATE TABLE " ++ Table ++
611
" (ID integer, DATA varchar(10), "
614
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
617
MultipleResult = ?RDBMS:multiple_mix(),
620
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
621
" VALUES(2,'foo'); UPDATE " ++ Table ++
622
" SET DATA = 'foobar' WHERE ID =1;SELECT "
624
++ Table ++ ";DELETE FROM " ++ Table ++
625
" WHERE ID =1; SELECT DATA FROM " ++ Table),
628
{skip, "multiple result_set not supported"}
630
%%-------------------------------------------------------------------------
631
multiple_result_sets_error(doc) ->
632
["Test what happens if one of the batched queries fails."];
633
multiple_result_sets_error(suite) ->
635
multiple_result_sets_error(Config) when is_list(Config) ->
638
Ref = ?config(connection_ref, Config),
639
Table = ?config(tableName, Config),
643
"CREATE TABLE " ++ Table ++
644
" (ID integer, DATA varchar(10), "
647
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
651
odbc:sql_query(Ref, "INSERT INTO " ++ Table ++
652
" VALUES(1,'foo'); SELECT * FROM " ++ Table),
653
is_driver_error(Error),
656
odbc:sql_query(Ref, "SELECT * FROM "
657
++ Table ++ ";INSERT INTO " ++ Table ++
659
is_driver_error(NewError),
662
{skip, "multiple result_set not supported"}
665
%%-------------------------------------------------------------------------
667
%%-------------------------------------------------------------------------
668
%%-------------------------------------------------------------------------
669
param_insert_tiny_int(doc)->
670
["Test insertion of tiny ints by parameterized queries."];
671
param_insert_tiny_int(suite) ->
673
param_insert_tiny_int(Config) when is_list(Config) ->
676
Ref = ?config(connection_ref, Config),
677
Table = ?config(tableName, Config),
681
"CREATE TABLE " ++ Table ++
685
odbc:param_query(Ref, "INSERT INTO " ++ Table ++
687
[{sql_tinyint, [1, 2]}],
688
?TIMEOUT),%Make sure to test timeout clause
690
true = odbc_test_lib:check_row_count(2, Count),
692
InsertResult = ?RDBMS:param_select_tiny_int(),
695
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
697
{'EXIT',{badarg,odbc,param_query,'Params'}} =
698
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
700
[{sql_tinyint, [1, "2"]}])),
703
{skip, "Type tiniyint not supported"}
705
%%-------------------------------------------------------------------------
706
param_insert_small_int(doc)->
707
["Test insertion of small ints by parameterized queries."];
708
param_insert_small_int(suite) ->
710
param_insert_small_int(Config) when is_list(Config) ->
711
Ref = ?config(connection_ref, Config),
712
Table = ?config(tableName, Config),
716
"CREATE TABLE " ++ Table ++
717
" (FIELD SMALLINT)"),
720
odbc:param_query(Ref, "INSERT INTO " ++ Table ++
721
"(FIELD) VALUES(?)", [{sql_smallint, [1, 2]}],
722
?TIMEOUT), %% Make sure to test timeout clause
724
true = odbc_test_lib:check_row_count(2, Count),
726
InsertResult = ?RDBMS:param_select_small_int(),
729
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
731
{'EXIT',{badarg,odbc,param_query,'Params'}} =
732
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
734
[{sql_smallint, [1, "2"]}])),
737
%%-------------------------------------------------------------------------
738
param_insert_int(doc)->
739
["Test insertion of ints by parameterized queries."];
740
param_insert_int(suite) ->
742
param_insert_int(Config) when is_list(Config) ->
743
Ref = ?config(connection_ref, Config),
744
Table = ?config(tableName, Config),
748
"CREATE TABLE " ++ Table ++
751
Int = ?RDBMS:small_int_max() + 1,
753
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
755
[{sql_integer, [1, Int]}]),
756
true = odbc_test_lib:check_row_count(2, Count),
758
InsertResult = ?RDBMS:param_select_int(),
761
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
763
{'EXIT',{badarg,odbc,param_query,'Params'}} =
764
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
766
[{sql_integer, [1, "2"]}])),
769
%%-------------------------------------------------------------------------
770
param_insert_integer(doc)->
771
["Test insertion of integers by parameterized queries."];
772
param_insert_integer(suite) ->
774
param_insert_integer(Config) when is_list(Config) ->
775
Ref = ?config(connection_ref, Config),
776
Table = ?config(tableName, Config),
780
"CREATE TABLE " ++ Table ++
783
Int = ?RDBMS:small_int_max() + 1,
785
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
787
[{sql_integer, [1, Int]}]),
788
true = odbc_test_lib:check_row_count(2, Count),
790
InsertResult = ?RDBMS:param_select_int(),
793
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
795
{'EXIT',{badarg,odbc,param_query,'Params'}} =
796
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
798
[{sql_integer, [1, 2.3]}])),
801
%%-------------------------------------------------------------------------
802
param_insert_decimal(doc)->
803
["Test insertion of decimal numbers by parameterized queries."];
804
param_insert_decimal(suite) ->
806
param_insert_decimal(Config) when is_list(Config) ->
807
Ref = ?config(connection_ref, Config),
808
Table = ?config(tableName, Config),
812
"CREATE TABLE " ++ Table ++
813
" (FIELD DECIMAL (3,0))"),
815
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
817
[{{sql_decimal, 3, 0}, [1, 2]}]),
818
true = odbc_test_lib:check_row_count(2, Count),
820
InsertResult = ?RDBMS:param_select_decimal(),
823
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
825
{'EXIT',{badarg,odbc,param_query,'Params'}} =
826
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
828
[{{sql_decimal, 3, 0}, [1, "2"]}])),
831
odbc:sql_query(Ref, "DROP TABLE " ++ Table),
835
"CREATE TABLE " ++ Table ++
836
" (FIELD DECIMAL (3,1))"),
838
{updated, NewCount} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
840
[{{sql_decimal, 3, 1}, [0.25]}]),
841
true = odbc_test_lib:check_row_count(1, NewCount),
843
{selected, Fields, [{Value}]} =
844
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
846
["FIELD"] = odbc_test_lib:to_upper(Fields),
848
odbc_test_lib:match_float(Value, 0.3, 0.01),
852
%%-------------------------------------------------------------------------
853
param_insert_numeric(doc)->
854
["Test insertion of numeric numbers by parameterized queries."];
855
param_insert_numeric(suite) ->
857
param_insert_numeric(Config) when is_list(Config) ->
858
Ref = ?config(connection_ref, Config),
859
Table = ?config(tableName, Config),
863
"CREATE TABLE " ++ Table ++
864
" (FIELD NUMERIC (3,0))"),
866
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
868
[{{sql_numeric,3,0}, [1, 2]}]),
870
true = odbc_test_lib:check_row_count(2, Count),
872
InsertResult = ?RDBMS:param_select_numeric(),
875
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
877
{'EXIT',{badarg,odbc,param_query,'Params'}} =
878
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
880
[{{sql_decimal, 3, 0}, [1, "2"]}])),
882
odbc:sql_query(Ref, "DROP TABLE " ++ Table),
886
"CREATE TABLE " ++ Table ++
887
" (FIELD NUMERIC (3,1))"),
889
{updated, NewCount} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
891
[{{sql_numeric, 3, 1}, [0.25]}]),
893
true = odbc_test_lib:check_row_count(1, NewCount),
895
{selected, Fileds, [{Value}]} =
896
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
898
["FIELD"] = odbc_test_lib:to_upper(Fileds),
900
odbc_test_lib:match_float(Value, 0.3, 0.01),
903
%%-------------------------------------------------------------------------
905
%%-------------------------------------------------------------------------
906
param_insert_char(doc)->
907
["Test insertion of fixed length string by parameterized queries."];
908
param_insert_char(suite) ->
910
param_insert_char(Config) when is_list(Config) ->
911
Ref = ?config(connection_ref, Config),
912
Table = ?config(tableName, Config),
916
"CREATE TABLE " ++ Table ++
917
" (FIELD CHAR (10))"),
919
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
922
["foofoofoof", "0123456789"]}]),
923
true = odbc_test_lib:check_row_count(2, Count),
925
{selected,Fileds,[{"foofoofoof"}, {"0123456789"}]} =
926
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
928
["FIELD"] = odbc_test_lib:to_upper(Fileds),
930
{error, _} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
933
["foo", "01234567890"]}]),
935
{'EXIT',{badarg,odbc,param_query,'Params'}} =
936
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
938
[{{sql_char, 10}, ["1", 2.3]}])),
941
%%-------------------------------------------------------------------------
942
param_insert_character(doc)->
943
["Test insertion of fixed length string by parameterized queries."];
944
param_insert_character(suite) ->
946
param_insert_character(Config) when is_list(Config) ->
947
Ref = ?config(connection_ref, Config),
948
Table = ?config(tableName, Config),
952
"CREATE TABLE " ++ Table ++
953
" (FIELD CHARACTER (10))"),
955
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
958
["foofoofoof", "0123456789"]}]),
960
true = odbc_test_lib:check_row_count(2, Count),
962
{selected, Fileds, [{"foofoofoof"}, {"0123456789"}]} =
963
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
965
["FIELD"] = odbc_test_lib:to_upper(Fileds),
967
{error, _} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
970
["foo", "01234567890"]}]),
972
{'EXIT',{badarg,odbc,param_query,'Params'}} =
973
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
975
[{{sql_char, 10}, ["1", 2]}])),
978
%%------------------------------------------------------------------------
979
param_insert_char_varying(doc)->
980
["Test insertion of variable length strings by parameterized queries."];
981
param_insert_char_varying(suite) ->
983
param_insert_char_varying(Config) when is_list(Config) ->
984
Ref = ?config(connection_ref, Config),
985
Table = ?config(tableName, Config),
989
"CREATE TABLE " ++ Table ++
990
" (FIELD CHAR VARYING(10))"),
992
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
995
["foo", "0123456789"]}]),
997
true = odbc_test_lib:check_row_count(2, Count),
999
{selected, Fileds, [{"foo"}, {"0123456789"}]} =
1000
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1002
["FIELD"] = odbc_test_lib:to_upper(Fileds),
1004
{error, _} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1005
"(FIELD) VALUES(?)",
1006
[{{sql_varchar, 10},
1007
["foo", "01234567890"]}]),
1009
{'EXIT',{badarg,odbc,param_query,'Params'}} =
1010
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1011
"(FIELD) VALUES(?)",
1012
[{{sql_varchar, 10}, ["1", 2.3]}])),
1015
%%-------------------------------------------------------------------------
1016
param_insert_character_varying(doc)->
1017
["Test insertion of variable length strings by parameterized queries."];
1018
param_insert_character_varying(suite) ->
1020
param_insert_character_varying(Config) when is_list(Config) ->
1021
Ref = ?config(connection_ref, Config),
1022
Table = ?config(tableName, Config),
1026
"CREATE TABLE " ++ Table ++
1027
" (FIELD CHARACTER VARYING(10))"),
1030
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1031
"(FIELD) VALUES(?)",
1032
[{{sql_varchar, 10},
1033
["foo", "0123456789"]}]),
1035
true = odbc_test_lib:check_row_count(2, Count),
1037
{selected, Fileds, [{"foo"}, {"0123456789"}]} =
1038
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1040
["FIELD"] = odbc_test_lib:to_upper(Fileds),
1042
{error, _} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1043
"(FIELD) VALUES(?)",
1044
[{{sql_varchar, 10},
1045
["foo", "01234567890"]}]),
1047
{'EXIT',{badarg,odbc,param_query,'Params'}} =
1048
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1049
"(FIELD) VALUES(?)",
1050
[{{sql_varchar, 10}, ["1", 2]}])),
1052
%%-------------------------------------------------------------------------
1053
param_insert_float(doc)->
1054
["Test insertion of floats by parameterized queries."];
1055
param_insert_float(suite) ->
1057
param_insert_float(Config) when is_list(Config) ->
1058
Ref = ?config(connection_ref, Config),
1059
Table = ?config(tableName, Config),
1063
"CREATE TABLE " ++ Table ++
1064
" (FIELD FLOAT(5))"),
1066
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1067
"(FIELD) VALUES(?)",
1068
[{{sql_float,5}, [1.3, 1.2]}]),
1070
true = odbc_test_lib:check_row_count(2, Count),
1072
{selected, Fileds, [{Float1},{Float2}]} =
1073
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1075
["FIELD"] = odbc_test_lib:to_upper(Fileds),
1077
case (odbc_test_lib:match_float(Float1, 1.3, 0.000001) and
1078
odbc_test_lib:match_float(Float2, 1.2, 0.000001)) of
1082
test_server:fail(float_numbers_do_not_match)
1085
{'EXIT',{badarg,odbc,param_query,'Params'}} =
1086
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1087
"(FIELD) VALUES(?)",
1088
[{{sql_float, 5}, [1.0, "2"]}])),
1091
%%-------------------------------------------------------------------------
1092
param_insert_real(doc)->
1093
["Test insertion of real numbers by parameterized queries."];
1094
param_insert_real(suite) ->
1096
param_insert_real(Config) when is_list(Config) ->
1097
Ref = ?config(connection_ref, Config),
1098
Table = ?config(tableName, Config),
1102
"CREATE TABLE " ++ Table ++
1105
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1106
"(FIELD) VALUES(?)",
1107
[{sql_real, [1.3, 1.2]}]),
1109
true = odbc_test_lib:check_row_count(2, Count),
1111
%_InsertResult = ?RDBMS:param_select_real(),
1113
{selected, Fileds, [{Real1},{Real2}]} =
1114
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1116
["FIELD"] = odbc_test_lib:to_upper(Fileds),
1118
case (odbc_test_lib:match_float(Real1, 1.3, 0.000001) and
1119
odbc_test_lib:match_float(Real2, 1.2, 0.000001)) of
1123
test_server:fail(real_numbers_do_not_match)
1126
{'EXIT',{badarg,odbc,param_query,'Params'}} =
1127
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1128
"(FIELD) VALUES(?)",
1129
[{sql_real,[1.0, "2"]}])),
1132
%%-------------------------------------------------------------------------
1133
param_insert_double(doc)->
1134
["Test insertion of doubles by parameterized queries."];
1135
param_insert_double(suite) ->
1137
param_insert_double(Config) when is_list(Config) ->
1138
Ref = ?config(connection_ref, Config),
1139
Table = ?config(tableName, Config),
1143
"CREATE TABLE " ++ Table ++
1144
" (FIELD DOUBLE PRECISION)"),
1146
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1147
"(FIELD) VALUES(?)",
1148
[{sql_double, [1.3, 1.2]}]),
1150
true = odbc_test_lib:check_row_count(2, Count),
1152
{selected, Fileds, [{Double1},{Double2}]} =
1153
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1155
["FIELD"] = odbc_test_lib:to_upper(Fileds),
1157
case (odbc_test_lib:match_float(Double1, 1.3, 0.000001) and
1158
odbc_test_lib:match_float(Double2, 1.2, 0.000001)) of
1162
test_server:fail(double_numbers_do_not_match)
1165
{'EXIT',{badarg,odbc,param_query,'Params'}} =
1166
(catch odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1167
"(FIELD) VALUES(?)",
1168
[{sql_double, [1.0, "2"]}])),
1171
%%-------------------------------------------------------------------------
1172
param_insert_mix(doc)->
1173
["Test insertion of a mixture of datatypes by parameterized queries."];
1174
param_insert_mix(suite) ->
1176
param_insert_mix(Config) when is_list(Config) ->
1177
Ref = ?config(connection_ref, Config),
1178
Table = ?config(tableName, Config),
1182
"CREATE TABLE " ++ Table ++
1183
" (ID INTEGER, DATA CHARACTER VARYING(10),"
1184
" PRIMARY KEY(ID))"),
1186
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1187
"(ID, DATA) VALUES(?, ?)",
1188
[{sql_integer, [1, 2]},
1189
{{sql_varchar, 10}, ["foo", "bar"]}]),
1191
true = odbc_test_lib:check_row_count(2, Count),
1193
InsertResult = ?RDBMS:param_select_mix(),
1196
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1198
%%-------------------------------------------------------------------------
1200
["Test parameterized update query."];
1201
param_update(suite) ->
1203
param_update(Config) when is_list(Config) ->
1204
Ref = ?config(connection_ref, Config),
1205
Table = ?config(tableName, Config),
1209
"CREATE TABLE " ++ Table ++
1210
" (ID INTEGER, DATA CHARACTER VARYING(10),"
1211
" PRIMARY KEY(ID))"),
1213
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1214
"(ID, DATA) VALUES(?, ?)",
1215
[{sql_integer, [1, 2, 3]},
1217
["foo", "bar", "baz"]}]),
1219
true = odbc_test_lib:check_row_count(3, Count),
1221
{updated, NewCount} = odbc:param_query(Ref, "UPDATE " ++ Table ++
1222
" SET DATA = 'foobar' WHERE ID = ?",
1223
[{sql_integer, [1, 2]}]),
1225
true = odbc_test_lib:check_row_count(2, NewCount),
1227
UpdateResult = ?RDBMS:param_update(),
1230
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1233
%%-------------------------------------------------------------------------
1234
delete_nonexisting_row(doc) -> % OTP-5759
1235
["Make a delete...where with false conditions (0 rows deleted). ",
1236
"This used to give an error message (see ticket OTP-5759)."];
1237
delete_nonexisting_row(Config) when is_list(Config) ->
1238
Ref = ?config(connection_ref, Config),
1239
Table = ?config(tableName, Config),
1242
odbc:sql_query(Ref, "CREATE TABLE " ++ Table
1243
++ " (ID INTEGER, DATA CHARACTER VARYING(10))"),
1245
odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1246
"(ID, DATA) VALUES(?, ?)",
1247
[{sql_integer, [1, 2, 3]},
1248
{{sql_varchar, 10}, ["foo", "bar", "baz"]}]),
1250
true = odbc_test_lib:check_row_count(3, Count),
1252
{updated, NewCount} =
1253
odbc:sql_query(Ref, "DELETE FROM " ++ Table ++ " WHERE ID = 8"),
1255
true = odbc_test_lib:check_row_count(0, NewCount),
1258
odbc:sql_query(Ref, "DROP TABLE "++ Table),
1262
%%-------------------------------------------------------------------------
1263
param_delete(doc) ->
1264
["Test parameterized delete query."];
1265
param_delete(suite) ->
1267
param_delete(Config) when is_list(Config) ->
1268
Ref = ?config(connection_ref, Config),
1269
Table = ?config(tableName, Config),
1273
"CREATE TABLE " ++ Table ++
1274
" (ID INTEGER, DATA CHARACTER VARYING(10),"
1275
" PRIMARY KEY(ID))"),
1277
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1278
"(ID, DATA) VALUES(?, ?)",
1279
[{sql_integer, [1, 2, 3]},
1281
["foo", "bar", "baz"]}]),
1282
true = odbc_test_lib:check_row_count(3, Count),
1284
{updated, NewCount} = odbc:param_query(Ref, "DELETE FROM " ++ Table ++
1286
[{sql_integer, [1, 2]}]),
1288
true = odbc_test_lib:check_row_count(2, NewCount),
1290
UpdateResult = ?RDBMS:param_delete(),
1293
odbc:sql_query(Ref, "SELECT * FROM " ++ Table),
1297
%%-------------------------------------------------------------------------
1298
param_select(doc) ->
1299
["Test parameterized select query."];
1300
param_select(suite) ->
1302
param_select(Config) when is_list(Config) ->
1303
Ref = ?config(connection_ref, Config),
1304
Table = ?config(tableName, Config),
1308
"CREATE TABLE " ++ Table ++
1309
" (ID INTEGER, DATA CHARACTER VARYING(10),"
1310
" PRIMARY KEY(ID))"),
1312
{updated, Count} = odbc:param_query(Ref, "INSERT INTO " ++ Table ++
1313
"(ID, DATA) VALUES(?, ?)",
1314
[{sql_integer, [1, 2, 3]},
1316
["foo", "bar", "foo"]}]),
1318
true = odbc_test_lib:check_row_count(3, Count),
1320
SelectResult = ?RDBMS:param_select(),
1322
SelectResult = odbc:param_query(Ref, "SELECT * FROM " ++ Table ++
1324
[{{sql_varchar, 10}, ["foo"]}]),
1327
%%-------------------------------------------------------------------------
1329
%%-------------------------------------------------------------------------
1330
describe_integer(doc) ->
1331
["Test describe_table/[2,3] for integer columns."];
1332
describe_integer(suite) ->
1334
describe_integer(Config) when is_list(Config) ->
1335
Ref = ?config(connection_ref, Config),
1336
Table = ?config(tableName, Config),
1340
"CREATE TABLE " ++ Table ++
1341
" (int1 SMALLINT, int2 INT, int3 INTEGER)"),
1343
Decs = ?RDBMS:describe_integer(),
1344
%% Make sure to test timeout clause
1345
Decs = odbc:describe_table(Ref, Table, ?TIMEOUT),
1348
%%-------------------------------------------------------------------------
1349
describe_string(doc) ->
1350
["Test describe_table/[2,3] for string columns."];
1351
describe_string(suite) ->
1353
describe_string(Config) when is_list(Config) ->
1354
Ref = ?config(connection_ref, Config),
1355
Table = ?config(tableName, Config),
1359
"CREATE TABLE " ++ Table ++
1360
" (str1 char(10), str2 character(10), "
1361
"str3 CHAR VARYING(10), str4 "
1362
"CHARACTER VARYING(10))"),
1364
Decs = ?RDBMS:describe_string(),
1366
Decs = odbc:describe_table(Ref, Table),
1369
%%-------------------------------------------------------------------------
1370
describe_floating(doc) ->
1371
["Test describe_table/[2,3] for floting columns."];
1372
describe_floating(suite) ->
1374
describe_floating(Config) when is_list(Config) ->
1375
Ref = ?config(connection_ref, Config),
1376
Table = ?config(tableName, Config),
1380
"CREATE TABLE " ++ Table ++
1381
" (f FLOAT(5), r REAL, "
1382
"d DOUBLE PRECISION)"),
1384
Decs = ?RDBMS:describe_floating(),
1386
Decs = odbc:describe_table(Ref, Table),
1389
%%-------------------------------------------------------------------------
1390
describe_dec_num(doc) ->
1391
["Test describe_table/[2,3] for decimal and numerical columns"];
1392
describe_dec_num(suite) ->
1394
describe_dec_num(Config) when is_list(Config) ->
1396
Ref = ?config(connection_ref, Config),
1397
Table = ?config(tableName, Config),
1401
"CREATE TABLE " ++ Table ++
1402
" (dec DECIMAL(9,3), num NUMERIC(9,2))"),
1404
Decs = ?RDBMS:describe_dec_num(),
1406
Decs = odbc:describe_table(Ref, Table),
1410
%%-------------------------------------------------------------------------
1411
describe_timestamp(doc) ->
1412
["Test describe_table/[2,3] for tinmestap columns"];
1413
describe_timestamp(suite) ->
1415
describe_timestamp(Config) when is_list(Config) ->
1417
Ref = ?config(connection_ref, Config),
1418
Table = ?config(tableName, Config),
1420
{updated, _} = % Value == 0 || -1 driver dependent!
1421
odbc:sql_query(Ref, "CREATE TABLE " ++ Table ++
1422
?RDBMS:create_timestamp_table()),
1424
Decs = ?RDBMS:describe_timestamp(),
1426
Decs = odbc:describe_table(Ref, Table),
1429
%%-------------------------------------------------------------------------
1430
describe_no_such_table(doc) ->
1431
["Test what happens if you try to describe a table that does not exist."];
1432
describe_no_such_table(suite) ->
1434
describe_no_such_table(Config) when is_list(Config) ->
1436
Ref = ?config(connection_ref, Config),
1437
Table = ?config(tableName, Config),
1439
{error, _ } = odbc:describe_table(Ref, Table),
1442
%%-------------------------------------------------------------------------
1443
%% Internal functions
1444
%%-------------------------------------------------------------------------
1446
is_driver_error(Error) ->
1447
case is_list(Error) of
1449
test_server:format("Driver error ~p~n", [Error]),
1452
test_server:fail(Error)