summaryrefslogtreecommitdiff
path: root/ext/pdo_odbc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_odbc')
-rwxr-xr-xext/pdo_odbc/config.m415
-rwxr-xr-xext/pdo_odbc/odbc_driver.c5
2 files changed, 18 insertions, 2 deletions
diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4
index d6e7264c1a..15aed28787 100755
--- a/ext/pdo_odbc/config.m4
+++ b/ext/pdo_odbc/config.m4
@@ -32,6 +32,19 @@ AC_DEFUN([PDO_ODBC_CHECK_HEADER],[
AC_MSG_CHECKING(which ODBC flavour you want)
if test "$PHP_PDO_ODBC" != "no" && test "$PHP_PDO_ODBC" != "yes" ; then
+
+ AC_MSG_CHECKING([for PDO includes])
+ if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=$prefix/include/php/ext
+ elif test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=$abs_srcdir/ext
+ elif test -f ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=ext
+ else
+ AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
+ fi
+ AC_MSG_RESULT($pdo_inc_path)
+
pdo_odbc_flavour=`echo $withval | cut -d, -f1`
pdo_odbc_dir=`echo $withval | cut -d, -f2`
@@ -130,7 +143,7 @@ functions required for PDO support.
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, $ext_shared,,-I\$prefix/include/php/ext $PDO_ODBC_INCLUDE)
+ 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)
else
AC_MSG_ERROR(
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 780a9f111d..1014ec92da 100755
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -29,6 +29,7 @@
#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)
{
@@ -42,7 +43,7 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf
einfo = &S->einfo;
}
- spprintf(&message, 0, "%s (%s[%d] at %s:%d)",
+ spprintf(&message, 0, "%s (%s[%ld] at %s:%d)",
einfo->last_err_msg,
einfo->what, einfo->last_error,
einfo->file, einfo->line);
@@ -129,6 +130,8 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, p
sql = nsql;
} else if (ret == -1) {
/* couldn't grok it */
+ strcpy(dbh->error_code, stmt->error_code);
+ efree(S);
return 0;
}