NCBI C++ ToolKit
Functions | Variables
genparams.c File Reference
#include "common.h"
#include <time.h>
#include <freetds/test_assert.h>
+ Include dependency graph for genparams.c:

Go to the source code of this file.

Go to the repository for this file.

Functions

static const char * split_collate (ODBC_BUF **buf, const char **type)
 
static int TestOutput (const char *type, const char *value_to_convert, SQLSMALLINT out_c_type, SQLSMALLINT out_sql_type, const char *expected)
 
static void TestInput (SQLSMALLINT out_c_type, const char *type, SQLSMALLINT out_sql_type, const char *param_type, const char *value_to_convert)
 Test a parameter as input to prepared statement. More...
 
static void NullInput (SQLSMALLINT out_c_type, SQLSMALLINT out_sql_type, const char *param_type)
 
static const char * pack (const char *fmt,...)
 
static void AllTests (void)
 
int main (int argc, char *argv[])
 

Variables

static const char tds_no_dm = 0
 
static char precision = 18
 
static char exec_direct = 0
 
static char prepare_before = 0
 
static char use_cursors = 0
 
static int only_test = 0
 
static char check_truncation = 0
 
static char use_nts = 0
 
static int big_endian = 1
 

Function Documentation

◆ AllTests()

static void AllTests ( void  )
static

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ NullInput()

static void NullInput ( SQLSMALLINT  out_c_type,
SQLSMALLINT  out_sql_type,
const char *  param_type 
)
static

◆ pack()

static const char* pack ( const char *  fmt,
  ... 
)
static

Definition at line 287 of file genparams.c.

References assert, big_endian, i, l(), n, and out().

Referenced by AllTests().

◆ split_collate()

static const char* split_collate ( ODBC_BUF **  buf,
const char **  type 
)
static

Definition at line 35 of file genparams.c.

References buf, NULL, odbc_buf_asprintf(), and odbc_db_is_microsoft().

Referenced by TestInput(), and TestOutput().

◆ TestInput()

static void TestInput ( SQLSMALLINT  out_c_type,
const char *  type,
SQLSMALLINT  out_sql_type,
const char *  param_type,
const char *  value_to_convert 
)
static

Test a parameter as input to prepared statement.

"value_to_convert" will be inserted as database type "type" and C type "out_c_type" into a column of database type "param_type" and SQL type "out_sql_type". Then a select statement check that the column in the database is the same as "value_to_convert". "value_to_convert" can also contain a syntax like "input -> output", in this case the initial inserted value is "input" and the final check will check for "output".

Definition at line 133 of file genparams.c.

References check_truncation, CHKBindParameter, CHKExecDirect, CHKExecute, CHKFetch, CHKMoreResults, CHKPrepare, CHKSetStmtAttr, exec_direct, expected, NULL, odbc_command, ODBC_FREE, odbc_reset_statement, odbc_stmt, prepare_before, split_collate(), SQL_ATTR_CURSOR_SCROLLABLE, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_DYNAMIC, SQL_NTS, SQL_PARAM_INPUT, SQL_SCROLLABLE, SQLBindCol(), SQLLEN, util::strcmp(), util::strncmp(), T, use_cursors, and use_nts.

Referenced by AllTests().

◆ TestOutput()

static int TestOutput ( const char *  type,
const char *  value_to_convert,
SQLSMALLINT  out_c_type,
SQLSMALLINT  out_sql_type,
const char *  expected 
)
static

Variable Documentation

◆ big_endian

int big_endian = 1
static

Definition at line 284 of file genparams.c.

Referenced by AllTests(), main(), and pack().

◆ check_truncation

char check_truncation = 0
static

Definition at line 120 of file genparams.c.

Referenced by AllTests(), and TestInput().

◆ exec_direct

char exec_direct = 0
static

Definition at line 29 of file genparams.c.

Referenced by AllTests(), main(), NullInput(), TestInput(), and TestOutput().

◆ only_test

int only_test = 0
static

Definition at line 32 of file genparams.c.

Referenced by AllTests(), and TestOutput().

◆ precision

char precision = 18
static

Definition at line 28 of file genparams.c.

Referenced by AllTests(), and TestOutput().

◆ prepare_before

char prepare_before = 0
static

Definition at line 30 of file genparams.c.

Referenced by AllTests(), main(), NullInput(), TestInput(), and TestOutput().

◆ tds_no_dm

const char tds_no_dm = 0
static

Definition at line 25 of file genparams.c.

Referenced by main().

◆ use_cursors

char use_cursors = 0
static

Definition at line 31 of file genparams.c.

Referenced by AllTests(), main(), NullInput(), TestInput(), and TestOutput().

◆ use_nts

char use_nts = 0
static

Definition at line 121 of file genparams.c.

Referenced by AllTests(), and TestInput().

Modified on Sun Nov 08 14:02:11 2026 by modify_doxy.py rev. 717554