summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/php_pdo_mysql_int.h
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-05-19 17:35:39 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-05-19 17:35:39 +0000
commit074ba3fbc092a4a379a34471e778897be5bfa268 (patch)
treef8a9b93fb6c5b784a7fe3f962c462982b3c2637d /ext/pdo_mysql/php_pdo_mysql_int.h
parent5a4c3234b9f072bd5ea9029770368372447f422a (diff)
downloadphp-git-074ba3fbc092a4a379a34471e778897be5bfa268.tar.gz
Added lastInsertId() method for retrieving last insert id.
Made affectedRows() work for MySQL. Populate error value in MySQL on error.
Diffstat (limited to 'ext/pdo_mysql/php_pdo_mysql_int.h')
-rwxr-xr-xext/pdo_mysql/php_pdo_mysql_int.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h
index 3a3e4bfa62..b95e9c765e 100755
--- a/ext/pdo_mysql/php_pdo_mysql_int.h
+++ b/ext/pdo_mysql/php_pdo_mysql_int.h
@@ -27,6 +27,8 @@
typedef struct {
MYSQL *server;
int last_err;
+ unsigned int mysql_errno;
+ char *mysql_error;
unsigned attached:1;
unsigned _reserved:31;
} pdo_mysql_db_handle;
@@ -54,7 +56,14 @@ 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(w,s) _pdo_mysql_error(w, s, __FILE__, __LINE__ TSRMLS_CC)
+#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 struct pdo_stmt_methods mysql_stmt_methods;