insert_data_test() -> begin
{db_handle, Handle} = firebird:open(test_db),
try
firebird:connect(Handle),
{trans_handle, Transaction} = firebird:create_transaction(Handle),
{ok, 204} = firebird:start_transaction(Transaction),
Result = try
{sql_result, []} = firebird:execute_sql(Handle, Transaction, "insert into tbl1 (id, descr) values (1, 'Test in Latin')", []),
{sql_result, []} = firebird:execute_sql(Handle, Transaction, "insert into tbl1 values (?, ?, ?)", [2, age_unicode:string_to_utf8("Проба на кирилица"), now]),
{sql_result, []} = firebird:execute_sql(Handle, Transaction, "insert into tbl1 (id, descr, stamp) values (?, ?, 'now')", [3, age_unicode:string_to_utf8("Exempel på svenska")]),
{ok, 205} = firebird:commit(Transaction), ok
catch
_:_ -> {ok, 206} = firebird:rollback(Transaction), error
after
{ok, 201} = firebird:close_transaction(Transaction)
end,
?assertEqual(ok, Result),
firebird:disconnect(Handle)
after
firebird:close(Handle)
end
end.
|