123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- #ifndef PHP_ODBC_INCLUDES_H
- #define PHP_ODBC_INCLUDES_H
- #if HAVE_UODBC
- #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
- #define ODBC_TYPE "Solid"
- #if defined(HAVE_SOLID)
- # include <cli0core.h>
- # include <cli0ext1.h>
- # include <cli0env.h>
- #elif defined(HAVE_SOLID_30)
- # include <cli0cli.h>
- # include <cli0defs.h>
- # include <cli0env.h>
- #elif defined(HAVE_SOLID_35)
- # if !defined(PHP_WIN32)
- # include <sqlunix.h>
- # endif
- # include <sqltypes.h>
- # include <sqlucode.h>
- # include <sqlext.h>
- # include <sql.h>
- #endif
- #undef HAVE_SQL_EXTENDED_FETCH
- PHP_FUNCTION(solid_fetch_prev);
- #define SQLSMALLINT SWORD
- #define SQLUSMALLINT UWORD
- #ifndef SQL_SUCCEEDED
- #define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
- #endif
- #elif defined(HAVE_EMPRESS)
- #define ODBC_TYPE "Empress"
- #include <sql.h>
- #include <sqlext.h>
- #undef HAVE_SQL_EXTENDED_FETCH
- #elif defined(HAVE_ADABAS)
- #define ODBC_TYPE "Adabas D"
- #include <WINDOWS.H>
- #include <sql.h>
- #include <sqlext.h>
- #define HAVE_SQL_EXTENDED_FETCH 1
- #define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
- #define SQLINTEGER ULONG
- #define SQLUSMALLINT USHORT
- #elif defined(HAVE_SAPDB)
- #define ODBC_TYPE "SAP DB"
- #include <WINDOWS.H>
- #include <sql.h>
- #include <sqlext.h>
- #define HAVE_SQL_EXTENDED_FETCH 1
- #define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
- #elif defined(HAVE_IODBC)
- #ifdef CHAR
- #undef CHAR
- #endif
- #ifdef SQLCHAR
- #undef SQLCHAR
- #endif
- #define ODBC_TYPE "iODBC"
- #include <sql.h>
- #include <sqlext.h>
- #include <iodbcext.h>
- #define HAVE_SQL_EXTENDED_FETCH 1
- #elif defined(HAVE_UNIXODBC)
- #ifdef CHAR
- #undef CHAR
- #endif
- #ifdef SQLCHAR
- #undef SQLCHAR
- #endif
- #define ODBC_TYPE "unixODBC"
- #undef ODBCVER
- #include <sql.h>
- #include <sqlext.h>
- #define HAVE_SQL_EXTENDED_FETCH 1
- #elif defined(HAVE_ESOOB)
- #define ODBC_TYPE "ESOOB"
- #include <sql.h>
- #include <sqlext.h>
- #define HAVE_SQL_EXTENDED_FETCH 1
- #elif defined(HAVE_ODBC_ROUTER)
- #ifdef CHAR
- #undef CHAR
- #endif
- #ifdef SQLCHAR
- #undef SQLCHAR
- #endif
- #define ODBC_TYPE "ODBCRouter"
- #include <odbcsdk.h>
- #undef HAVE_SQL_EXTENDED_FETCH
- #elif defined(HAVE_OPENLINK)
- #define ODBC_TYPE "Openlink"
- #include <iodbc.h>
- #include <isql.h>
- #include <isqlext.h>
- #include <udbcext.h>
- #define HAVE_SQL_EXTENDED_FETCH 1
- #ifndef SQLSMALLINT
- #define SQLSMALLINT SWORD
- #endif
- #ifndef SQLUSMALLINT
- #define SQLUSMALLINT UWORD
- #endif
- #elif defined(HAVE_BIRDSTEP)
- #define ODBC_TYPE "Birdstep"
- #define UNIX
- #include <sql.h>
- #include <sqlext.h>
- #define SQLINTEGER SDWORD
- #define SQLSMALLINT SWORD
- #define SQLUSMALLINT UWORD
- #elif defined(HAVE_DBMAKER)
- #define ODBC_TYPE "DBMaker"
- #undef ODBCVER
- #define ODBCVER 0x0300
- #define HAVE_SQL_EXTENDED_FETCH 1
- #include <odbc.h>
- #elif defined(HAVE_CODBC)
- #define ODBC_TYPE "Custom ODBC"
- #define HAVE_SQL_EXTENDED_FETCH 1
- #include <odbc.h>
- #elif defined(HAVE_IBMDB2)
- #define ODBC_TYPE "IBM DB2 CLI"
- #define HAVE_SQL_EXTENDED_FETCH 1
- #include <sqlcli1.h>
- #ifdef DB268K
- #include <LibraryManager.h>
- #endif
- #else
- #define HAVE_SQL_EXTENDED_FETCH 1
- #include <WINDOWS.H>
- #include <sql.h>
- #include <sqlext.h>
- #endif
- #if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC ) || defined (HAVE_IODBC)
- #define ODBC_SQL_ENV_T SQLHANDLE
- #define ODBC_SQL_CONN_T SQLHANDLE
- #define ODBC_SQL_STMT_T SQLHANDLE
- #elif defined( HAVE_SOLID_35 ) || defined( HAVE_SAPDB ) || defined ( HAVE_EMPRESS )
- #define ODBC_SQL_ENV_T SQLHENV
- #define ODBC_SQL_CONN_T SQLHDBC
- #define ODBC_SQL_STMT_T SQLHSTMT
- #else
- #define ODBC_SQL_ENV_T HENV
- #define ODBC_SQL_CONN_T HDBC
- #define ODBC_SQL_STMT_T HSTMT
- #endif
- typedef struct odbc_connection {
- ODBC_SQL_ENV_T henv;
- ODBC_SQL_CONN_T hdbc;
- char laststate[6];
- char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
- int id;
- int persistent;
- } odbc_connection;
- typedef struct odbc_result_value {
- char name[256];
- char *value;
- SQLLEN vallen;
- SQLLEN coltype;
- } odbc_result_value;
- typedef struct odbc_param_info {
- SQLSMALLINT sqltype;
- SQLSMALLINT scale;
- SQLSMALLINT nullable;
- SQLULEN precision;
- } odbc_param_info;
- typedef struct odbc_result {
- ODBC_SQL_STMT_T stmt;
- odbc_result_value *values;
- SQLSMALLINT numcols;
- SQLSMALLINT numparams;
- # if HAVE_SQL_EXTENDED_FETCH
- int fetch_abs;
- # endif
- long longreadlen;
- int binmode;
- int fetched;
- odbc_param_info * param_info;
- odbc_connection *conn_ptr;
- } odbc_result;
- ZEND_BEGIN_MODULE_GLOBALS(odbc)
- char *defDB;
- char *defUser;
- char *defPW;
- long allow_persistent;
- long check_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- int defConn;
- long defaultlrl;
- long defaultbinmode;
- long default_cursortype;
- char laststate[6];
- char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
- HashTable *resource_list;
- HashTable *resource_plist;
- ZEND_END_MODULE_GLOBALS(odbc)
- int odbc_add_result(HashTable *list, odbc_result *result);
- odbc_result *odbc_get_result(HashTable *list, int count);
- void odbc_del_result(HashTable *list, int count);
- int odbc_add_conn(HashTable *list, HDBC conn);
- odbc_connection *odbc_get_conn(HashTable *list, int count);
- void odbc_del_conn(HashTable *list, int ind);
- int odbc_bindcols(odbc_result *result TSRMLS_DC);
- #define ODBC_SQL_ERROR_PARAMS odbc_connection *conn_resource, ODBC_SQL_STMT_T stmt, char *func
- void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
- #if defined(ODBCVER) && (ODBCVER >= 0x0300)
- #define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR)
- #define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttribute
- #define PHP_ODBC_SQLALLOCSTMT(hdbc, phstmt) SQLAllocHandle(SQL_HANDLE_STMT, hdbc, phstmt)
- #define PHP_ODBC_SQL_DESC_NAME SQL_DESC_NAME
- #else
- #define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
- #define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttributes
- #define PHP_ODBC_SQLALLOCSTMT SQLAllocStmt
- #define PHP_ODBC_SQL_DESC_NAME SQL_COLUMN_NAME
- #endif
- #define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
- #ifdef ZTS
- # define ODBCG(v) TSRMG(odbc_globals_id, zend_odbc_globals *, v)
- #else
- # define ODBCG(v) (odbc_globals.v)
- extern ZEND_API zend_odbc_globals odbc_globals;
- #endif
- #endif
- #endif
|