From: Pierre Joye Date: Sun, 10 Dec 2006 03:12:11 +0000 (+0000) Subject: - build fix the other driver as well (a macro would be nicer) X-Git-Tag: RELEASE_1_0_0RC1~732 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26c54d4c4288a0504be4438cadd4f87956b40412;p=php - build fix the other driver as well (a macro would be nicer) --- diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index f3d5d1adf0..90c5f60e43 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -97,8 +97,13 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin #endif if (!dbh->methods) { +#if PHP_VERSION_ID > 50200 + zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", + *pdo_err, einfo->errcode, einfo->errmsg); +#else zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); +#endif } /* printf("** [%s:%d] %s %s\n", file, line, *pdo_err, einfo->errmsg); */ diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 37cb22da16..4d90d07ce9 100755 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -158,7 +158,11 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor /* little mini hack so that we can use this code from the dbh ctor */ if (!dbh->methods) { +#if PHP_VERSION_ID > 50200 + zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg); +#else zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg); +#endif } return einfo->errcode; diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 4952c1aa62..9378543059 100755 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -87,8 +87,13 @@ void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, strcpy(*pdo_err, einfo->last_state); /* printf("@@ SQLSTATE[%s] %s\n", *pdo_err, einfo->last_err_msg); */ if (!dbh->methods) { +#if PHP_VERSION_ID > 50200 + 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); +#else zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s", *pdo_err, what, einfo->last_error, einfo->last_err_msg); +#endif } } /* }}} */ diff --git a/ext/sqlite/pdo_sqlite2.c b/ext/sqlite/pdo_sqlite2.c index 912896486e..7e02388892 100644 --- a/ext/sqlite/pdo_sqlite2.c +++ b/ext/sqlite/pdo_sqlite2.c @@ -288,8 +288,13 @@ int _pdo_sqlite2_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *errmsg, const cha } if (!dbh->methods) { +#if PHP_VERSION_ID > 50200 + zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", + *pdo_err, einfo->errcode, einfo->errmsg); +#else zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); +#endif } return einfo->errcode; @@ -579,9 +584,15 @@ static int pdo_sqlite2_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRML filename = make_filename_safe(dbh->data_source TSRMLS_CC); if (!filename) { +#if PHP_VERSION_ID > 50200 + zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, + "open_basedir prohibits opening %s", + dbh->data_source); +#else zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "open_basedir prohibits opening %s", dbh->data_source); +#endif goto cleanup; }