NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Functions | Variables
describecol.c File Reference
#include "common.h"
#include <ctype.h>
#include "parser.h"
#include <odbcss.h>
#include <common/test_assert.h>
+ Include dependency graph for describecol.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  lookup_int
 
struct  attribute
 

Macros

#define TYPE(s)   { #s, s }
 
#define ATTR(s, t)   { #s, s, type_##t, NULL }
 
#define ATTR2(s, t, l)   { #s, s, type_##t, l }
 
#define ATTR_PARAMS   const struct attribute *attr, const char *expected_value
 
#define TEST_FILE   "describecol.in"
 

Typedefs

typedef void(* check_attr_t) (const struct attribute *attr, const char *expected_value)
 

Enumerations

enum  test_type_t {
  type_INTEGER , type_UINTEGER , type_SMALLINT , type_LEN ,
  type_CHARP , type_DESC , type_VOIDP , type_INTEGER ,
  type_SMALLINT , type_LEN , type_CHARP
}
 

Functions

static int get_int (const char *s)
 
static int lookup (const char *name, const struct lookup_int *table)
 
static const char * unlookup (long int value, const struct lookup_int *table)
 
static const struct attributelookup_attr (const char *name)
 
static void check_attr_ird (const struct attribute *attr, const char *expected_value)
 
static void check_attr_ard (const struct attribute *attr, const char *expected_value)
 
static void check_attr_none (const struct attribute *attr, const char *expected_value)
 
int main (int argc, char *argv[])
 

Variables

static int g_result = 0
 
static struct lookup_int sql_types []
 
static struct lookup_int sql_bools []
 
static const struct attribute attributes []
 

Macro Definition Documentation

◆ ATTR

#define ATTR (   s,
  t 
)    { #s, s, type_##t, NULL }

◆ ATTR2

#define ATTR2 (   s,
  t,
 
)    { #s, s, type_##t, l }

◆ ATTR_PARAMS

#define ATTR_PARAMS   const struct attribute *attr, const char *expected_value

Definition at line 158 of file describecol.c.

◆ TEST_FILE

#define TEST_FILE   "describecol.in"

◆ TYPE

#define TYPE (   s)    { #s, s }

Typedef Documentation

◆ check_attr_t

typedef void(* check_attr_t) (const struct attribute *attr, const char *expected_value)

Definition at line 159 of file describecol.c.

Enumeration Type Documentation

◆ test_type_t

Enumerator
type_INTEGER 
type_UINTEGER 
type_SMALLINT 
type_LEN 
type_CHARP 
type_DESC 
type_VOIDP 
type_INTEGER 
type_SMALLINT 
type_LEN 
type_CHARP 

Definition at line 109 of file describecol.c.

Function Documentation

◆ check_attr_ard()

static void check_attr_ard ( const struct attribute attr,
const char *  expected_value 
)
static

◆ check_attr_ird()

static void check_attr_ird ( const struct attribute attr,
const char *  expected_value 
)
static

◆ check_attr_none()

static void check_attr_none ( const struct attribute attr,
const char *  expected_value 
)
static

Definition at line 256 of file describecol.c.

Referenced by main().

◆ get_int()

static int get_int ( const char *  s)
static

Definition at line 16 of file describecol.c.

References odbc_fatal().

Referenced by lookup(), and main().

◆ lookup()

static int lookup ( const char *  name,
const struct lookup_int table 
)
static

Definition at line 36 of file describecol.c.

References get_int(), util::strcmp(), and table.

Referenced by check_attr_ard(), check_attr_ird(), and main().

◆ lookup_attr()

static const struct attribute* lookup_attr ( const char *  name)
static

Definition at line 145 of file describecol.c.

References attributes, i, attribute::name, NULL, odbc_fatal(), and util::strcmp().

Referenced by main().

◆ main()

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

◆ unlookup()

static const char* unlookup ( long int  value,
const struct lookup_int table 
)
static

Definition at line 49 of file describecol.c.

References buf, table, and value.

Referenced by check_attr_ard(), and check_attr_ird().

Variable Documentation

◆ attributes

const struct attribute attributes[]
static
Initial value:
= {
#define ATTR(s,t)
#define ATTR2(s,t,l)
{ "SQL_COLUMN_LENGTH", SQL_COLUMN_LENGTH , type_INTEGER , NULL },
{ "SQL_COLUMN_PRECISION", SQL_COLUMN_PRECISION , type_INTEGER , NULL },
{ "SQL_COLUMN_SCALE", SQL_COLUMN_SCALE , type_INTEGER , NULL },
{ "SQL_DESC_LENGTH", SQL_DESC_LENGTH , type_LEN , NULL },
{ "SQL_DESC_OCTET_LENGTH", SQL_DESC_OCTET_LENGTH , type_LEN , NULL },
{ "SQL_DESC_PRECISION", SQL_DESC_PRECISION , type_SMALLINT , NULL },
{ "SQL_DESC_SCALE", SQL_DESC_SCALE , type_SMALLINT , NULL },
{ "SQL_DESC_DISPLAY_SIZE", SQL_DESC_DISPLAY_SIZE , type_INTEGER , NULL },
{ "SQL_DESC_TYPE_NAME", SQL_DESC_TYPE_NAME , type_CHARP , NULL },
{ "SQL_DESC_CONCISE_TYPE", SQL_DESC_CONCISE_TYPE , type_SMALLINT , sql_types },
{ "SQL_DESC_TYPE", SQL_DESC_TYPE , type_SMALLINT , sql_types },
{ "SQL_DESC_UNSIGNED", SQL_DESC_UNSIGNED , type_SMALLINT , sql_bools }
}
static struct lookup_int sql_types[]
Definition: describecol.c:65
@ type_CHARP
Definition: describecol.c:114
@ type_LEN
Definition: describecol.c:113
@ type_INTEGER
Definition: describecol.c:111
@ type_SMALLINT
Definition: describecol.c:112
static struct lookup_int sql_bools[]
Definition: describecol.c:103
#define NULL
Definition: ncbistd.hpp:225
#define SQL_DESC_TYPE
Definition: sql.h:100
#define SQL_DESC_PRECISION
Definition: sql.h:103
#define SQL_DESC_LENGTH
Definition: sql.h:101
#define SQL_DESC_SCALE
Definition: sql.h:104
#define SQL_DESC_OCTET_LENGTH
Definition: sql.h:111
#define SQL_DESC_TYPE_NAME
Definition: sqlext.h:411
#define SQL_DESC_DISPLAY_SIZE
Definition: sqlext.h:395
#define SQL_COLUMN_SCALE
Definition: sqlext.h:635
#define SQL_DESC_CONCISE_TYPE
Definition: sqlext.h:393
#define SQL_COLUMN_PRECISION
Definition: sqlext.h:634
#define SQL_COLUMN_LENGTH
Definition: sqlext.h:633
#define SQL_DESC_UNSIGNED
Definition: sqlext.h:413

Definition at line 49 of file describecol.c.

Referenced by lookup_attr().

◆ g_result

int g_result = 0
static

Definition at line 13 of file describecol.c.

Referenced by check_attr_ard(), check_attr_ird(), and main().

◆ sql_bools

struct lookup_int sql_bools[]
static
Initial value:
= {
{ "SQL_TRUE", SQL_TRUE },
{ "SQL_FALSE", SQL_FALSE },
{ NULL, 0 }
}
#define SQL_TRUE
Definition: sql.h:219
#define SQL_FALSE
Definition: sql.h:218

Definition at line 49 of file describecol.c.

◆ sql_types

struct lookup_int sql_types[]
static

Definition at line 49 of file describecol.c.

Modified on Mon Dec 11 02:36:19 2023 by modify_doxy.py rev. 669887