]> granicus.if.org Git - php/commitdiff
- build fix the other driver as well (a macro would be nicer)
authorPierre Joye <pajoye@php.net>
Sun, 10 Dec 2006 03:12:11 +0000 (03:12 +0000)
committerPierre Joye <pajoye@php.net>
Sun, 10 Dec 2006 03:12:11 +0000 (03:12 +0000)
ext/pdo_mysql/mysql_driver.c
ext/pdo_oci/oci_driver.c
ext/pdo_odbc/odbc_driver.c
ext/sqlite/pdo_sqlite2.c

index f3d5d1adf0f74fbebffd08622ec786b8b619b6d7..90c5f60e43853b23f6e21b87d32ae17b8f7678ac 100755 (executable)
@@ -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); */
 
index 37cb22da1600b92fe9b828ca036c5e6d15499dab..4d90d07ce931e1855ed27a3c1fbadfb7c6fdba86 100755 (executable)
@@ -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;
index 4952c1aa6242668d907de38ac6657115149869ee..937854305935a5259a52c3fd3d21ce24421bcf04 100755 (executable)
@@ -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
        }
 }
 /* }}} */
index 912896486eebfea538525d28b31becb499ce91e6..7e02388892204587af24bf13b727604b0dae498e 100644 (file)
@@ -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;
        }