diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-05-20 15:51:25 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-05-20 15:51:25 +0000 |
commit | 0d6aa20880517e33949a4fb00a020951ecc4f91b (patch) | |
tree | d7a6304a6f52aee704c228a07b0ae0bc346a0905 /ext/pdo_mysql/php_pdo_mysql_int.h | |
parent | fbbb41a53b4059418402e7b499de2462e371a669 (diff) | |
download | php-git-0d6aa20880517e33949a4fb00a020951ecc4f91b.tar.gz |
Error handling support.
Fixed possible crash when trying to fetch data from a failed query.
Diffstat (limited to 'ext/pdo_mysql/php_pdo_mysql_int.h')
-rwxr-xr-x | ext/pdo_mysql/php_pdo_mysql_int.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index b95e9c765e..875738ccaf 100755 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -23,14 +23,21 @@ #include <mysql.h> +typedef struct { + const char *file; + int line; + unsigned int errcode; + char *errmsg; +} pdo_mysql_error_info; + /* stuff we use in a mySQL database handle */ typedef struct { MYSQL *server; - int last_err; - unsigned int mysql_errno; - char *mysql_error; + unsigned attached:1; unsigned _reserved:31; + + pdo_mysql_error_info einfo; } pdo_mysql_db_handle; typedef struct { @@ -42,7 +49,6 @@ typedef struct { MYSQL_RES *result; MYSQL_ROW current_data; long *current_lengths; - int last_err; pdo_mysql_column *cols; } pdo_mysql_stmt; @@ -55,16 +61,8 @@ typedef struct { extern pdo_driver_t pdo_mysql_driver; -extern int _pdo_mysql_error(char *what, int mysql_errno, const char *file, int line TSRMLS_DC); -#define pdo_mysql_error(s) \ - s->mysql_errno = mysql_errno(s->server); \ - if (s->mysql_error) { \ - efree(s->mysql_error); \ - } \ - s->mysql_error = estrdup(mysql_error(s->server)); - - -extern int mysql_handle_error(pdo_dbh_t *dbh, pdo_mysql_db_handle *H, int errcode); +extern int _pdo_mysql_error(pdo_dbh_t *dbh, const char *file, int line TSRMLS_DC); +#define pdo_mysql_error(s) _pdo_mysql_error(s, __FILE__, __LINE__ TSRMLS_DC) extern struct pdo_stmt_methods mysql_stmt_methods; #endif |