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 static char software_version[] = "$Id: cursor2.c,v 1.12 2011-07-12 10:16:59 freddy77 Exp $";
9 static void *no_unused_var_warn[] = { software_version, no_unused_var_warn };
10
11 int
main(int argc,char * argv[])12 main(int argc, char *argv[])
13 {
14 SQLTCHAR sqlstate[6];
15 SQLTCHAR msg[256];
16
17 odbc_connect();
18 odbc_check_cursor();
19
20 odbc_command("CREATE TABLE #cursor2_test (i INT)");
21
22 odbc_reset_statement();
23 CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, SQL_IS_INTEGER, "S");
24
25 /* this should not fail or return warnings */
26 odbc_command("DROP TABLE #cursor2_test");
27
28 CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(msg), NULL, "No");
29
30
31 odbc_reset_statement();
32 odbc_command_with_result(odbc_stmt, "if object_id('sp_test') is not null drop proc sp_test");
33 odbc_command("create proc sp_test @name varchar(30) as select 0 as pippo select 1 as 'test', @name as 'nome'");
34
35 odbc_reset_statement();
36 CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_STATIC, SQL_IS_INTEGER, "S");
37
38 odbc_command(" exec sp_test 'ciao'");
39
40 CHKFetch("S");
41
42 odbc_reset_statement();
43 odbc_command("drop proc sp_test");
44
45 odbc_disconnect();
46
47 return 0;
48 }
49