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

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

Generated by: LCOV version 1.13