odbx.h | odbx.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
#include <sys/time.h> | #include <sys/time.h> | |||
#ifndef ODBX_H | #ifndef ODBX_H | |||
#define ODBX_H | #define ODBX_H | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* | /* | |||
* ODBX (SQL2003) data types | * Extended capabilities supported by the backends | |||
* 0x0000-0x00ff: Well known capabilities | ||||
*/ | */ | |||
#define ODBX_TYPE_BOOLEAN 0x00 | enum odbxcap { | |||
#define ODBX_TYPE_SMALLINT 0x01 | ODBX_CAP_BASIC, | |||
#define ODBX_TYPE_INTEGER 0x02 | #define ODBX_CAP_BASIC ODBX_CAP_BASIC | |||
#define ODBX_TYPE_BIGINT 0x03 | ODBX_CAP_LO, | |||
#define ODBX_TYPE_DECIMAL 0x07 | #define ODBX_CAP_LO ODBX_CAP_LO | |||
}; | ||||
#define ODBX_TYPE_REAL 0x08 | ||||
#define ODBX_TYPE_DOUBLE 0x09 | ||||
#define ODBX_TYPE_FLOAT 0x0f | ||||
#define ODBX_TYPE_CHAR 0x10 | ||||
#define ODBX_TYPE_NCHAR 0x11 | ||||
#define ODBX_TYPE_VARCHAR 0x12 | ||||
#define ODBX_TYPE_NVARCHAR 0x13 | ||||
#define ODBX_TYPE_CLOB 0x20 | ||||
#define ODBX_TYPE_NCLOB 0x21 | ||||
#define ODBX_TYPE_XML 0x22 | ||||
#define ODBX_TYPE_BLOB 0x2f | ||||
#define ODBX_TYPE_TIME 0x30 | ||||
#define ODBX_TYPE_TIMETZ 0x31 | ||||
#define ODBX_TYPE_TIMESTAMP 0x32 | ||||
#define ODBX_TYPE_TIMESTAMPTZ 0x33 | ||||
#define ODBX_TYPE_DATE 0x34 | ||||
#define ODBX_TYPE_INTERVAL 0x35 | ||||
#define ODBX_TYPE_ARRAY 0x40 | ||||
#define ODBX_TYPE_MULTISET 0x41 | ||||
#define ODBX_TYPE_DATALINK 0x50 | ||||
#define ODBX_TYPE_UNKNOWN 0xff | ||||
/* | /* | |||
* Extended capabilities supported by the backends | * ODBX bind type | |||
* 0x0000-0x00ff: Well known capabilities | ||||
*/ | */ | |||
#define ODBX_CAP_BASIC 0x0000 | enum odbxbind { | |||
#define ODBX_CAP_LO 0x0001 | ODBX_BIND_SIMPLE, | |||
#define ODBX_BIND_SIMPLE ODBX_BIND_SIMPLE | ||||
}; | ||||
/* | /* | |||
* ODBX error types | * ODBX error types | |||
*/ | */ | |||
#define ODBX_ERR_SUCCESS 0x00 | enum odbxerr { | |||
#define ODBX_ERR_BACKEND 0x01 | ODBX_ERR_SUCCESS, | |||
#define ODBX_ERR_NOCAP 0x02 | #define ODBX_ERR_SUCCESS ODBX_ERR_SUCCESS | |||
#define ODBX_ERR_PARAM 0x03 | ODBX_ERR_BACKEND, | |||
#define ODBX_ERR_NOMEM 0x04 | #define ODBX_ERR_BACKEND ODBX_ERR_BACKEND | |||
#define ODBX_ERR_SIZE 0x05 | ODBX_ERR_NOCAP, | |||
#define ODBX_ERR_NOTEXIST 0x06 | #define ODBX_ERR_NOCAP ODBX_ERR_NOCAP | |||
#define ODBX_ERR_NOOP 0x07 | ODBX_ERR_PARAM, | |||
#define ODBX_ERR_OPTION 0x08 | #define ODBX_ERR_PARAM ODBX_ERR_PARAM | |||
#define ODBX_ERR_OPTRO 0x09 | ODBX_ERR_NOMEM, | |||
#define ODBX_ERR_OPTWR 0x0a | #define ODBX_ERR_NOMEM ODBX_ERR_NOMEM | |||
#define ODBX_ERR_RESULT 0x0b | ODBX_ERR_SIZE, | |||
#define ODBX_ERR_NOTSUP 0x0c | #define ODBX_ERR_SIZE ODBX_ERR_SIZE | |||
#define ODBX_ERR_HANDLE 0x0d | ODBX_ERR_NOTEXIST, | |||
#define ODBX_ERR_NOTEXIST ODBX_ERR_NOTEXIST | ||||
ODBX_ERR_NOOP, | ||||
#define ODBX_ERR_NOOP ODBX_ERR_NOOP | ||||
ODBX_ERR_OPTION, | ||||
#define ODBX_ERR_OPTION ODBX_ERR_OPTION | ||||
ODBX_ERR_OPTRO, | ||||
#define ODBX_ERR_OPTRO ODBX_ERR_OPTRO | ||||
ODBX_ERR_OPTWR, | ||||
#define ODBX_ERR_OPTWR ODBX_ERR_OPTWR | ||||
ODBX_ERR_RESULT, | ||||
#define ODBX_ERR_RESULT ODBX_ERR_RESULT | ||||
ODBX_ERR_NOTSUP, | ||||
#define ODBX_ERR_NOTSUP ODBX_ERR_NOTSUP | ||||
ODBX_ERR_HANDLE, | ||||
#define ODBX_ERR_HANDLE ODBX_ERR_HANDLE | ||||
}; | ||||
#define ODBX_MAX_ERRNO 0x0d | #define ODBX_MAX_ERRNO 0x0d | |||
/* | /* | |||
* ODBX bind type | * ODBX result/fetch return values | |||
*/ | ||||
enum odbxres { | ||||
ODBX_RES_DONE, | ||||
#define ODBX_RES_DONE ODBX_RES_DONE | ||||
ODBX_RES_TIMEOUT, | ||||
#define ODBX_RES_TIMEOUT ODBX_RES_TIMEOUT | ||||
ODBX_RES_NOROWS, | ||||
#define ODBX_RES_NOROWS ODBX_RES_NOROWS | ||||
ODBX_RES_ROWS, | ||||
#define ODBX_RES_ROWS ODBX_RES_ROWS | ||||
}; | ||||
enum odbxrow { | ||||
ODBX_ROW_DONE, | ||||
#define ODBX_ROW_DONE ODBX_ROW_DONE | ||||
ODBX_ROW_NEXT, | ||||
#define ODBX_ROW_NEXT ODBX_ROW_NEXT | ||||
}; | ||||
/* | ||||
* ODBX (SQL2003) data types | ||||
*/ | */ | |||
#define ODBX_BIND_SIMPLE 0 | enum odbxtype { | |||
ODBX_TYPE_BOOLEAN = 0x00, | ||||
#define ODBX_TYPE_BOOLEAN ODBX_TYPE_BOOLEAN | ||||
ODBX_TYPE_SMALLINT = 0x01, | ||||
#define ODBX_TYPE_SMALLINT ODBX_TYPE_SMALLINT | ||||
ODBX_TYPE_INTEGER = 0x02, | ||||
#define ODBX_TYPE_INTEGER ODBX_TYPE_INTEGER | ||||
ODBX_TYPE_BIGINT = 0x03, | ||||
#define ODBX_TYPE_BIGINT ODBX_TYPE_BIGINT | ||||
ODBX_TYPE_DECIMAL = 0x07, | ||||
#define ODBX_TYPE_DECIMAL ODBX_TYPE_DECIMAL | ||||
ODBX_TYPE_REAL = 0x08, | ||||
#define ODBX_TYPE_REAL ODBX_TYPE_REAL | ||||
ODBX_TYPE_DOUBLE = 0x09, | ||||
#define ODBX_TYPE_DOUBLE ODBX_TYPE_DOUBLE | ||||
ODBX_TYPE_FLOAT = 0x0f, | ||||
#define ODBX_TYPE_FLOAT ODBX_TYPE_FLOAT | ||||
ODBX_TYPE_CHAR = 0x10, | ||||
#define ODBX_TYPE_CHAR ODBX_TYPE_CHAR | ||||
ODBX_TYPE_NCHAR = 0x11, | ||||
#define ODBX_TYPE_NCHAR ODBX_TYPE_NCHAR | ||||
ODBX_TYPE_VARCHAR = 0x12, | ||||
#define ODBX_TYPE_VARCHAR ODBX_TYPE_VARCHAR | ||||
ODBX_TYPE_NVARCHAR = 0x13, | ||||
#define ODBX_TYPE_NVARCHAR ODBX_TYPE_NVARCHAR | ||||
ODBX_TYPE_CLOB = 0x20, | ||||
#define ODBX_TYPE_CLOB ODBX_TYPE_CLOB | ||||
ODBX_TYPE_NCLOB = 0x21, | ||||
#define ODBX_TYPE_NCLOB ODBX_TYPE_NCLOB | ||||
ODBX_TYPE_XML = 0x22, | ||||
#define ODBX_TYPE_XML ODBX_TYPE_XML | ||||
ODBX_TYPE_BLOB = 0x2f, | ||||
#define ODBX_TYPE_BLOB ODBX_TYPE_BLOB | ||||
ODBX_TYPE_TIME = 0x30, | ||||
#define ODBX_TYPE_TIME ODBX_TYPE_TIME | ||||
ODBX_TYPE_TIMETZ = 0x31, | ||||
#define ODBX_TYPE_TIMETZ ODBX_TYPE_TIMETZ | ||||
ODBX_TYPE_TIMESTAMP = 0x32, | ||||
#define ODBX_TYPE_TIMESTAMP ODBX_TYPE_TIMESTAMP | ||||
ODBX_TYPE_TIMESTAMPTZ = 0x33, | ||||
#define ODBX_TYPE_TIMESTAMPTZ ODBX_TYPE_TIMESTAMPTZ | ||||
ODBX_TYPE_DATE = 0x34, | ||||
#define ODBX_TYPE_DATE ODBX_TYPE_DATE | ||||
ODBX_TYPE_INTERVAL = 0x35, | ||||
#define ODBX_TYPE_INTERVAL ODBX_TYPE_INTERVAL | ||||
ODBX_TYPE_ARRAY = 0x40, | ||||
#define ODBX_TYPE_ARRAY ODBX_TYPE_ARRAY | ||||
ODBX_TYPE_MULTISET = 0x41, | ||||
#define ODBX_TYPE_MULTISET ODBX_TYPE_MULTISET | ||||
ODBX_TYPE_DATALINK = 0x50, | ||||
#define ODBX_TYPE_DATALINK ODBX_TYPE_DATALINK | ||||
ODBX_TYPE_UNKNOWN = 0xff, | ||||
#define ODBX_TYPE_UNKNOWN ODBX_TYPE_UNKNOWN | ||||
}; | ||||
/* | /* | |||
* ODBX options | * ODBX options | |||
* | * | |||
* 0x0000 - 0x1fff reserved for api options | * 0x0000 - 0x1fff reserved for api options | |||
* 0x2000 - 0x3fff reserved for api extension options | * 0x2000 - 0x3fff reserved for api extension options | |||
* 0x4000 - 0xffff reserved for vendor specific and experimental options | * 0x4000 - 0xffff reserved for vendor specific and experimental options | |||
*/ | */ | |||
enum odbxopt { | ||||
/* Informational options */ | ||||
ODBX_OPT_API_VERSION = 0x0000, | ||||
#define ODBX_OPT_API_VERSION ODBX_OPT_API_VERSION | ||||
ODBX_OPT_THREAD_SAFE = 0x0001, | ||||
#define ODBX_OPT_THREAD_SAFE ODBX_OPT_THREAD_SAFE | ||||
ODBX_OPT_LIB_VERSION = 0x0002, | ||||
#define ODBX_OPT_LIB_VERSION ODBX_OPT_LIB_VERSION | ||||
/* Security related options */ | ||||
ODBX_OPT_TLS = 0x0010, | ||||
#define ODBX_OPT_TLS ODBX_OPT_TLS | ||||
/* Implemented options */ | ||||
ODBX_OPT_MULTI_STATEMENTS = 0x0020, | ||||
#define ODBX_OPT_MULTI_STATEMENTS ODBX_OPT_MULTI_STATEMENTS | ||||
ODBX_OPT_PAGED_RESULTS = 0x0021, | ||||
#define ODBX_OPT_PAGED_RESULTS ODBX_OPT_PAGED_RESULTS | ||||
ODBX_OPT_COMPRESS = 0x0022, | ||||
#define ODBX_OPT_COMPRESS ODBX_OPT_COMPRESS | ||||
ODBX_OPT_MODE = 0x0023, | ||||
#define ODBX_OPT_MODE ODBX_OPT_MODE | ||||
ODBX_OPT_CONNECT_TIMEOUT = 0x0024, | ||||
#define ODBX_OPT_CONNECT_TIMEOUT ODBX_OPT_CONNECT_TIMEOUT | ||||
}; | ||||
/* SSL/TLS related options */ | ||||
enum odbxtls { | ||||
ODBX_TLS_NEVER, | ||||
#define ODBX_TLS_NEVER ODBX_TLS_NEVER | ||||
ODBX_TLS_TRY, | ||||
#define ODBX_TLS_TRY ODBX_TLS_TRY | ||||
ODBX_TLS_ALWAYS, | ||||
#define ODBX_TLS_ALWAYS ODBX_TLS_ALWAYS | ||||
}; | ||||
#define ODBX_DISABLE 0 | #define ODBX_DISABLE 0 | |||
#define ODBX_ENABLE 1 | #define ODBX_ENABLE 1 | |||
/* | ||||
* Informational options | ||||
*/ | ||||
#define ODBX_OPT_API_VERSION 0x0000 | ||||
#define ODBX_OPT_THREAD_SAFE 0x0001 | ||||
#define ODBX_OPT_LIB_VERSION 0x0002 | ||||
/* | ||||
* Security related options | ||||
*/ | ||||
#define ODBX_TLS_NEVER 0x00 | ||||
#define ODBX_TLS_TRY 0x01 | ||||
#define ODBX_TLS_ALWAYS 0x02 | ||||
#define ODBX_OPT_TLS 0x0010 | ||||
/* | ||||
* Implemented options | ||||
*/ | ||||
#define ODBX_OPT_MULTI_STATEMENTS 0x0020 | ||||
#define ODBX_OPT_PAGED_RESULTS 0x0021 | ||||
#define ODBX_OPT_COMPRESS 0x0022 | ||||
#define ODBX_OPT_MODE 0x0023 | ||||
#define ODBX_OPT_CONNECT_TIMEOUT 0x0024 | ||||
typedef struct odbx_t odbx_t; | typedef struct odbx_t odbx_t; | |||
typedef struct odbx_result_t odbx_result_t; | ||||
typedef struct odbx_lo_t odbx_lo_t; | typedef struct odbx_lo_t odbx_lo_t; | |||
typedef struct odbx_result_t odbx_result_t; | ||||
/* | /* | |||
* ODBX basic operations | * ODBX basic operations | |||
*/ | */ | |||
int odbx_init( odbx_t** handle, const char* backend, const char* host, cons t char* port ); | int odbx_init( odbx_t** handle, const char* backend, const char* host, cons t char* port ); | |||
int odbx_bind( odbx_t* handle, const char* database, const char* who, const char* cred, int method ); | int odbx_bind( odbx_t* handle, const char* database, const char* who, const char* cred, int method ); | |||
int odbx_unbind( odbx_t* handle ); | int odbx_unbind( odbx_t* handle ); | |||
End of changes. 11 change blocks. | ||||
84 lines changed or deleted | 166 lines changed or added | |||