summaryrefslogtreecommitdiff
path: root/ext/pdo_odbc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_odbc')
-rwxr-xr-xext/pdo_odbc/CREDITS2
-rw-r--r--ext/pdo_odbc/EXPERIMENTAL0
-rwxr-xr-xext/pdo_odbc/config.m4111
-rwxr-xr-xext/pdo_odbc/config.w3215
-rwxr-xr-xext/pdo_odbc/odbc_driver.c410
-rwxr-xr-xext/pdo_odbc/odbc_stmt.c262
-rwxr-xr-xext/pdo_odbc/package.xml53
-rwxr-xr-xext/pdo_odbc/pdo_odbc.c155
-rw-r--r--ext/pdo_odbc/php_pdo_odbc.h81
-rwxr-xr-xext/pdo_odbc/php_pdo_odbc_int.h163
10 files changed, 0 insertions, 1252 deletions
diff --git a/ext/pdo_odbc/CREDITS b/ext/pdo_odbc/CREDITS
deleted file mode 100755
index b5af9df356..0000000000
--- a/ext/pdo_odbc/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ODBC driver for PDO
-Wez Furlong
diff --git a/ext/pdo_odbc/EXPERIMENTAL b/ext/pdo_odbc/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/pdo_odbc/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4
deleted file mode 100755
index e69a8a6bc7..0000000000
--- a/ext/pdo_odbc/config.m4
+++ /dev/null
@@ -1,111 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension pdo_odbc
-
-AC_DEFUN(PDO_ODBC_HELP_TEXT, [[
- --with-pdo-odbc=flavour,dir Add support for "flavour" ODBC drivers,
- looking for include and lib dirs under "dir"
-
- flavour can be one of:
- ibm-db2, unixODBC
-
- You may omit the ,dir part to use a reasonable default for
- the flavour you have selected. e.g.:
- --with-pdo-odbc=unixODBC
- will check for unixODBC under /usr/local
-
- This extension will always be created as a shared extension
- named pdo_odbc.so
-]])
-
-PHP_ARG_WITH(pdo-odbc, ODBC v3 driver for PDO, PDO_ODBC_HELP_TEXT)
-
-AC_DEFUN([PDO_ODBC_CHECK_HEADER],[
- if test -f $PDO_ODBC_INCDIR/$1 ; then
- AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___), 1, [ ])
- fi
-])
-
-AC_MSG_CHECKING(which ODBC flavour you want)
-if test "$PHP_PDO_ODBC" != "no" && test "$PHP_PDO_ODBC" != "yes" ; then
- pdo_odbc_flavour=`echo $withval | cut -d, -f1`
- pdo_odbc_dir=`echo $withval | cut -d, -f2`
-
- if test "$pdo_odbc_dir" = "$withval" ; then
- pdo_odbc_dir=""
- fi
-
- case $pdo_odbc_flavour in
- ibm-db2)
- pdo_odbc_def_libdir=/home/db2inst/sqllib/lib
- pdo_odbc_def_incdir=/home/db2inst1/sqllib/include
- pdo_odbc_def_lib=-ldb2
- ;;
-
- unixODBC)
- pdo_odbc_def_libdir=/usr/local/lib
- pdo_odbc_def_incdir=/usr/local/include
- pdo_odbc_def_lib=-lodbc
- ;;
-
- *)
- AC_MSG_ERROR(Unknown ODBC flavour $pdo_odbc_flavour
-PDO_ODBC_HELP_TEXT
-)
- ;;
- esac
-
- if test "$pdo_odbc_dir" != "" ; then
- PDO_ODBC_INCDIR="$pdo_odbc_dir/include"
- PDO_ODBC_LIBDIR="$pdo_odbc_dir/lib"
- else
- PDO_ODBC_INCDIR="$pdo_odbc_def_incdir"
- PDO_ODBC_LIBDIR="$pdo_odbc_def_libdir"
- fi
-
- AC_MSG_RESULT([$pdo_odbc_flavour
- libs $PDO_ODBC_LIBDIR,
- headers $PDO_ODBC_INCDIR])
-
- if ! test -d "$PDO_ODBC_LIBDIR" ; then
- AC_MSG_WARN([library dir $PDO_ODBC_LIBDIR does not exist])
- fi
-
- dnl yick time
- PDO_ODBC_CHECK_HEADER(odbc.h)
- PDO_ODBC_CHECK_HEADER(iodbc.h)
- PDO_ODBC_CHECK_HEADER(sqlunix.h)
- PDO_ODBC_CHECK_HEADER(sqltypes.h)
- PDO_ODBC_CHECK_HEADER(sqlucode.h)
- PDO_ODBC_CHECK_HEADER(sql.h)
- PDO_ODBC_CHECK_HEADER(isql.h)
- PDO_ODBC_CHECK_HEADER(sqlext.h)
- PDO_ODBC_CHECK_HEADER(isqlext.h)
- PDO_ODBC_CHECK_HEADER(udbcext.h)
- PDO_ODBC_CHECK_HEADER(sqlcli1.h)
- PDO_ODBC_CHECK_HEADER(LibraryManager.h)
- PDO_ODBC_CHECK_HEADER(cli0core.h)
- PDO_ODBC_CHECK_HEADER(cli0ext.h)
- PDO_ODBC_CHECK_HEADER(cli0cli.h)
- PDO_ODBC_CHECK_HEADER(cli0defs.h)
- PDO_ODBC_CHECK_HEADER(cli0env.h)
-
- PDO_ODBC_INCLUDE="-I$PDO_ODBC_INCDIR -DPDO_ODBC_TYPE=\\\"$pdo_odbc_flavour\\\""
- PDO_ODBC_LFLAGS="-L$PDO_ODBC_LIBDIR"
- PDO_ODBC_LIBS="$pdo_odbc_def_lib"
-
- LDFLAGS="$PDO_ODBC_LFLAGS $PDO_ODBC_LIBS -lm -ldl"
- AC_TRY_LINK_FUNC([SQLAllocHandle],[],[
- AC_MSG_ERROR([[Your ODBC libraries either do not exist, or do not appear to be ODBC3 compatible]])
- ])
- LDFLAGS=$save_old_LDFLAGS
- PHP_EVAL_LIBLINE($PDO_ODBC_LIBS $PDO_ODBC_LFLAGS, [PDO_ODBC_SHARED_LIBADD])
- PHP_SUBST(PDO_ODBC_SHARED_LIBADD)
-
- PHP_NEW_EXTENSION(pdo_odbc, pdo_odbc.c odbc_driver.c odbc_stmt.c, yes,,-I\$prefix/include/php/ext $PDO_ODBC_INCLUDE)
-else
- AC_MSG_ERROR(
-Unknown ODBC flavour $PHP_PDO_ODBC
-PDO_ODBC_HELP_TEXT
-)
-fi
-
diff --git a/ext/pdo_odbc/config.w32 b/ext/pdo_odbc/config.w32
deleted file mode 100755
index d7cc443f17..0000000000
--- a/ext/pdo_odbc/config.w32
+++ /dev/null
@@ -1,15 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_WITH("pdo-odbc", "ODBC support for PDO", "no");
-
-if (PHP_PDO_ODBC != "no") {
- if (CHECK_LIB("odbc32.lib", "pdo_odbc") && CHECK_LIB("odbccp32.lib", "pdo_odbc")) {
- EXTENSION("pdo_odbc", "pdo_odbc.c odbc_driver.c odbc_stmt.c");
- CHECK_HEADER_ADD_INCLUDE('sql.h', 'CFLAGS_PDO_ODBC');
- CHECK_HEADER_ADD_INCLUDE('sqlext.h', 'CFLAGS_PDO_ODBC');
- ADD_FLAG('CFLAGS_PDO_ODBC', "/I ..\\pecl");
- }
- ADD_EXTENSION_DEP('pdo_odbc', 'pdo');
-}
-
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
deleted file mode 100755
index e3d557bb00..0000000000
--- a/ext/pdo_odbc/odbc_driver.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "pdo/php_pdo.h"
-#include "pdo/php_pdo_driver.h"
-#include "php_pdo_odbc.h"
-#include "php_pdo_odbc_int.h"
-
-static struct {
- char state[6];
- enum pdo_error_type err;
-} odbc_to_pdo_err_map[] = {
- /* this table maps ODBC V3 SQLSTATE codes to PDO_ERR codes */
- { "42S01", PDO_ERR_ALREADY_EXISTS },
- { "42S11", PDO_ERR_ALREADY_EXISTS },
- { "42S21", PDO_ERR_ALREADY_EXISTS },
- { "IM001", PDO_ERR_NOT_IMPLEMENTED },
- { "42S22", PDO_ERR_NOT_FOUND },
- { "42S12", PDO_ERR_NOT_FOUND },
- { "42S02", PDO_ERR_NOT_FOUND },
- { "42000", PDO_ERR_SYNTAX },
- { "23000", PDO_ERR_CONSTRAINT },
- { "22025", PDO_ERR_SYNTAX },
- { "22019", PDO_ERR_SYNTAX },
- { "22018", PDO_ERR_SYNTAX },
- { "08S01", PDO_ERR_DISCONNECTED },
- { "01S07", PDO_ERR_TRUNCATED },
-
-};
-
-static HashTable err_hash;
-
-void pdo_odbc_fini_error_table(void)
-{
- zend_hash_destroy(&err_hash);
-}
-
-void pdo_odbc_init_error_table(void)
-{
- int i;
-
- zend_hash_init(&err_hash, 0, NULL, NULL, 1);
-
- for (i = 0; i < sizeof(odbc_to_pdo_err_map)/sizeof(odbc_to_pdo_err_map[0]); i++) {
- zend_hash_add(&err_hash, odbc_to_pdo_err_map[i].state, sizeof(odbc_to_pdo_err_map[i].state),
- &odbc_to_pdo_err_map[i].err, sizeof(odbc_to_pdo_err_map[i].err), NULL);
- }
-}
-
-static enum pdo_error_type pdo_odbc_map_error(char *state)
-{
- enum pdo_error_type *p_err;
- if (SUCCESS == zend_hash_find(&err_hash, state, sizeof(odbc_to_pdo_err_map[0].state), (void**)&p_err)) {
- return *p_err;
- }
- return PDO_ERR_CANT_MAP;
-}
-
-static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC)
-{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
- pdo_odbc_errinfo *einfo = &H->einfo;
- pdo_odbc_stmt *S = NULL;
- char *message = NULL;
-
- if (stmt) {
- S = (pdo_odbc_stmt*)stmt->driver_data;
- einfo = &S->einfo;
- }
-
- spprintf(&message, 0, "%s: %d %s [SQL State %s] (%s:%d)",
- einfo->what, einfo->last_error, einfo->last_err_msg, einfo->last_state, einfo->file, einfo->line);
-
- add_next_index_long(info, einfo->last_error);
- add_next_index_string(info, message, 0);
- add_next_index_string(info, einfo->last_state, 1);
-
- return 1;
-}
-
-
-void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, char *what, const char *file, int line TSRMLS_DC) /* {{{ */
-{
- RETCODE rc;
- SWORD errmsgsize;
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle*)dbh->driver_data;
- pdo_odbc_errinfo *einfo = &H->einfo;
- pdo_odbc_stmt *S = NULL;
- enum pdo_error_type *pdo_err = &dbh->error_code;
-
- if (stmt) {
- S = (pdo_odbc_stmt*)stmt->driver_data;
-
- einfo = &S->einfo;
- pdo_err = &stmt->error_code;
- }
-
- if (statement == SQL_NULL_HSTMT && S) {
- statement = S->stmt;
- }
-
- rc = SQLError(H->env, H->dbc, statement, einfo->last_state, &einfo->last_error,
- einfo->last_err_msg, sizeof(einfo->last_err_msg)-1, &errmsgsize);
-
- einfo->last_err_msg[errmsgsize] = '\0';
- einfo->file = file;
- einfo->line = line;
- einfo->what = what;
-
- *pdo_err = pdo_odbc_map_error(einfo->last_state);
-
- if (!dbh->methods) {
- zend_throw_exception_ex(php_pdo_get_exception(), *pdo_err TSRMLS_CC, "%s: %d %s [SQL State %s]",
- what, einfo->last_error, einfo->last_err_msg, einfo->last_state);
- }
-}
-/* }}} */
-
-static int odbc_handle_closer(pdo_dbh_t *dbh TSRMLS_DC)
-{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle*)dbh->driver_data;
-
- if (H->dbc != SQL_NULL_HANDLE) {
- SQLEndTran(SQL_HANDLE_DBC, H->dbc, SQL_ROLLBACK);
- SQLDisconnect(H->dbc);
- SQLFreeHandle(SQL_HANDLE_DBC, H->dbc);
- }
- SQLFreeHandle(SQL_HANDLE_ENV, H->env);
- pefree(H, dbh->is_persistent);
-
- return 0;
-}
-
-static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
-{
- RETCODE rc;
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
- pdo_odbc_stmt *S = ecalloc(1, sizeof(*S));
- enum pdo_cursor_type cursor_type = PDO_CURSOR_FWDONLY;
-
- S->H = H;
-
- rc = SQLAllocHandle(SQL_HANDLE_STMT, H->dbc, &S->stmt);
-
- if (rc == SQL_INVALID_HANDLE || rc == SQL_ERROR) {
- efree(S);
- pdo_odbc_drv_error("SQLAllocStmt");
- return 0;
- }
-
- cursor_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC);
- if (cursor_type != PDO_CURSOR_FWDONLY) {
- SQLUINTEGER cursor;
-
- switch (cursor_type) {
- case PDO_CURSOR_SCROLL:
- cursor = SQL_CURSOR_STATIC;
- default:
- ;
- }
-
- rc = SQLSetStmtAttr(S->stmt, SQL_CURSOR_TYPE, (void*)cursor, SQL_IS_UINTEGER);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- pdo_odbc_stmt_error("SQLSetStmtOption: SQL_CURSOR_TYPE");
- SQLFreeHandle(SQL_HANDLE_STMT, S->stmt);
- return 0;
- }
- }
-
- rc = SQLPrepare(S->stmt, (char*)sql, SQL_NTS);
-
- if (rc != SQL_SUCCESS) {
- pdo_odbc_stmt_error("SQLPrepare");
- }
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- SQLFreeHandle(SQL_HANDLE_STMT, S->stmt);
- return 0;
- }
-
- stmt->driver_data = S;
- stmt->methods = &odbc_stmt_methods;
-
- return 1;
-}
-
-static long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC)
-{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
- RETCODE rc;
- long row_count = -1;
- PDO_ODBC_HSTMT stmt;
-
- rc = SQLAllocHandle(SQL_HANDLE_STMT, H->dbc, &stmt);
- if (rc != SQL_SUCCESS) {
- pdo_odbc_drv_error("SQLAllocHandle: STMT");
- return -1;
- }
-
- rc = SQLExecDirect(stmt, (char *)sql, sql_len);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- pdo_odbc_doer_error("SQLExecDirect");
- goto out;
- }
-
- rc = SQLRowCount(stmt, &row_count);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- pdo_odbc_doer_error("SQLRowCount");
- goto out;
- }
-out:
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
- return row_count;
-}
-
-static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen TSRMLS_DC)
-{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
-
- return 0;
-}
-
-static int odbc_handle_begin(pdo_dbh_t *dbh TSRMLS_DC)
-{
- /* with ODBC, there is nothing special to be done */
- return 1;
-}
-
-static int odbc_handle_commit(pdo_dbh_t *dbh TSRMLS_DC)
-{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
- RETCODE rc;
-
- rc = SQLEndTran(SQL_HANDLE_DBC, H->dbc, SQL_COMMIT);
-
- if (rc != SQL_SUCCESS) {
- pdo_odbc_drv_error("SQLEndTran: Commit");
-
- if (rc != SQL_SUCCESS_WITH_INFO) {
- return 0;
- }
- }
- return 1;
-}
-
-static int odbc_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
-{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
- RETCODE rc;
-
- rc = SQLEndTran(SQL_HANDLE_DBC, H->dbc, SQL_ROLLBACK);
-
- if (rc != SQL_SUCCESS) {
- pdo_odbc_drv_error("SQLEndTran: Rollback");
-
- if (rc != SQL_SUCCESS_WITH_INFO) {
- return 0;
- }
- }
- return 1;
-}
-
-
-
-static struct pdo_dbh_methods odbc_methods = {
- odbc_handle_closer,
- odbc_handle_preparer,
- odbc_handle_doer,
- odbc_handle_quoter,
- odbc_handle_begin,
- odbc_handle_commit,
- odbc_handle_rollback,
- NULL, /* set attr */
- NULL, /* last id */
- pdo_odbc_fetch_error_func,
- NULL, /* get attr */
-};
-
-static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */
-{
- pdo_odbc_db_handle *H;
- RETCODE rc;
- int use_direct = 0;
- SQLUINTEGER cursor_lib;
-
- H = pecalloc(1, sizeof(*H), dbh->is_persistent);
-
- dbh->driver_data = H;
-
- SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &H->env);
- rc = SQLSetEnvAttr(H->env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- pdo_odbc_drv_error("SQLSetEnvAttr: ODBC3");
- odbc_handle_closer(dbh TSRMLS_CC);
- return 0;
- }
-
-#ifdef SQL_ATTR_CONNECTION_POOLING
- if (pdo_odbc_pool_on != SQL_CP_OFF) {
- rc = SQLSetEnvAttr(H->env, SQL_ATTR_CP_MATCH, (void*)pdo_odbc_pool_mode, 0);
- if (rc != SQL_SUCCESS) {
- pdo_odbc_drv_error("SQLSetEnvAttr: SQL_ATTR_CP_MATCH");
- odbc_handle_closer(dbh TSRMLS_CC);
- return 0;
- }
- }
-#endif
-
- rc = SQLAllocHandle(SQL_HANDLE_DBC, H->env, &H->dbc);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- pdo_odbc_drv_error("SQLAllocHandle (DBC)");
- odbc_handle_closer(dbh TSRMLS_CC);
- return 0;
- }
-
- if (!dbh->auto_commit) {
- rc = SQLSetConnectAttr(H->dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, SQL_IS_UINTEGER);
- if (rc != SQL_SUCCESS) {
- pdo_odbc_drv_error("SQLSetConnectAttr AUTOCOMMIT = OFF");
- odbc_handle_closer(dbh TSRMLS_CC);
- return 0;
- }
- }
-
- /* set up the cursor library, if needed, or if configured explicitly */
- cursor_lib = pdo_attr_lval(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC);
- rc = SQLSetConnectAttr(H->dbc, SQL_ODBC_CURSORS, (void*)cursor_lib, SQL_IS_UINTEGER);
- if (rc != SQL_SUCCESS) {
- pdo_odbc_drv_error("SQLSetConnectAttr SQL_ODBC_CURSORS");
- odbc_handle_closer(dbh TSRMLS_CC);
- return 0;
- }
-
-
- if (strchr(dbh->data_source, ';')) {
- char dsnbuf[1024];
- short dsnbuflen;
-
- use_direct = 1;
-
- /* Force UID and PWD to be set in the DSN */
- if (*dbh->username && !strstr(dbh->data_source, "uid") && !strstr(dbh->data_source, "UID")) {
- char *dsn = pemalloc(strlen(dbh->data_source) + strlen(dbh->username) + strlen(dbh->password) + sizeof(";UID=;PWD="), dbh->is_persistent);
- sprintf(dsn, "%s;UID=%s;PWD=%s", dbh->data_source, dbh->username, dbh->password);
- pefree((char*)dbh->data_source, dbh->is_persistent);
- dbh->data_source = dsn;
- }
-
- rc = SQLDriverConnect(H->dbc, NULL, (char*)dbh->data_source, strlen(dbh->data_source),
- dsnbuf, sizeof(dsnbuf)-1, &dsnbuflen, SQL_DRIVER_NOPROMPT);
- }
- if (!use_direct) {
- rc = SQLConnect(H->dbc, (char*)dbh->data_source, SQL_NTS, dbh->username, SQL_NTS, dbh->password, SQL_NTS);
- }
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- pdo_odbc_drv_error(use_direct ? "SQLDriverConnect" : "SQLConnect");
- odbc_handle_closer(dbh TSRMLS_CC);
- return 0;
- }
-
- /* TODO: if we want to play nicely, we should check to see if the driver really supports ODBC v3 or not */
-
- dbh->methods = &odbc_methods;
- dbh->alloc_own_columns = 1;
- dbh->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
-
- return 1;
-}
-/* }}} */
-
-pdo_driver_t pdo_odbc_driver = {
- PDO_DRIVER_HEADER(odbc),
- pdo_odbc_handle_factory
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
deleted file mode 100755
index 807b607803..0000000000
--- a/ext/pdo_odbc/odbc_stmt.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "pdo/php_pdo.h"
-#include "pdo/php_pdo_driver.h"
-#include "php_pdo_odbc.h"
-#include "php_pdo_odbc_int.h"
-
-static int odbc_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
-{
- pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
- int i;
-
- if (S->stmt != SQL_NULL_HANDLE) {
- if (stmt->executed) {
- SQLCancel(S->stmt);
- }
- SQLFreeHandle(SQL_HANDLE_STMT, S->stmt);
- S->stmt = SQL_NULL_HANDLE;
- }
-
- if (S->cols) {
- for (i = 0; i < stmt->column_count; i++) {
- if (S->cols[i].data) {
- efree(S->cols[i].data);
- }
- }
- efree(S->cols);
- S->cols = NULL;
- }
- efree(S);
-
- return 1;
-}
-
-static int odbc_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
-{
- RETCODE rc;
- pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
-
- if (stmt->executed) {
- SQLCancel(S->stmt);
- }
-
- rc = SQLExecute(S->stmt);
-
- switch (rc) {
- case SQL_SUCCESS:
- break;
- case SQL_NO_DATA_FOUND:
- case SQL_SUCCESS_WITH_INFO:
- pdo_odbc_stmt_error("SQLExecute");
- break;
-
- default:
- pdo_odbc_stmt_error("SQLExecute");
- return 0;
- }
-
- if (!stmt->executed) {
- /* do first-time-only definition of bind/mapping stuff */
- SQLSMALLINT colcount;
-
- /* how many columns do we have ? */
- SQLNumResultCols(S->stmt, &colcount);
-
- stmt->column_count = (int)colcount;
-
- S->cols = ecalloc(colcount, sizeof(pdo_odbc_column));
- }
-
- return 1;
-}
-
-static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *param,
- enum pdo_param_event event_type TSRMLS_DC)
-{
- pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
- RETCODE rc;
- SWORD sqltype, ctype, scale, nullable;
- UDWORD precision;
-
- /* we're only interested in parameters for prepared SQL right now */
- if (param->is_param) {
-
- switch (event_type) {
- case PDO_PARAM_EVT_ALLOC:
-
- /* figure out what we're doing */
- switch (param->param_type) {
- case PDO_PARAM_LOB:
- case PDO_PARAM_STMT:
- return 0;
-
- case PDO_PARAM_STR:
- default:
- convert_to_string(param->parameter);
- }
-
- SQLDescribeParam(S->stmt, param->paramno+1, &sqltype, &precision, &scale, &nullable);
- if (sqltype == SQL_BINARY || sqltype == SQL_VARBINARY || sqltype == SQL_LONGVARBINARY) {
- ctype = SQL_C_BINARY;
- } else {
- ctype = SQL_C_CHAR;
- }
-
- rc = SQLBindParameter(S->stmt, param->paramno+1,
- SQL_PARAM_INPUT, ctype, sqltype, precision, scale,
- Z_STRVAL_P(param->parameter), 0,
- /* XXX: this has the wrong type for DB2 */
- &Z_STRLEN_P(param->parameter)
- );
-
- return 1;
- }
- }
- return 1;
-}
-
-static int odbc_stmt_fetch(pdo_stmt_t *stmt TSRMLS_DC)
-{
- pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
- RETCODE rc;
-
- rc = SQLFetch(S->stmt);
-
- if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
- return 1;
- }
-
- if (rc == SQL_NO_DATA) {
- return 0;
- }
-
- pdo_odbc_stmt_error("SQLFetch");
-
- return 0;
-}
-
-static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
-{
- pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
- struct pdo_column_data *col = &stmt->columns[colno];
- zend_bool dyn = FALSE;
- RETCODE rc;
- SWORD colnamelen;
- SDWORD colsize;
-
- rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname,
- sizeof(S->cols[colno].colname)-1, &colnamelen,
- &S->cols[colno].coltype, &colsize, NULL, NULL);
-
- col->maxlen = S->cols[colno].datalen = colsize;
- col->namelen = colnamelen;
- col->name = S->cols[colno].colname;
-
- S->cols[colno].data = emalloc(colsize+1);
-
- /* returning data as a string */
- col->param_type = PDO_PARAM_STR;
-
- /* tell ODBC to put it straight into our buffer */
- rc = SQLBindCol(S->stmt, colno+1, SQL_C_CHAR, S->cols[colno].data,
- S->cols[colno].datalen, &S->cols[colno].fetched_len);
-
- return 1;
-}
-
-static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len TSRMLS_DC)
-{
- pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
- pdo_odbc_column *C = &S->cols[colno];
-
- /* check the indicator to ensure that the data is intact */
- if (C->fetched_len == SQL_NULL_DATA) {
- /* A NULL value */
- *ptr = NULL;
- *len = 0;
- return 1;
- } else if (C->fetched_len >= 0) {
- /* it was stored perfectly */
- *ptr = C->data;
- *len = C->fetched_len;
- return 1;
- } else {
- /* no data? */
- *ptr = NULL;
- *len = 0;
- return 1;
- }
-}
-
-static int odbc_stmt_set_param(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC)
-{
- SQLRETURN rc;
- pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
-
- switch (attr) {
- case PDO_ATTR_CURSOR_NAME:
- convert_to_string(val);
- rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val));
-
- if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
- return 1;
- }
- pdo_odbc_stmt_error("SQLSetCursorName");
- return 0;
-
- default:
- strcpy(S->einfo.last_err_msg, "Unknown Attribute");
- S->einfo.what = "setAttribute";
- stmt->error_code = PDO_ERR_NOT_IMPLEMENTED;
- S->einfo.last_state[0] = '\0';
- return -1;
- }
-
-
-}
-
-struct pdo_stmt_methods odbc_stmt_methods = {
- odbc_stmt_dtor,
- odbc_stmt_execute,
- odbc_stmt_fetch,
- odbc_stmt_describe,
- odbc_stmt_get_col,
- odbc_stmt_param_hook,
- odbc_stmt_set_param,
- NULL
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_odbc/package.xml b/ext/pdo_odbc/package.xml
deleted file mode 100755
index 7b86564b46..0000000000
--- a/ext/pdo_odbc/package.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE package SYSTEM "../pear/package.dtd">
-<package version="1.0">
- <name>PDO_ODBC</name>
- <summary>ODBC v3 Interface driver for PDO</summary>
- <maintainers>
- <maintainer>
- <user>wez</user>
- <name>Wez Furlong</name>
- <email>wez@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <configureoptions>
- <configureoption name="with-pdo-odbc" prompt="flavour,dir? (just leave blank for help)"/>
-</configureoptions>
- <description>
- This extension provides an ODBC v3 driver for PDO. It supports unixODBC
- and IBM DB2 libraries, and will support more in future releases.
- </description>
- <license>PHP</license>
- <release>
- <state>alpha</state>
- <version>0.1.1</version>
- <date>2004-05-22</date>
-
- <notes>
- You need to install the PDO core module before you can make use of this one.
- You also require either IBM DB2 CLI libraries or unixODBC.
-
- If you are running on windows, you can download the binary from here:
- http://snaps.php.net/win32/PECL_5_0/php_pdo_odbc.dll
-
- This release features working error reporting(!) and ODBC connection pooling.
- </notes>
-
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="config.w32"/>
- <file role="src" name="pdo_odbc.c"/>
- <file role="src" name="odbc_driver.c"/>
- <file role="src" name="odbc_stmt.c"/>
- <file role="src" name="php_pdo_odbc.h"/>
- <file role="src" name="php_pdo_odbc_int.h"/>
-
- <file role="doc" name="CREDITS"/>
- </filelist>
- <deps>
- <dep type="php" rel="ge" version="5.0.0RC3dev"/>
- <dep type="ext" rel="ge" name="pdo" version="0.1"/>
- </deps>
- </release>
-</package>
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
deleted file mode 100755
index e8dc26b5ae..0000000000
--- a/ext/pdo_odbc/pdo_odbc.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "pdo/php_pdo.h"
-#include "pdo/php_pdo_driver.h"
-#include "php_pdo_odbc.h"
-#include "php_pdo_odbc_int.h"
-
-#ifdef PHP_WIN32
-# define PDO_ODBC_TYPE "Win32"
-#endif
-
-#ifndef PDO_ODBC_TYPE
-# warning Please fix configure to give your ODBC libraries a name
-# define PDO_ODBC_TYPE "Unknown"
-#endif
-
-/* {{{ pdo_odbc_functions[] */
-function_entry pdo_odbc_functions[] = {
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ pdo_odbc_module_entry */
-zend_module_entry pdo_odbc_module_entry = {
- STANDARD_MODULE_HEADER,
- "PDO_ODBC",
- pdo_odbc_functions,
- PHP_MINIT(pdo_odbc),
- PHP_MSHUTDOWN(pdo_odbc),
- NULL,
- NULL,
- PHP_MINFO(pdo_odbc),
- "0.1.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_PDO_ODBC
-ZEND_GET_MODULE(pdo_odbc)
-#endif
-
-#ifdef SQL_ATTR_CONNECTION_POOLING
-SQLUINTEGER pdo_odbc_pool_on = SQL_CP_OFF;
-SQLUINTEGER pdo_odbc_pool_mode = SQL_CP_ONE_PER_HENV;
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION(pdo_odbc)
-{
-#ifdef SQL_ATTR_CONNECTION_POOLING
- char *pooling_val = NULL;
-#endif
-
- if (FAILURE == php_pdo_register_driver(&pdo_odbc_driver)) {
- return FAILURE;
- }
-
- pdo_odbc_init_error_table();
-
-#ifdef SQL_ATTR_CONNECTION_POOLING
- /* ugh, we don't really .ini stuff in PDO, but since ODBC connection
- * pooling is process wide, we can't set it from within the scope of a
- * request without affecting others, which goes against our isolated request
- * policy. So, we use cfg_get_string here to check it this once.
- * */
- if (FAILURE == cfg_get_string("pdo_odbc.connection_pooling", &pooling_val) || pooling_val == NULL) {
- pooling_val = "strict";
- }
- if (strcasecmp(pooling_val, "strict") == 0 || strcmp(pooling_val, "1") == 0) {
- pdo_odbc_pool_on = SQL_CP_ONE_PER_HENV;
- pdo_odbc_pool_mode = SQL_CP_STRICT_MATCH;
- } else if (strcasecmp(pooling_val, "relaxed") == 0) {
- pdo_odbc_pool_on = SQL_CP_ONE_PER_HENV;
- pdo_odbc_pool_mode = SQL_CP_RELAXED_MATCH;
- } else if (*pooling_val == '\0' || strcasecmp(pooling_val, "off") == 0) {
- pdo_odbc_pool_on = SQL_CP_OFF;
- } else {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error in pdo_odbc.connection_pooling configuration. Value MUST be one of 'strict', 'relaxed' or 'off'");
- return FAILURE;
- }
-
- if (pdo_odbc_pool_on != SQL_CP_OFF) {
- SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)pdo_odbc_pool_on, 0);
- }
-#endif
-
- REGISTER_LONG_CONSTANT("PDO_ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC, CONST_CS|CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(pdo_odbc)
-{
- php_pdo_unregister_driver(&pdo_odbc_driver);
- pdo_odbc_fini_error_table();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pdo_odbc)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "PDO Driver for ODBC (" PDO_ODBC_TYPE ")" , "enabled");
-#ifdef SQL_ATTR_CONNECTION_POOLING
- php_info_print_table_row(2, "ODBC Connection Pooling", pdo_odbc_pool_on == SQL_CP_OFF ?
- "Disabled" : (pdo_odbc_pool_mode == SQL_CP_STRICT_MATCH ? "Enabled, strict matching" : "Enabled, relaxed matching"));
-#else
- php_info_print_table_row(2, "ODBC Connection Pooling", "Not supported in this build");
-#endif
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h
deleted file mode 100644
index 1c2dcf4197..0000000000
--- a/ext/pdo_odbc/php_pdo_odbc.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDO_ODBC_H
-#define PHP_PDO_ODBC_H
-
-extern zend_module_entry pdo_odbc_module_entry;
-#define phpext_pdo_odbc_ptr &pdo_odbc_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_PDO_ODBC_API __declspec(dllexport)
-#else
-#define PHP_PDO_ODBC_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(pdo_odbc);
-PHP_MSHUTDOWN_FUNCTION(pdo_odbc);
-PHP_RINIT_FUNCTION(pdo_odbc);
-PHP_RSHUTDOWN_FUNCTION(pdo_odbc);
-PHP_MINFO_FUNCTION(pdo_odbc);
-
-PHP_FUNCTION(confirm_pdo_odbc_compiled); /* For testing, remove later. */
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(pdo_odbc)
- long global_value;
- char *global_string;
-ZEND_END_MODULE_GLOBALS(pdo_odbc)
-*/
-
-/* In every utility function you add that needs to use variables
- in php_pdo_odbc_globals, call TSRMLS_FETCH(); after declaring other
- variables used by that function, or better yet, pass in TSRMLS_CC
- after the last function argument and declare your utility function
- with TSRMLS_DC after the last declared argument. Always refer to
- the globals in your function as PDO_ODBC_G(variable). You are
- encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define PDO_ODBC_G(v) TSRMG(pdo_odbc_globals_id, zend_pdo_odbc_globals *, v)
-#else
-#define PDO_ODBC_G(v) (pdo_odbc_globals.v)
-#endif
-
-#endif /* PHP_PDO_ODBC_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h
deleted file mode 100755
index e249be5687..0000000000
--- a/ext/pdo_odbc/php_pdo_odbc_int.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* {{{ Roll a dice, pick a header at random... */
-#if HAVE_SQLCLI1_H
-# include <sqlcli1.h>
-# if defined(DB268K) && HAVE_LIBRARYMANAGER_H
-# include <LibraryManager.h>
-# endif
-#endif
-
-#if HAVE_ODBC_H
-# include <odbc.h>
-#endif
-
-#if HAVE_IODBC_H
-# include <iodbc.h>
-#endif
-
-#if HAVE_SQLUNIX_H && !defined(PHP_WIN32)
-# include <sqlunix.h>
-#endif
-
-#if HAVE_SQLTYPES_H
-# include <sqltypes.h>
-#endif
-
-#if HAVE_SQLUCODE_H
-# include <sqlucode.h>
-#endif
-
-#if HAVE_SQL_H
-# include <sql.h>
-#endif
-
-#if HAVE_ISQL_H
-# include <isql.h>
-#endif
-
-#if HAVE_SQLEXT_H
-# include <sqlext.h>
-#endif
-
-#if HAVE_ISQLEXT_H
-# include <isqlext.h>
-#endif
-
-#if HAVE_UDBCEXT_H
-# include <udbcext.h>
-#endif
-
-#if HAVE_CLI0CORE_H
-# include <cli0core.h>
-#endif
-
-#if HAVE_CLI0EXT1_H
-# include <cli0ext.h>
-#endif
-
-#if HAVE_CLI0CLI_H
-# include <cli0cli.h>
-#endif
-
-#if HAVE_CLI0DEFS_H
-# include <cli0defs.h>
-#endif
-
-#if HAVE_CLI0ENV_H
-# include <cli0env.h>
-#endif
-
-/* }}} */
-
-/* {{{ Figure out the type for handles */
-#if !defined(HENV) && !defined(SQLHENV) && defined(SQLHANDLE)
-# define PDO_ODBC_HENV SQLHANDLE
-# define PDO_ODBC_HDBC SQLHANDLE
-# define PDO_ODBC_HSTMT SQLHANDLE
-#elif !defined(HENV) && (defined(SQLHENV) || defined(DB2CLI_VER))
-# define PDO_ODBC_HENV SQLHENV
-# define PDO_ODBC_HDBC SQLHDBC
-# define PDO_ODBC_HSTMT SQLHSTMT
-#else
-# define PDO_ODBC_HENV HENV
-# define PDO_ODBC_HDBC HDBC
-# define PDO_ODBC_HSTMT HSTMT
-#endif
-/* }}} */
-
-typedef struct {
- char last_state[6];
- char last_err_msg[SQL_MAX_MESSAGE_LENGTH];
- SDWORD last_error;
- const char *file, *what;
- int line;
-} pdo_odbc_errinfo;
-
-typedef struct {
- PDO_ODBC_HENV env;
- PDO_ODBC_HDBC dbc;
- pdo_odbc_errinfo einfo;
-} pdo_odbc_db_handle;
-
-typedef struct {
- char *data;
- unsigned long datalen;
- long fetched_len;
- SWORD coltype;
- char colname[32];
-} pdo_odbc_column;
-
-typedef struct {
- PDO_ODBC_HSTMT stmt;
- pdo_odbc_column *cols;
- pdo_odbc_db_handle *H;
- pdo_odbc_errinfo einfo;
-} pdo_odbc_stmt;
-
-extern pdo_driver_t pdo_odbc_driver;
-extern struct pdo_stmt_methods odbc_stmt_methods;
-
-void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, char *what, const char *file, int line TSRMLS_DC);
-#define pdo_odbc_drv_error(what) pdo_odbc_error(dbh, NULL, SQL_NULL_HSTMT, what, __FILE__, __LINE__ TSRMLS_CC)
-#define pdo_odbc_stmt_error(what) pdo_odbc_error(stmt->dbh, stmt, SQL_NULL_HSTMT, what, __FILE__, __LINE__ TSRMLS_CC)
-#define pdo_odbc_doer_error(what) pdo_odbc_error(dbh, NULL, stmt, what, __FILE__, __LINE__ TSRMLS_CC)
-
-void pdo_odbc_init_error_table(void);
-void pdo_odbc_fini_error_table(void);
-
-#ifdef SQL_ATTR_CONNECTION_POOLING
-extern SQLUINTEGER pdo_odbc_pool_on;
-extern SQLUINTEGER pdo_odbc_pool_mode;
-#endif
-
-enum {
- PDO_ODBC_ATTR_USE_CURSOR_LIBRARY = PDO_ATTR_DRIVER_SPECIFIC,
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */