rpm
5.4.15
|
#include "system.h"
#include <rpmiotypes.h>
#include <rpmio.h>
#include <rpmlog.h>
#include <rpmmacro.h>
#include <rpmurl.h>
#include <argv.h>
#include <rpmodbc.h>
#include "debug.h"
Go to the source code of this file.
Data Structures | |
struct | key_s |
Macros | |
#define | _RPMODBC_INTERNAL |
#define | DBG(_t, _l) if ((_t) || _odbc_debug) fprintf _l |
#define | SPEW(_t, _rc, _odbc) |
#define | SQL_SUCCEEDED(rc) (((rc)&(~1))==0) |
#define | SQL_NO_DATA 100 |
#define | SQL_FETCH_NEXT 1 |
#define | SQL_FETCH_FIRST 2 |
#define | SQL_FETCH_LAST 3 |
#define | SQL_FETCH_PRIOR 4 |
#define | SQL_FETCH_ABSOLUTE 5 |
#define | SQL_FETCH_RELATIVE 6 |
#define | SQL_C_CHAR 1 |
#define | SQL_C_SHORT 5 |
#define | SQL_C_LONG 4 |
#define | SQL_C_FLOAT 6 |
#define | SQL_C_DOUBLE 8 |
#define | SQL_C_DATE 9 |
#define | SQL_C_TIME 10 |
#define | SQL_C_TIMESTAMP 11 |
#define | SQL_COLUMN_NAME 1 |
#define | SQL_COLUMN_TABLE_NAME 15 |
#define | SQL_COLUMN_LABEL 18 |
#define | SQL_COMMIT 0 |
#define | SQL_ROLLBACK 1 |
#define | CHECK(_o, _t, _m, _rc) (-1) |
#define | _ENTRY(_t, _v) { _t, SQL_ATTR_##_v, #_v, } |
#define | _ENTRY(_t, _v) { _t, SQL_##_v, #_v, } |
#define | _ENTRY(_t, _v) { _t, SQL_ATTR_##_v, #_v, } |
#define | _ENTRY(_t, _v) { _t, SQL_COLUMN_##_v, #_v, } |
Typedefs | |
typedef struct key_s | KEY |
Functions | |
static void * | hFree (ODBC_t odbc, HNDL_t H) |
static void * | hAlloc (ODBC_t odbc, int ht) |
static int | odbcDumpStmt (ODBC_t odbc, void *_fp) |
int | odbcGetStmtAttr (ODBC_t odbc, int _attr, void *_bp, int _nb, int *nsp) |
int | odbcSetStmtAttr (ODBC_t odbc, int _attr, void *_bp, int ns) |
static int | odbcDumpInfo (ODBC_t odbc, void *_fp) |
int | odbcGetInfo (ODBC_t odbc, int _type, void *_bp, int _nb, short *nsp) |
static int | odbcDumpEnvAttr (ODBC_t odbc, void *_fp) |
int | odbcGetEnvAttr (ODBC_t odbc, int _type, void *_bp, int _nb, int *nsp) |
int | odbcSetEnvAttr (ODBC_t odbc, int _type, void *_bp, int ns) |
static int | odbcDumpColAttrs (ODBC_t odbc, int colx, void *_fp) |
int | odbcColAttribute (ODBC_t odbc, unsigned short ColumnNumber, unsigned short FieldIdentifier, void *CharacterAttributePtr, short BufferLength, short *StringLengthPtr, long *NumericAttributePtr) |
int | odbcCloseCursor (ODBC_t odbc) |
const char * | odbcGetCursorName (ODBC_t odbc) |
int | odbcSetCursorName (ODBC_t odbc, const char *s, size_t ns) |
int | odbcEndTran (ODBC_t odbc, int _rollback) |
int | odbcCommit (ODBC_t odbc) |
int | odbcRollback (ODBC_t odbc) |
int | odbcConnect (ODBC_t odbc, const char *uri) |
int | odbcDisconnect (ODBC_t odbc) |
int | odbcListDataSources (ODBC_t odbc, void *_fp) |
int | odbcListDrivers (ODBC_t odbc, void *_fp) |
int | odbcNRows (ODBC_t odbc) |
int | odbcNCols (ODBC_t odbc) |
int | odbcCancel (ODBC_t odbc) |
int | odbcFetch (ODBC_t odbc) |
int | odbcFetchScroll (ODBC_t odbc, short FetchOrientation, long FetchOffset) |
int | odbcGetData (ODBC_t odbc, unsigned short Col_or_Param_Num, short TargetType, void *TargetValuePtr, long BufferLength, long *StrLen_or_IndPtr) |
int | odbcPrint (ODBC_t odbc, void *_fp) |
int | odbcTables (ODBC_t odbc, const char *tblname) |
int | odbcColumns (ODBC_t odbc, const char *tblname, const char *colname) |
int | odbcStatistics (ODBC_t odbc, const char *tblname) |
int | odbcExecDirect (ODBC_t odbc, const char *s, size_t ns) |
int | odbcPrepare (ODBC_t odbc, const char *s, size_t ns) |
int | odbcBindCol (ODBC_t odbc, unsigned short ColumnNumber, short TargetType, void *TargetValuePtr, long BufferLength, long *StrLen_or_Ind) |
int | odbcBindParameter (ODBC_t odbc, _PARAM_t param) |
int | odbcExecute (ODBC_t odbc) |
static void | odbcFini (void *_odbc) |
static ODBC_t | odbcGetPool (rpmioPool pool) |
ODBC_t | odbcNew (const char *fn, int flags) |
Create and load a odbc wrapper. More... | |
Variables | |
int | _odbc_debug = 0 |
static KEY | SQL_ATTRS [] |
static size_t | nSQL_ATTRS = sizeof(SQL_ATTRS) / sizeof(SQL_ATTRS[0]) |
static KEY | SQL_INFOS [] |
static size_t | nSQL_INFOS = sizeof(SQL_INFOS) / sizeof(SQL_INFOS[0]) |
static KEY | SQL_EATTRS [] |
static size_t | nSQL_EATTRS = sizeof(SQL_EATTRS) / sizeof(SQL_EATTRS[0]) |
static KEY | SQL_CATTRS [] |
static size_t | nSQL_CATTRS = sizeof(SQL_CATTRS) / sizeof(SQL_CATTRS[0]) |
rpmioPool | _odbcPool = NULL |
static char * | _odbc_uri = "mysql://luser:jasnl@localhost/test" |
#define CHECK | ( | _o, | |
_t, | |||
_m, | |||
_rc | |||
) | (-1) |
Definition at line 110 of file rpmodbc.c.
Referenced by hAlloc(), hFree(), odbcBindCol(), odbcBindParameter(), odbcCancel(), odbcCloseCursor(), odbcColAttribute(), odbcColumns(), odbcConnect(), odbcDisconnect(), odbcEndTran(), odbcExecDirect(), odbcExecute(), odbcFetch(), odbcFetchScroll(), odbcGetCursorName(), odbcGetData(), odbcGetEnvAttr(), odbcGetInfo(), odbcGetStmtAttr(), odbcListDataSources(), odbcListDrivers(), odbcNCols(), odbcNRows(), odbcPrepare(), odbcSetCursorName(), odbcSetEnvAttr(), odbcSetStmtAttr(), odbcStatistics(), and odbcTables().
#define DBG | ( | _t, | |
_l | |||
) | if ((_t) || _odbc_debug) fprintf _l |
Definition at line 26 of file rpmodbc.c.
Referenced by odbcConnect(), odbcExecDirect(), odbcPrepare(), and odbcPrint().
#define SPEW | ( | _t, | |
_rc, | |||
_odbc | |||
) |
Definition at line 29 of file rpmodbc.c.
Referenced by odbcBindCol(), odbcBindParameter(), odbcCancel(), odbcCloseCursor(), odbcColAttribute(), odbcColumns(), odbcConnect(), odbcDisconnect(), odbcEndTran(), odbcExecDirect(), odbcExecute(), odbcFetch(), odbcFetchScroll(), odbcGetCursorName(), odbcGetData(), odbcListDataSources(), odbcListDrivers(), odbcNCols(), odbcNRows(), odbcPrepare(), odbcPrint(), odbcSetCursorName(), odbcStatistics(), and odbcTables().
#define SQL_C_CHAR 1 |
Definition at line 45 of file rpmodbc.c.
Referenced by odbcPrint().
#define SQL_COLUMN_LABEL 18 |
Definition at line 56 of file rpmodbc.c.
Referenced by odbcPrint().
#define SQL_COMMIT 0 |
Definition at line 58 of file rpmodbc.c.
Referenced by odbcCommit(), and odbcEndTran().
#define SQL_FETCH_FIRST 2 |
Definition at line 39 of file rpmodbc.c.
Referenced by odbcListDataSources(), and odbcListDrivers().
#define SQL_FETCH_NEXT 1 |
Definition at line 38 of file rpmodbc.c.
Referenced by odbcListDataSources(), and odbcListDrivers().
#define SQL_NO_DATA 100 |
Definition at line 37 of file rpmodbc.c.
Referenced by odbcCancel(), odbcCloseCursor(), odbcFetch(), odbcFetchScroll(), odbcGetCursorName(), and odbcSetCursorName().
#define SQL_ROLLBACK 1 |
Definition at line 59 of file rpmodbc.c.
Referenced by odbcEndTran(), and odbcRollback().
#define SQL_SUCCEEDED | ( | rc | ) | (((rc)&(~1))==0) |
Definition at line 36 of file rpmodbc.c.
Referenced by odbcListDataSources(), odbcListDrivers(), and odbcPrint().
|
static |
Definition at line 128 of file rpmodbc.c.
References CHECK, and xmalloc.
Referenced by odbcColumns(), odbcConnect(), odbcExecDirect(), odbcNew(), odbcPrepare(), odbcStatistics(), and odbcTables().
Definition at line 113 of file rpmodbc.c.
References _free(), and CHECK.
Referenced by odbcCancel(), odbcDisconnect(), odbcFini(), odbcPrepare(), and odbcPrint().
int odbcBindCol | ( | ODBC_t | odbc, |
unsigned short | ColumnNumber, | ||
short | TargetType, | ||
void * | TargetValuePtr, | ||
long | BufferLength, | ||
long * | StrLen_or_Ind | ||
) |
int odbcCancel | ( | ODBC_t | odbc | ) |
int odbcCloseCursor | ( | ODBC_t | odbc | ) |
Definition at line 687 of file rpmodbc.c.
References CHECK, SPEW, and SQL_NO_DATA.
int odbcColAttribute | ( | ODBC_t | odbc, |
unsigned short | ColumnNumber, | ||
unsigned short | FieldIdentifier, | ||
void * | CharacterAttributePtr, | ||
short | BufferLength, | ||
short * | StringLengthPtr, | ||
long * | NumericAttributePtr | ||
) |
Definition at line 660 of file rpmodbc.c.
Referenced by odbcDumpColAttrs(), and odbcPrint().
int odbcColumns | ( | ODBC_t | odbc, |
const char * | tblname, | ||
const char * | colname | ||
) |
int odbcCommit | ( | ODBC_t | odbc | ) |
Definition at line 752 of file rpmodbc.c.
References odbcEndTran(), and SQL_COMMIT.
int odbcConnect | ( | ODBC_t | odbc, |
const char * | uri | ||
) |
Definition at line 764 of file rpmodbc.c.
References _free(), CHECK, db, DBG, hAlloc(), odbcDumpInfo(), urlinfo_s::password, rpmExpand(), urlinfo_s::scheme, SPEW, URL_IS_MYSQL, URL_IS_POSTGRES, URL_IS_SQLSERVER, urlPath(), urlSplit(), urlinfo_s::user, and xstrdup().
int odbcDisconnect | ( | ODBC_t | odbc | ) |
|
static |
Definition at line 620 of file rpmodbc.c.
References b, i, ns, nSQL_CATTRS, odbcColAttribute(), and key_s::v.
Referenced by odbcPrint().
|
static |
Definition at line 541 of file rpmodbc.c.
References i, ns, nSQL_EATTRS, odbcGetEnvAttr(), and key_s::v.
Referenced by odbcNew().
|
static |
Definition at line 464 of file rpmodbc.c.
References i, ns, nSQL_INFOS, odbcGetInfo(), and key_s::v.
Referenced by odbcConnect().
|
static |
Definition at line 209 of file rpmodbc.c.
References i, ns, nSQL_ATTRS, odbcGetStmtAttr(), and key_s::v.
Referenced by odbcPrint().
int odbcEndTran | ( | ODBC_t | odbc, |
int | _rollback | ||
) |
Definition at line 738 of file rpmodbc.c.
References CHECK, SPEW, SQL_COMMIT, and SQL_ROLLBACK.
Referenced by odbcCommit(), and odbcRollback().
int odbcExecDirect | ( | ODBC_t | odbc, |
const char * | s, | ||
size_t | ns | ||
) |
int odbcExecute | ( | ODBC_t | odbc | ) |
int odbcFetch | ( | ODBC_t | odbc | ) |
Definition at line 941 of file rpmodbc.c.
References CHECK, SPEW, and SQL_NO_DATA.
Referenced by odbcPrint().
int odbcFetchScroll | ( | ODBC_t | odbc, |
short | FetchOrientation, | ||
long | FetchOffset | ||
) |
Definition at line 954 of file rpmodbc.c.
References CHECK, SPEW, and SQL_NO_DATA.
|
static |
const char* odbcGetCursorName | ( | ODBC_t | odbc | ) |
int odbcGetData | ( | ODBC_t | odbc, |
unsigned short | Col_or_Param_Num, | ||
short | TargetType, | ||
void * | TargetValuePtr, | ||
long | BufferLength, | ||
long * | StrLen_or_IndPtr | ||
) |
int odbcGetEnvAttr | ( | ODBC_t | odbc, |
int | _type, | ||
void * | _bp, | ||
int | _nb, | ||
int * | nsp | ||
) |
int odbcGetInfo | ( | ODBC_t | odbc, |
int | _type, | ||
void * | _bp, | ||
int | _nb, | ||
short * | nsp | ||
) |
Definition at line 1228 of file rpmodbc.c.
References _odbc_debug, _odbcPool, odbcFini(), rpmioGetPool(), and rpmioNewPool().
Referenced by odbcNew().
int odbcGetStmtAttr | ( | ODBC_t | odbc, |
int | _attr, | ||
void * | _bp, | ||
int | _nb, | ||
int * | nsp | ||
) |
int odbcListDataSources | ( | ODBC_t | odbc, |
void * | _fp | ||
) |
Definition at line 831 of file rpmodbc.c.
References CHECK, SPEW, SQL_FETCH_FIRST, SQL_FETCH_NEXT, and SQL_SUCCEEDED.
int odbcListDrivers | ( | ODBC_t | odbc, |
void * | _fp | ||
) |
Definition at line 864 of file rpmodbc.c.
References CHECK, SPEW, SQL_FETCH_FIRST, SQL_FETCH_NEXT, and SQL_SUCCEEDED.
int odbcNCols | ( | ODBC_t | odbc | ) |
ODBC_t odbcNew | ( | const char * | fn, |
int | flags | ||
) |
Create and load a odbc wrapper.
fn | odbc file |
flags | odbc flags |
Definition at line 1246 of file rpmodbc.c.
References _odbc_debug, _odbc_uri, flags, hAlloc(), odbcDumpEnvAttr(), odbcGetPool(), odbcLink(), odbcSetEnvAttr(), rpmExpand(), urlinfo_s::scheme, URL_IS_MYSQL, URL_IS_POSTGRES, URL_IS_SQLSERVER, urlLink(), urlPath(), urlSplit(), and xstrdup().
int odbcPrepare | ( | ODBC_t | odbc, |
const char * | s, | ||
size_t | ns | ||
) |
int odbcPrint | ( | ODBC_t | odbc, |
void * | _fp | ||
) |
Definition at line 990 of file rpmodbc.c.
References _odbc_debug, argvAdd(), argvFree(), b, DBG, hFree(), i, ns, odbcColAttribute(), odbcDumpColAttrs(), odbcDumpStmt(), odbcFetch(), odbcGetData(), odbcNCols(), snprintf(), SPEW, SQL_C_CHAR, SQL_COLUMN_LABEL, and SQL_SUCCEEDED.
int odbcRollback | ( | ODBC_t | odbc | ) |
Definition at line 757 of file rpmodbc.c.
References odbcEndTran(), and SQL_ROLLBACK.
int odbcSetCursorName | ( | ODBC_t | odbc, |
const char * | s, | ||
size_t | ns | ||
) |
Definition at line 721 of file rpmodbc.c.
References CHECK, SPEW, and SQL_NO_DATA.
int odbcSetEnvAttr | ( | ODBC_t | odbc, |
int | _type, | ||
void * | _bp, | ||
int | ns | ||
) |
int odbcSetStmtAttr | ( | ODBC_t | odbc, |
int | _attr, | ||
void * | _bp, | ||
int | ns | ||
) |
int odbcStatistics | ( | ODBC_t | odbc, |
const char * | tblname | ||
) |
int odbcTables | ( | ODBC_t | odbc, |
const char * | tblname | ||
) |
int _odbc_debug = 0 |
Definition at line 24 of file rpmodbc.c.
Referenced by odbcGetPool(), odbcNew(), and odbcPrint().
|
static |
rpmioPool _odbcPool = NULL |
Definition at line 1226 of file rpmodbc.c.
Referenced by odbcGetPool(), and rpmioClean().
Definition at line 207 of file rpmodbc.c.
Referenced by odbcDumpStmt().
|
static |
Definition at line 618 of file rpmodbc.c.
Referenced by odbcDumpColAttrs().
|
static |
Definition at line 539 of file rpmodbc.c.
Referenced by odbcDumpEnvAttr().
Definition at line 462 of file rpmodbc.c.
Referenced by odbcDumpInfo().
|
static |