summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/php_pdo_mysql_int.h
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-05-20 15:51:25 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-05-20 15:51:25 +0000
commit0d6aa20880517e33949a4fb00a020951ecc4f91b (patch)
treed7a6304a6f52aee704c228a07b0ae0bc346a0905 /ext/pdo_mysql/php_pdo_mysql_int.h
parentfbbb41a53b4059418402e7b499de2462e371a669 (diff)
downloadphp-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-xext/pdo_mysql/php_pdo_mysql_int.h26
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