LCOV - code coverage report
Current view: top level - src/odbc/unittests - peter.c (source / functions) Hit Total Coverage
Test: FreeTDS coverage Lines: 17 17 100.0 %
Date: 2024-03-23 08:24:27 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #undef NDEBUG
       2             : #include "common.h"
       3             : #include <assert.h>
       4             : 
       5             : /*
       6             :         Test SQLNumResultCols after SQLFreeStmt
       7             :         This test on Sybase should not raise an error
       8             : */
       9             : 
      10             : int
      11           8 : main(void)
      12             : {
      13             :         SQLSMALLINT num_params, cols;
      14             :         SQLLEN count;
      15             :         SQLINTEGER id;
      16             : 
      17           8 :         odbc_use_version3 = 1;
      18           8 :         odbc_connect();
      19             : 
      20           8 :         odbc_command("create table #tester (id int not null, name varchar(20) not null)");
      21           8 :         odbc_command("insert into #tester(id, name) values(1, 'abc')");
      22           8 :         odbc_command("insert into #tester(id, name) values(2, 'duck')");
      23             : 
      24           8 :         CHKPrepare(T("SELECT * FROM #tester WHERE id = ?"), SQL_NTS, "S");
      25             : 
      26           8 :         CHKR(SQLNumParams, (odbc_stmt, &num_params), "S");
      27           8 :         assert(num_params == 1);
      28             : 
      29           8 :         id = 1;
      30           8 :         CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &id, sizeof(id), NULL, "S");
      31             : 
      32           8 :         CHKExecute("S");
      33             : 
      34           8 :         CHKFreeStmt(SQL_RESET_PARAMS, "S");
      35             : 
      36           8 :         CHKRowCount(&count, "S");
      37             : 
      38           8 :         CHKNumResultCols(&cols, "S");
      39           8 :         assert(cols == 2);
      40             : 
      41           8 :         odbc_disconnect();
      42             :         return 0;
      43             : }
      44             : 

Generated by: LCOV version 1.13