LCOV - code coverage report
Current view: top level - src/odbc/unittests - cursor2.c (source / functions) Hit Total Coverage
Test: FreeTDS coverage Lines: 18 18 100.0 %
Date: 2025-01-18 11:50:39 Functions: 1 1 100.0 %

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

Generated by: LCOV version 1.13