Line data Source code
1 : #include "common.h"
2 :
3 : /* Test for SQLMoreResults */
4 :
5 : static void
6 20 : DoTest(int prepared)
7 : {
8 20 : odbc_command("create table #odbctestdata (i int)");
9 :
10 : /* test that 2 empty result set are returned correctly */
11 20 : if (!prepared) {
12 10 : odbc_command("select * from #odbctestdata select * from #odbctestdata");
13 : } else {
14 10 : CHKPrepare(T("select * from #odbctestdata select * from #odbctestdata"), SQL_NTS, "S");
15 10 : CHKExecute("S");
16 : }
17 :
18 20 : CHKFetch("No");
19 :
20 20 : CHKMoreResults("S");
21 20 : printf("Getting next recordset\n");
22 :
23 20 : CHKFetch("No");
24 :
25 20 : CHKMoreResults("No");
26 :
27 : /* test that skipping a no empty result go to other result set */
28 20 : odbc_command("insert into #odbctestdata values(123)");
29 20 : if (!prepared) {
30 10 : odbc_command("select * from #odbctestdata select * from #odbctestdata");
31 : } else {
32 10 : CHKPrepare(T("select * from #odbctestdata select * from #odbctestdata"), SQL_NTS, "S");
33 10 : CHKExecute("S");
34 : }
35 :
36 20 : CHKMoreResults("S");
37 20 : printf("Getting next recordset\n");
38 :
39 20 : CHKFetch("S");
40 :
41 20 : CHKFetch("No");
42 :
43 20 : CHKMoreResults("No");
44 :
45 20 : odbc_command("drop table #odbctestdata");
46 :
47 20 : ODBC_FREE();
48 20 : }
49 :
50 : int
51 10 : main(void)
52 : {
53 10 : odbc_connect();
54 :
55 10 : DoTest(0);
56 10 : DoTest(1);
57 :
58 10 : odbc_disconnect();
59 :
60 10 : printf("Done.\n");
61 : return 0;
62 : }
|