diff options
| author | Wez Furlong <wez@php.net> | 2005-01-07 05:25:57 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2005-01-07 05:25:57 +0000 |
| commit | 02d6b65c672835f27fd2b160338ab05f1dfca3a1 (patch) | |
| tree | 4ecd98a28eda1595b218fd64364b5ead9954ee89 | |
| parent | 70da73903156b953092ffeac1008030ddd271d27 (diff) | |
| download | php-git-02d6b65c672835f27fd2b160338ab05f1dfca3a1.tar.gz | |
lame implementation of SQLSTATE error codes
| -rw-r--r-- | ext/pdo_pgsql/pgsql_driver.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index ca83332696..c5071e13fa 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -55,7 +55,7 @@ static char * _pdo_pgsql_trim_message(const char *message, int persistent) int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *file, int line TSRMLS_DC) /* {{{ */ { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; - enum pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code; + pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code; pdo_pgsql_error_info *einfo = &H->einfo; char *errmsg = PQerrorMessage(H->server); @@ -69,12 +69,8 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char * } switch (errcode) { - case PGRES_EMPTY_QUERY: - *pdo_err = PDO_ERR_SYNTAX; - break; - default: - *pdo_err = PDO_ERR_CANT_MAP; + strcpy(*pdo_err, "HY000"); break; } @@ -83,8 +79,8 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char * } if (!dbh->methods) { - zend_throw_exception_ex(php_pdo_get_exception(), *pdo_err TSRMLS_CC, "[%d] %s", - einfo->errcode, einfo->errmsg); + zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", + *pdo_err, einfo->errcode, einfo->errmsg); } return errcode; |
