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 12:13:41 Functions: 1 1 100.0 %

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

Generated by: LCOV version 1.13