LCOV - code coverage report
Current view: top level - src/odbc/unittests - wchar.c (source / functions) Hit Total Coverage
Test: FreeTDS coverage Lines: 13 16 81.2 %
Date: 2025-01-18 12:13:41 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "common.h"
       2             : 
       3             : /* test SQL_C_DEFAULT with NCHAR type */
       4             : 
       5             : int
       6           8 : main(int argc, char *argv[])
       7             : {
       8             :         char buf[102];
       9             :         SQLLEN ind;
      10           8 :         int failed = 0;
      11             : 
      12           8 :         odbc_use_version3 = 1;
      13           8 :         odbc_connect();
      14             : 
      15           8 :         CHKBindCol(1, SQL_C_DEFAULT, buf, 100, &ind, "S");
      16           8 :         odbc_command("SELECT CONVERT(NCHAR(10), 'Pippo 123')");
      17             : 
      18             :         /* get data */
      19           8 :         memset(buf, 0, sizeof(buf));
      20           8 :         CHKFetch("S");
      21             : 
      22           8 :         SQLMoreResults(odbc_stmt);
      23           8 :         SQLMoreResults(odbc_stmt);
      24             : 
      25           8 :         odbc_disconnect();
      26             : 
      27             :         /* the second string could came from Sybase configured with UTF-8 */
      28           8 :         if (strcmp(buf, "Pippo 123 ") != 0
      29           0 :             && (odbc_db_is_microsoft() || strcmp(buf, "Pippo 123                     ") != 0)) {
      30           0 :                 fprintf(stderr, "Wrong results '%s'\n", buf);
      31           0 :                 failed = 1;
      32             :         }
      33             : 
      34           8 :         return failed ? 1 : 0;
      35             : }
      36             : 

Generated by: LCOV version 1.13