1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#undef UNICODE
#include <sqlcli1.h>
#include <sqlutil.h>
#include <sqlenv.h>
#include <dbd/common.h>
#define DBD_DB2_CONNECTION "DBD.DB2.Connection"
#define DBD_DB2_STATEMENT "DBD.DB2.Statement"
/*
* result set metadata
*/
typedef union _resultset_data {
SQLCHAR *str;
lua_Number number;
lua_Integer integer;
int boolean;
} resultset_data_t;
typedef struct _resultset {
SQLSMALLINT name_len;
SQLSMALLINT type;
SQLUINTEGER size;
SQLSMALLINT scale;
SQLINTEGER actual_len;
lua_push_type_t lua_type;
resultset_data_t data;
SQLCHAR name[32];
} resultset_t;
/*
* connection object implentation
*/
typedef struct _connection {
SQLHANDLE env;
SQLHANDLE db2;
} connection_t;
/*
* statement object implementation
*/
typedef struct _statement {
resultset_t * resultset;
unsigned char *buffer;
SQLSMALLINT num_result_columns; /* variable for SQLNumResultCols */
SQLHANDLE stmt;
SQLHANDLE db2;
int cursor_open;
SQLSMALLINT num_params;
unsigned char *parambuf;
} statement_t;
|