Line data Source code
1 : #include "common.h"
2 :
3 10 : TEST_MAIN()
4 : {
5 :
6 : int i;
7 :
8 : SQLLEN cnamesize;
9 :
10 : const char *command;
11 : SQLCHAR output[256];
12 :
13 10 : odbc_connect();
14 :
15 10 : odbc_command("if object_id('tempdb..#odbctestdata') is not null drop table #odbctestdata");
16 :
17 10 : command = "create table #odbctestdata ("
18 : "col1 varchar(30) not null,"
19 : "col2 int not null,"
20 : "col3 float not null," "col4 numeric(18,6) not null," "col5 datetime not null," "col6 text not null)";
21 10 : odbc_command(command);
22 :
23 10 : command = "insert #odbctestdata values ("
24 : "'ABCDEFGHIJKLMNOP',"
25 : "123456," "1234.56," "123456.78," "'Sep 11 2001 10:00AM'," "'just to check returned length...')";
26 10 : odbc_command(command);
27 :
28 10 : odbc_command("select * from #odbctestdata");
29 :
30 10 : CHKFetch("SI");
31 :
32 70 : for (i = 1; i <= 6; i++) {
33 60 : CHKGetData(i, SQL_C_CHAR, output, sizeof(output), &cnamesize, "S");
34 :
35 60 : printf("output data >%s< len_or_ind = %d\n", output, (int) cnamesize);
36 60 : if (cnamesize != strlen((char *) output))
37 : return 1;
38 : }
39 :
40 10 : CHKFetch("No");
41 :
42 10 : CHKCloseCursor("SI");
43 :
44 10 : odbc_command("drop table #odbctestdata");
45 :
46 10 : odbc_disconnect();
47 :
48 10 : printf("Done.\n");
49 10 : return 0;
50 : }
|