Line data Source code
1 : #include "common.h"
2 :
3 : /*
4 : * 1) Test cursor do not give error for statement that do not return rows
5 : * 2) Test cursor returns results on language RPCs
6 : */
7 :
8 10 : TEST_MAIN()
9 : {
10 : SQLTCHAR sqlstate[6];
11 : SQLTCHAR msg[256];
12 :
13 10 : odbc_connect();
14 10 : odbc_check_cursor();
15 :
16 8 : odbc_command("CREATE TABLE #cursor2_test (i INT)");
17 :
18 8 : odbc_reset_statement();
19 8 : CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, SQL_IS_INTEGER, "S");
20 :
21 : /* this should not fail or return warnings */
22 8 : odbc_command("DROP TABLE #cursor2_test");
23 :
24 8 : CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(msg), NULL, "No");
25 :
26 :
27 8 : odbc_reset_statement();
28 8 : odbc_command_with_result(odbc_stmt, "if object_id('sp_test') is not null drop proc sp_test");
29 8 : odbc_command("create proc sp_test @name varchar(30) as select 0 as pippo select 1 as 'test', @name as 'nome'");
30 :
31 8 : odbc_reset_statement();
32 8 : CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_STATIC, SQL_IS_INTEGER, "S");
33 :
34 8 : odbc_command(" exec sp_test 'ciao'");
35 :
36 8 : CHKFetch("S");
37 :
38 8 : odbc_reset_statement();
39 8 : odbc_command("drop proc sp_test");
40 :
41 8 : odbc_disconnect();
42 :
43 8 : return 0;
44 : }
|