diff options
Diffstat (limited to 'ext/pdo_odbc')
32 files changed, 0 insertions, 2758 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 139597f9cb..0000000000 --- a/ext/pdo_odbc/EXPERIMENTAL +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4 deleted file mode 100755 index db7824a795..0000000000 --- a/ext/pdo_odbc/config.m4 +++ /dev/null @@ -1,145 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension pdo_odbc -dnl vim:et:sw=2:ts=2: - -if test "$PHP_PDO" != "no"; then - -define([PDO_ODBC_HELP_TEXT],[[ - include and lib dirs are looked under 'dir'. - 'flavour' can be one of: ibm-db2, unixODBC, generic - If ',dir' part is omitted, default for the flavour - you have selected will used. e.g.: - --with-pdo-odbc=unixODBC - will check for unixODBC under /usr/local. You may attempt - to use an otherwise unsupported driver using the \"generic\" - flavour. The syntax for generic ODBC support is: - --with-pdo-odbc=generic,dir,ldflags,cflags - This extension will always be created as a shared extension - named pdo_odbc.so]]) - -PHP_ARG_WITH(pdo-odbc, for ODBC v3 support for PDO, -[ --with-pdo-odbc=flavour,dir - PDO: Support for 'flavour' ODBC driver.]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 -]) - -if test "$PHP_PDO_ODBC" != "no"; then - AC_MSG_CHECKING([for selected PDO ODBC flavour]) - - 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/db2inst1/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 - ;; - - ODBCRouter) - pdo_odbc_def_libdir=/usr/lib - pdo_odbc_def_incdir=/usr/include - pdo_odbc_def_lib=-lodbcsdk - ;; - - generic) - pdo_odbc_def_lib="`echo $withval | cut -d, -f3`" - pdo_odbc_def_cflags="`echo $withval | cut -d, -f4`" - pdo_odbc_flavour="$pdo_odbc_flavour ($pdo_odbc_def_lib)" - ;; - - *) - 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(odbcsdk.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="$pdo_odbc_def_cflags -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" - dnl Check for an ODBC 1.0 function to assert that the libraries work - AC_TRY_LINK_FUNC([SQLBindCol],[],[ - AC_MSG_ERROR([[Your ODBC library does not exist]]) - ]) - dnl And now check for an ODBC 3.0 function to assert that they're - dnl *good* libraries. - AC_TRY_LINK_FUNC([SQLAllocHandle],[],[ - AC_MSG_ERROR([[ -Your ODBC library does not appear to be ODBC 3 compatible. -You should consider using unixODBC instead, and loading your -libraries as a driver in that environment; it will emulate the -functions required for PDO support. -]]) - ]) - LDFLAGS=$save_old_LDFLAGS - PHP_EVAL_LIBLINE($PDO_ODBC_LIBS $PDO_ODBC_LFLAGS, [PDO_ODBC_SHARED_LIBADD]) - PHP_SUBST(PDO_ODBC_SHARED_LIBADD) - - AC_MSG_CHECKING([for PDO includes]) - if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$abs_srcdir/ext - elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$abs_srcdir/ext - elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then - pdo_inc_path=$prefix/include/php/ext - else - AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) - fi - AC_MSG_RESULT($pdo_inc_path) - - PHP_NEW_EXTENSION(pdo_odbc, pdo_odbc.c odbc_driver.c odbc_stmt.c, $ext_shared,,-I$pdo_inc_path $PDO_ODBC_INCLUDE) - PHP_ADD_EXTENSION_DEP(pdo_odbc, pdo) -fi - -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 aa543360c8..0000000000 --- a/ext/pdo_odbc/odbc_driver.c +++ /dev/null @@ -1,398 +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" -#include "zend_exceptions.h" - -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 (%s[%ld] at %s:%d)", - einfo->last_err_msg, - einfo->what, einfo->last_error, - 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; - 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; - - strcpy(*pdo_err, einfo->last_state); - - if (!dbh->methods) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s", - *pdo_err, what, einfo->last_error, einfo->last_err_msg); - } -} -/* }}} */ - -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, 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; - int ret; - char *nsql = NULL; - int nsql_len = 0; - - S->H = H; - - /* before we prepare, we need to peek at the query; if it uses named parameters, - * we want PDO to rewrite them for us */ - stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL; - ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len TSRMLS_CC); - - if (ret == 1) { - /* query was re-written */ - sql = nsql; - } else if (ret == -1) { - /* couldn't grok it */ - strcpy(dbh->error_code, stmt->error_code); - efree(S); - return 0; - } - - rc = SQLAllocHandle(SQL_HANDLE_STMT, H->dbc, &S->stmt); - - if (rc == SQL_INVALID_HANDLE || rc == SQL_ERROR) { - efree(S); - if (nsql) { - efree(nsql); - } - 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) { - rc = SQLSetStmtAttr(S->stmt, SQL_ATTR_CURSOR_SCROLLABLE, (void*)SQL_SCROLLABLE, 0); - if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - pdo_odbc_stmt_error("SQLSetStmtAttr: SQL_ATTR_CURSOR_SCROLLABLE"); - SQLFreeHandle(SQL_HANDLE_STMT, S->stmt); - if (nsql) { - efree(nsql); - } - return 0; - } - } - - rc = SQLPrepare(S->stmt, (char*)sql, SQL_NTS); - if (nsql) { - efree(nsql); - } - - 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, enum pdo_param_type param_type 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 int odbc_handle_get_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) -{ - switch (attr) { - case PDO_ATTR_CLIENT_VERSION: - ZVAL_STRING(val, "ODBC-" PDO_ODBC_TYPE, 1); - return 1; - - case PDO_ATTR_SERVER_VERSION: - case PDO_ATTR_PREFETCH: - case PDO_ATTR_TIMEOUT: - case PDO_ATTR_SERVER_INFO: - case PDO_ATTR_CONNECTION_STATUS: - break; - - } - return 0; -} - -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, - odbc_handle_get_attr, /* get attr */ - NULL, /* check_liveness */ -}; - -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, 0); - if (rc != SQL_SUCCESS && cursor_lib != SQL_CUR_USE_IF_NEEDED) { - 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 && *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; - - 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 daf8967d9e..0000000000 --- a/ext/pdo_odbc/odbc_stmt.c +++ /dev/null @@ -1,449 +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 void free_cols(pdo_stmt_t *stmt, pdo_odbc_stmt *S TSRMLS_DC) -{ - if (S->cols) { - int i; - - for (i = 0; i < stmt->column_count; i++) { - if (S->cols[i].data) { - efree(S->cols[i].data); - } - } - efree(S->cols); - S->cols = NULL; - } -} - -static int odbc_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) -{ - pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; - - if (S->stmt != SQL_NULL_HANDLE) { - if (stmt->executed) { - SQLCancel(S->stmt); - } - SQLFreeHandle(SQL_HANDLE_STMT, S->stmt); - S->stmt = SQL_NULL_HANDLE; - } - - free_cols(stmt, S TSRMLS_CC); - - 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; - char *buf = NULL; - - if (stmt->executed) { - SQLCancel(S->stmt); - } - - rc = SQLExecute(S->stmt); - - while (rc == SQL_NEED_DATA) { - struct pdo_bound_param_data *param; - rc = SQLParamData(S->stmt, (SQLPOINTER*)¶m); - if (rc == SQL_NEED_DATA) { - php_stream *stm; - int len; - - if (Z_TYPE_P(param->parameter) != IS_RESOURCE) { - /* they passed in a string */ - SQLPutData(S->stmt, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - continue; - } - - php_stream_from_zval_no_verify(stm, ¶m->parameter); - if (!stm) { - /* shouldn't happen either */ - pdo_odbc_stmt_error("input LOB is no longer a stream"); - SQLCancel(S->stmt); - if (buf) { - efree(buf); - } - return 0; - } - - /* now suck data from the stream and stick it into the database */ - if (buf == NULL) { - buf = emalloc(8192); - } - - do { - len = php_stream_read(stm, buf, 8192); - if (len == 0) { - break; - } - SQLPutData(S->stmt, buf, len); - } while (1); - } - } - - if (buf) { - efree(buf); - } - - 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; - pdo_odbc_param *P; - - /* we're only interested in parameters for prepared SQL right now */ - if (param->is_param) { - - switch (event_type) { - case PDO_PARAM_EVT_FREE: - P = param->driver_data; - if (P) { - efree(P); - } - break; - - case PDO_PARAM_EVT_ALLOC: - { - /* figure out what we're doing */ - switch (PDO_PARAM_TYPE(param->param_type)) { - case PDO_PARAM_LOB: - break; - - 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; - } - - P = emalloc(sizeof(*P)); - param->driver_data = P; - - P->len = 0; /* is re-populated each EXEC_PRE */ - - if ((param->param_type & PDO_PARAM_INPUT_OUTPUT) == PDO_PARAM_INPUT_OUTPUT) { - P->paramtype = SQL_PARAM_INPUT_OUTPUT; - } else if (param->max_value_len <= 0) { - P->paramtype = SQL_PARAM_INPUT; - } else { - P->paramtype = SQL_PARAM_OUTPUT; - } - if (P->paramtype != SQL_PARAM_INPUT && PDO_PARAM_TYPE(param->param_type) != PDO_PARAM_LOB && param->max_value_len > Z_STRLEN_P(param->parameter)) { - Z_STRVAL_P(param->parameter) = erealloc(Z_STRVAL_P(param->parameter), param->max_value_len + 1); - } - - if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB && P->paramtype != SQL_PARAM_INPUT) { - pdo_odbc_stmt_error("Can't bind a lob for output"); - return 0; - } - - rc = SQLBindParameter(S->stmt, param->paramno+1, - P->paramtype, ctype, sqltype, precision, scale, - P->paramtype == SQL_PARAM_INPUT && - PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB ? - (SQLPOINTER)param : - Z_STRVAL_P(param->parameter), - param->max_value_len <= 0 ? 0 : param->max_value_len, - &P->len - ); - - if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { - return 1; - } - pdo_odbc_stmt_error("SQLBindParameter"); - return 0; - } - - case PDO_PARAM_EVT_EXEC_PRE: - P = param->driver_data; - if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB) { - if (Z_TYPE_P(param->parameter) == IS_RESOURCE) { - php_stream *stm; - php_stream_statbuf sb; - - php_stream_from_zval_no_verify(stm, ¶m->parameter); - - if (!stm) { - return 0; - } - - if (0 == php_stream_stat(stm, &sb)) { - P->len = SQL_LEN_DATA_AT_EXEC(sb.sb.st_size); - } else { - P->len = SQL_LEN_DATA_AT_EXEC(0); - } - } else { - convert_to_string(param->parameter); - P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(param->parameter)); - } - } else { - P->len = Z_STRLEN_P(param->parameter); - } - return 1; - - case PDO_PARAM_EVT_EXEC_POST: - if (Z_TYPE_P(param->parameter) == IS_STRING) { - P = param->driver_data; - Z_STRLEN_P(param->parameter) = P->len; - Z_STRVAL_P(param->parameter)[P->len] = '\0'; - } - return 1; - } - } - return 1; -} - -static int odbc_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) -{ - pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; - RETCODE rc; - SQLSMALLINT odbcori; - - switch (ori) { - case PDO_FETCH_ORI_NEXT: odbcori = SQL_FETCH_NEXT; break; - case PDO_FETCH_ORI_PRIOR: odbcori = SQL_FETCH_PRIOR; break; - case PDO_FETCH_ORI_FIRST: odbcori = SQL_FETCH_FIRST; break; - case PDO_FETCH_ORI_LAST: odbcori = SQL_FETCH_LAST; break; - case PDO_FETCH_ORI_ABS: odbcori = SQL_FETCH_ABSOLUTE; break; - case PDO_FETCH_ORI_REL: odbcori = SQL_FETCH_RELATIVE; break; - default: - strcpy(stmt->error_code, "HY106"); - return 0; - } - rc = SQLFetchScroll(S->stmt, odbcori, offset); - - if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { - return 1; - } - - if (rc == SQL_NO_DATA) { - return 0; - } - - pdo_odbc_stmt_error("SQLFetchScroll"); - - 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 = estrdup(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+1, &S->cols[colno].fetched_len); - - return 1; -} - -static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int *caller_frees 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"; - strcpy(S->einfo.last_state, "IM0001"); - return -1; - } -} - -static int odbc_stmt_get_attr(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: - { - char buf[256]; - SQLSMALLINT len = 0; - rc = SQLGetCursorName(S->stmt, buf, sizeof(buf), &len); - - if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { - ZVAL_STRINGL(val, buf, len, 1); - return 1; - } - pdo_odbc_stmt_error("SQLGetCursorName"); - return 0; - } - - default: - strcpy(S->einfo.last_err_msg, "Unknown Attribute"); - S->einfo.what = "getAttribute"; - strcpy(S->einfo.last_state, "IM0001"); - return -1; - } -} - -static int odbc_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) -{ - SQLRETURN rc; - SQLSMALLINT colcount; - pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; - - free_cols(stmt, S TSRMLS_CC); - - rc = SQLMoreResults(S->stmt); - - if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { - return 0; - } - - /* 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; -} - -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, - odbc_stmt_get_attr, /* get attr */ - NULL, /* get column meta */ - odbc_stmt_next_rowset -}; - -/* - * 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 94f28de85c..0000000000 --- a/ext/pdo_odbc/package.xml +++ /dev/null @@ -1,52 +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>beta</state>
- <version>0.2</version>
- <date>2005-02-09</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
-
- </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.3"/>
- <dep type="ext" rel="ge" name="pdo" version="0.2"/>
- </deps>
- </release>
-</package>
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c deleted file mode 100755 index 1965da9fde..0000000000 --- a/ext/pdo_odbc/pdo_odbc.c +++ /dev/null @@ -1,143 +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" - -/* {{{ 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.2", - 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; - } - -#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); - 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 4fb493dcfd..0000000000 --- a/ext/pdo_odbc/php_pdo_odbc_int.h +++ /dev/null @@ -1,181 +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 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 - -/* {{{ 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 - -#if HAVE_ODBCSDK_H -# include <odbcsdk.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; - -typedef struct { - SQLINTEGER len; - SQLSMALLINT paramtype; -} pdo_odbc_param; - -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 - */ diff --git a/ext/pdo_odbc/tests/connection.inc b/ext/pdo_odbc/tests/connection.inc deleted file mode 100755 index 0d5ff88843..0000000000 --- a/ext/pdo_odbc/tests/connection.inc +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -$USER = 'db2inst1'; -$PASSWD = 'ibmdb2'; -$DBNAME = 'SAMPLE'; - -$CONNECTION = "odbc:$DBNAME"; - -$PDO_TESTS = dirname(__FILE__) . '/../../pdo/tests/'; - -?> diff --git a/ext/pdo_odbc/tests/pdo_001.phpt b/ext/pdo_odbc/tests/pdo_001.phpt deleted file mode 100755 index b9e2caad0f..0000000000 --- a/ext/pdo_odbc/tests/pdo_001.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_ASSOC ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_001.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -array(3) { - [0]=> - array(2) { - ["ID"]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - } - [1]=> - array(2) { - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - } - [2]=> - array(2) { - ["ID"]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_002.phpt b/ext/pdo_odbc/tests/pdo_002.phpt deleted file mode 100755 index 9c1e79fe8c..0000000000 --- a/ext/pdo_odbc/tests/pdo_002.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_NUM ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_002.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -array(3) { - [0]=> - array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "A" - } - [1]=> - array(2) { - [0]=> - string(1) "2" - [1]=> - string(1) "B" - } - [2]=> - array(2) { - [0]=> - string(1) "3" - [1]=> - string(1) "C" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_003.phpt b/ext/pdo_odbc/tests/pdo_003.phpt deleted file mode 100755 index c48d3a4c5a..0000000000 --- a/ext/pdo_odbc/tests/pdo_003.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_BOTH ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_003.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -array(3) { - [0]=> - array(4) { - ["ID"]=> - string(1) "1" - [0]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - [1]=> - string(1) "A" - } - [1]=> - array(4) { - ["ID"]=> - string(1) "2" - [0]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - [1]=> - string(1) "B" - } - [2]=> - array(4) { - ["ID"]=> - string(1) "3" - [0]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - [1]=> - string(1) "C" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_004.phpt b/ext/pdo_odbc/tests/pdo_004.phpt deleted file mode 100755 index d5321f1d2a..0000000000 --- a/ext/pdo_odbc/tests/pdo_004.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_OBJ ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_004.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(3) { - [0]=> - object(stdClass)#%d (2) { - ["ID"]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - } - [1]=> - object(stdClass)#%d (2) { - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - } - [2]=> - object(stdClass)#%d (2) { - ["ID"]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_005.phpt b/ext/pdo_odbc/tests/pdo_005.phpt deleted file mode 100755 index c302208c6a..0000000000 --- a/ext/pdo_odbc/tests/pdo_005.phpt +++ /dev/null @@ -1,154 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_CLASS ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array( - 'create'=>'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))' -); - -require_once($PDO_TESTS . 'pdo_005.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(3) { - [0]=> - object(stdClass)#%d (3) { - ["ID"]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - ["VAL2"]=> - string(2) "AA" - } - [1]=> - object(stdClass)#%d (3) { - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - ["VAL2"]=> - string(2) "BB" - } - [2]=> - object(stdClass)#%d (3) { - ["ID"]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - ["VAL2"]=> - string(2) "CC" - } -} -array(3) { - [0]=> - object(TestBase)#%d (6) { - ["id"]=> - NULL - ["val:protected"]=> - NULL - ["val2:private"]=> - NULL - ["ID"]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - ["VAL2"]=> - string(2) "AA" - } - [1]=> - object(TestBase)#%d (6) { - ["id"]=> - NULL - ["val:protected"]=> - NULL - ["val2:private"]=> - NULL - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - ["VAL2"]=> - string(2) "BB" - } - [2]=> - object(TestBase)#%d (6) { - ["id"]=> - NULL - ["val:protected"]=> - NULL - ["val2:private"]=> - NULL - ["ID"]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - ["VAL2"]=> - string(2) "CC" - } -} -TestDerived::__construct(0,) -TestDerived::__construct(1,) -TestDerived::__construct(2,) -array(3) { - [0]=> - object(TestDerived)#%d (7) { - ["row:protected"]=> - int(0) - ["id"]=> - NULL - ["val:protected"]=> - NULL - ["val2:private"]=> - NULL - ["ID"]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - ["VAL2"]=> - string(2) "AA" - } - [1]=> - object(TestDerived)#%d (7) { - ["row:protected"]=> - int(1) - ["id"]=> - NULL - ["val:protected"]=> - NULL - ["val2:private"]=> - NULL - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - ["VAL2"]=> - string(2) "BB" - } - [2]=> - object(TestDerived)#%d (7) { - ["row:protected"]=> - int(2) - ["id"]=> - NULL - ["val:protected"]=> - NULL - ["val2:private"]=> - NULL - ["ID"]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - ["VAL2"]=> - string(2) "CC" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_006.phpt b/ext/pdo_odbc/tests/pdo_006.phpt deleted file mode 100755 index 5cb31fe962..0000000000 --- a/ext/pdo_odbc/tests/pdo_006.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_GROUP ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_006.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(2) { - ["A"]=> - array(2) { - [0]=> - array(1) { - [0]=> - string(1) "1" - } - [1]=> - array(1) { - [0]=> - string(1) "2" - } - } - ["C"]=> - array(1) { - [0]=> - array(1) { - [0]=> - string(1) "3" - } - } -} -array(2) { - ["A"]=> - array(2) { - [0]=> - array(1) { - ["ID"]=> - string(1) "1" - } - [1]=> - array(1) { - ["ID"]=> - string(1) "2" - } - } - ["C"]=> - array(1) { - [0]=> - array(1) { - ["ID"]=> - string(1) "3" - } - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_007.phpt b/ext/pdo_odbc/tests/pdo_007.phpt deleted file mode 100755 index 0412b977ab..0000000000 --- a/ext/pdo_odbc/tests/pdo_007.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_UNIQUE ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array('create'=>'CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); - -require_once($PDO_TESTS . 'pdo_007.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(3) { - ["A"]=> - array(1) { - [0]=> - string(1) "A" - } - ["B"]=> - array(1) { - [0]=> - string(1) "A" - } - ["C"]=> - array(1) { - [0]=> - string(1) "C" - } -} -array(3) { - ["A"]=> - array(1) { - ["VAL"]=> - string(1) "A" - } - ["B"]=> - array(1) { - ["VAL"]=> - string(1) "A" - } - ["C"]=> - array(1) { - ["VAL"]=> - string(1) "C" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_008.phpt b/ext/pdo_odbc/tests/pdo_008.phpt deleted file mode 100755 index d1b3508b7d..0000000000 --- a/ext/pdo_odbc/tests/pdo_008.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_UNIQUE conflict ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array('create'=>'CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))'); - -require_once($PDO_TESTS . 'pdo_008.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(2) { - ["A"]=> - array(1) { - [0]=> - string(1) "B" - } - ["C"]=> - array(1) { - [0]=> - string(1) "C" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_009.phpt b/ext/pdo_odbc/tests/pdo_009.phpt deleted file mode 100755 index 291b1e8efb..0000000000 --- a/ext/pdo_odbc/tests/pdo_009.phpt +++ /dev/null @@ -1,94 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_CLASSTYPE ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array ( - 'create1'=>'CREATE TABLE classtypes(id INT NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)', - 'create2'=>'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, classtype INT, val VARCHAR(10))' -); - -require_once($PDO_TESTS . 'pdo_009.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(4) { - [0]=> - array(3) { - [0]=> - string(8) "stdClass" - [1]=> - string(1) "1" - [2]=> - string(1) "A" - } - [1]=> - array(3) { - [0]=> - string(5) "Test1" - [1]=> - string(1) "2" - [2]=> - string(1) "B" - } - [2]=> - array(3) { - [0]=> - string(5) "Test2" - [1]=> - string(1) "3" - [2]=> - string(1) "C" - } - [3]=> - array(3) { - [0]=> - NULL - [1]=> - string(1) "4" - [2]=> - string(1) "D" - } -} -Test1::__construct() -Test2::__construct() -Test3::__construct() -array(4) { - [0]=> - object(stdClass)#%d (2) { - ["ID"]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - } - [1]=> - object(Test1)#%d (2) { - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - } - [2]=> - object(Test2)#%d (2) { - ["ID"]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - } - [3]=> - object(Test3)#%d (2) { - ["ID"]=> - string(1) "4" - ["VAL"]=> - string(1) "D" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_010.phpt b/ext/pdo_odbc/tests/pdo_010.phpt deleted file mode 100755 index a0c7ab398e..0000000000 --- a/ext/pdo_odbc/tests/pdo_010.phpt +++ /dev/null @@ -1,81 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_(CLASSTYPE and GROUP/UNIQUE) ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array( - 'create1'=>'CREATE TABLE classtypes(id INT NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)', - 'create2'=>'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, classtype INT, val VARCHAR(10), grp VARCHAR(10))' -); - -require_once($PDO_TESTS . 'pdo_010.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Test1::__construct() -Test2::__construct() -Test3::__construct() -array(2) { - ["Group1"]=> - array(2) { - [0]=> - object(stdClass)#%d (2) { - ["ID"]=> - string(1) "1" - ["VAL"]=> - string(1) "A" - } - [1]=> - object(Test1)#%d (2) { - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - } - } - ["Group2"]=> - array(2) { - [0]=> - object(Test2)#%d (2) { - ["ID"]=> - string(1) "3" - ["VAL"]=> - string(1) "C" - } - [1]=> - object(Test3)#%d (2) { - ["ID"]=> - string(1) "4" - ["VAL"]=> - string(1) "D" - } - } -} -Test1::__construct() -Test2::__construct() -Test3::__construct() -array(2) { - ["Group1"]=> - object(Test1)#%d (2) { - ["ID"]=> - string(1) "2" - ["VAL"]=> - string(1) "B" - } - ["Group2"]=> - object(Test3)#%d (2) { - ["ID"]=> - string(1) "4" - ["VAL"]=> - string(1) "D" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_011.phpt b/ext/pdo_odbc/tests/pdo_011.phpt deleted file mode 100755 index c41dd44d05..0000000000 --- a/ext/pdo_odbc/tests/pdo_011.phpt +++ /dev/null @@ -1,183 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_FUNC and statement overloading ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array('create'=>'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); - -require_once($PDO_TESTS . 'pdo_011.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Test1::__construct(0,0) -test(1,N/A) -test(2,N/A) -test(3,N/A) -test(4,N/A) -array(2) { - ["Group1"]=> - array(2) { - [0]=> - array(1) { - [1]=> - string(3) "N/A" - } - [1]=> - array(1) { - [2]=> - string(3) "N/A" - } - } - ["Group2"]=> - array(2) { - [0]=> - array(1) { - [3]=> - string(3) "N/A" - } - [1]=> - array(1) { - [4]=> - string(3) "N/A" - } - } -} -test(1,A) -test(2,B) -test(3,C) -test(4,D) -array(4) { - [0]=> - array(1) { - [1]=> - string(1) "A" - } - [1]=> - array(1) { - [2]=> - string(1) "B" - } - [2]=> - array(1) { - [3]=> - string(1) "C" - } - [3]=> - array(1) { - [4]=> - string(1) "D" - } -} -Test1::factory(1,A) -Test1::__construct(1,A) -Test1::factory(2,B) -Test1::__construct(2,B) -Test1::factory(3,C) -Test1::__construct(3,C) -Test1::factory(4,D) -Test1::__construct(4,D) -array(4) { - [0]=> - object(Test1)#%d (2) { - ["id"]=> - int(1) - ["val"]=> - string(1) "A" - } - [1]=> - object(Test1)#%d (2) { - ["id"]=> - int(2) - ["val"]=> - string(1) "B" - } - [2]=> - object(Test1)#%d (2) { - ["id"]=> - int(3) - ["val"]=> - string(1) "C" - } - [3]=> - object(Test1)#%d (2) { - ["id"]=> - int(4) - ["val"]=> - string(1) "D" - } -} -Test1::factory(1,A) -Test1::__construct(1,A) -Test1::factory(2,B) -Test1::__construct(2,B) -Test1::factory(3,C) -Test1::__construct(3,C) -Test1::factory(4,D) -Test1::__construct(4,D) -array(4) { - [0]=> - object(Test1)#%d (2) { - ["id"]=> - int(1) - ["val"]=> - string(1) "A" - } - [1]=> - object(Test1)#%d (2) { - ["id"]=> - int(2) - ["val"]=> - string(1) "B" - } - [2]=> - object(Test1)#%d (2) { - ["id"]=> - int(3) - ["val"]=> - string(1) "C" - } - [3]=> - object(Test1)#%d (2) { - ["id"]=> - int(4) - ["val"]=> - string(1) "D" - } -} -DerivedStatement::__construct(Overloaded) -string(16) "DerivedStatement" -DerivedStatement::retrieve(1,A) -DerivedStatement::retrieve(2,B) -DerivedStatement::retrieve(3,C) -DerivedStatement::retrieve(4,D) -array(4) { - [0]=> - array(1) { - [1]=> - string(1) "A" - } - [1]=> - array(1) { - [2]=> - string(1) "B" - } - [2]=> - array(1) { - [3]=> - string(1) "C" - } - [3]=> - array(1) { - [4]=> - string(1) "D" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_012.phpt b/ext/pdo_odbc/tests/pdo_012.phpt deleted file mode 100755 index 59a30b3cf4..0000000000 --- a/ext/pdo_odbc/tests/pdo_012.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -PDO_ODBC: PDOStatement::setFetchMode ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array('create'=>'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); - -require_once($PDO_TESTS . 'pdo_012.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(2) { - [0]=> - array(2) { - [0]=> - string(1) "A" - [1]=> - string(6) "Group1" - } - [1]=> - array(2) { - [0]=> - string(1) "B" - [1]=> - string(6) "Group2" - } -} -Test::__construct(N/A) -Test::__construct(N/A) -array(2) { - [0]=> - object(Test)#%d (2) { - ["VAL"]=> - string(1) "A" - ["GRP"]=> - string(6) "Group1" - } - [1]=> - object(Test)#%d (2) { - ["VAL"]=> - string(1) "B" - ["GRP"]=> - string(6) "Group2" - } -} -Test::__construct(Changed) -Test::__construct(Changed) -array(2) { - [0]=> - object(Test)#%d (2) { - ["VAL"]=> - string(1) "A" - ["GRP"]=> - string(6) "Group1" - } - [1]=> - object(Test)#%d (2) { - ["VAL"]=> - string(1) "B" - ["GRP"]=> - string(6) "Group2" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_013.phpt b/ext/pdo_odbc/tests/pdo_013.phpt deleted file mode 100755 index f573a88f74..0000000000 --- a/ext/pdo_odbc/tests/pdo_013.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -PDO_ODBC: PDOStatement is Traversable ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array('create'=>'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); - -require_once($PDO_TESTS . 'pdo_013.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(2) { - [0]=> - string(1) "A" - [1]=> - string(6) "Group1" -} -array(2) { - [0]=> - string(1) "B" - [1]=> - string(6) "Group2" -} -Test::__construct(N/A) -object(Test)#%d (2) { - ["VAL"]=> - string(1) "A" - ["GRP"]=> - string(6) "Group1" -} -Test::__construct(N/A) -object(Test)#%d (2) { - ["VAL"]=> - string(1) "B" - ["GRP"]=> - string(6) "Group2" -} -Test::__construct(WOW) -object(Test)#%d (2) { - ["VAL"]=> - string(1) "A" - ["GRP"]=> - string(6) "Group1" -} -Test::__construct(WOW) -object(Test)#%d (2) { - ["VAL"]=> - string(1) "B" - ["GRP"]=> - string(6) "Group2" -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_014.phpt b/ext/pdo_odbc/tests/pdo_014.phpt deleted file mode 100755 index f0b1c550bc..0000000000 --- a/ext/pdo_odbc/tests/pdo_014.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -PDO_ODBC: PDOStatement and SPL Iterators ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); -if (!extension_loaded('SPL')) die('skip SPL not available'); -?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array('create'=>'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), grp VARCHAR(10))'); - -require_once($PDO_TESTS . 'pdo_014.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Test::__construct(WOW) -object(Test)#%d (2) { - ["VAL"]=> - string(1) "A" - ["GRP"]=> - string(6) "Group1" -} -Test::__construct(WOW) -object(Test)#%d (2) { - ["VAL"]=> - string(1) "B" - ["GRP"]=> - string(6) "Group2" -} -NULL -bool(false) -PDOStatementAggregate::__construct -PDOStatementAggregate::getIterator -array(2) { - [0]=> - string(1) "A" - [1]=> - string(6) "Group1" -} -array(2) { - [0]=> - string(1) "B" - [1]=> - string(6) "Group2" -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_015.phpt b/ext/pdo_odbc/tests/pdo_015.phpt deleted file mode 100755 index 9a0bbc39a5..0000000000 --- a/ext/pdo_odbc/tests/pdo_015.phpt +++ /dev/null @@ -1,81 +0,0 @@ ---TEST-- -PDO_ODBC: PDO_FETCH_COLUMN ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); -?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -$SQL = array( - 'create1'=>'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(10))' -); - -//require_once(dirname(__FILE__).'/../../pdo/tests/pdo.inc'); -require_once($PDO_TESTS . 'pdo_015.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" -} -array(2) { - [0]=> - string(2) "A2" - [1]=> - string(2) "B2" -} -array(2) { - [1]=> - array(1) { - [0]=> - string(1) "A" - } - [2]=> - array(1) { - [0]=> - string(1) "A" - } -} -array(2) { - [1]=> - string(1) "A" - [2]=> - string(1) "A" -} -array(2) { - [1]=> - string(1) "1" - [2]=> - string(1) "2" -} -array(2) { - [1]=> - string(1) "A" - [2]=> - string(1) "A" -} -array(2) { - [1]=> - string(2) "A2" - [2]=> - string(2) "B2" -} -array(1) { - ["A"]=> - array(2) { - [0]=> - string(2) "A2" - [1]=> - string(2) "B2" - } -} -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_017.phpt b/ext/pdo_odbc/tests/pdo_017.phpt deleted file mode 100755 index 5221c3dfc0..0000000000 --- a/ext/pdo_odbc/tests/pdo_017.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -PDO_ODBC: PDO::beginTransaction / PDO::rollBack ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_017.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -Counted 3 rows after insert. -Counted 0 rows after delete. -Counted 3 rows after rollback. -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_020.phpt b/ext/pdo_odbc/tests/pdo_020.phpt deleted file mode 100755 index 8e00dbdacd..0000000000 --- a/ext/pdo_odbc/tests/pdo_020.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -PDO_ODBC: PDOStatement::columnCount ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_020.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -Counted 2 columns after select1. -Counted 3 columns after select2. -Counted 1 columns after select3. -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_021.phpt b/ext/pdo_odbc/tests/pdo_021.phpt deleted file mode 100755 index 08a263125f..0000000000 --- a/ext/pdo_odbc/tests/pdo_021.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -PDO_ODBC: PDOStatement::execute with parameter markers. ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_021.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -There are 6 rows in the table. -There are 12 rows in the table. -===DONE=== diff --git a/ext/pdo_odbc/tests/pdo_022.phpt b/ext/pdo_odbc/tests/pdo_022.phpt deleted file mode 100755 index 412fe35571..0000000000 --- a/ext/pdo_odbc/tests/pdo_022.phpt +++ /dev/null @@ -1,84 +0,0 @@ ---TEST-- -PDO_ODBC: PDOStatement::columnMeta results. ---SKIPIF-- -<?php # vim:ft=php -require_once('skipif.inc'); ?> ---FILE-- -<?php - -require_once('connection.inc'); -require_once('prepare.inc'); - -require_once($PDO_TESTS . 'pdo_022.inc'); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -array(7) { - ["native_type"]=> - string(7) "integer" - ["odbc:decl_type"]=> - string(3) "INT" - ["flags"]=> - array(0) { - } - ["name"]=> - string(2) "id" - ["len"]=> - int(-1) - ["precision"]=> - int(0) - ["pdo_type"]=> - int(2) -} -array(7) { - ["native_type"]=> - string(6) "string" - ["odbc:decl_type"]=> - string(11) "VARCHAR(10)" - ["flags"]=> - array(0) { - } - ["name"]=> - string(3) "val" - ["len"]=> - int(-1) - ["precision"]=> - int(0) - ["pdo_type"]=> - int(2) -} -array(7) { - ["native_type"]=> - string(6) "string" - ["odbc:decl_type"]=> - string(11) "VARCHAR(16)" - ["flags"]=> - array(0) { - } - ["name"]=> - string(4) "val2" - ["len"]=> - int(-1) - ["precision"]=> - int(0) - ["pdo_type"]=> - int(2) -} -array(6) { - ["native_type"]=> - string(7) "integer" - ["flags"]=> - array(0) { - } - ["name"]=> - string(8) "COUNT(*)" - ["len"]=> - int(-1) - ["precision"]=> - int(0) - ["pdo_type"]=> - int(2) -} -===DONE=== diff --git a/ext/pdo_odbc/tests/prepare.inc b/ext/pdo_odbc/tests/prepare.inc deleted file mode 100755 index 43725d47e5..0000000000 --- a/ext/pdo_odbc/tests/prepare.inc +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -require_once('connection.inc'); - -$SQL = array( - 'create'=>'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))' -); - -$DB = new pdo($CONNECTION, $USER, $PASSWD); - -foreach(array('test','classtypes') as $name) -{ - $DB->exec("DROP TABLE $name"); -} - -$DB->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_WARNING); - -?> diff --git a/ext/pdo_odbc/tests/skipif.inc b/ext/pdo_odbc/tests/skipif.inc deleted file mode 100755 index 2d44a6c421..0000000000 --- a/ext/pdo_odbc/tests/skipif.inc +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -if (!extension_loaded('pdo_odbc')) die('skip'); - -require_once('connection.inc'); -require_once('prepare.inc'); - -if (!$DB) { - die('skip cannot open db'); -} - -?> |