aboutsummaryrefslogtreecommitdiff
path: root/databases/php5-mysqli
diff options
context:
space:
mode:
authorAlex Dupre <ale@FreeBSD.org>2008-02-16 17:33:58 +0000
committerAlex Dupre <ale@FreeBSD.org>2008-02-16 17:33:58 +0000
commita4a1eb4b3413ae807935477bcdb5babbd6c53db4 (patch)
tree8e38a3ab353e29c95d8074610fe70dc523a36b04 /databases/php5-mysqli
parent43804a60ba7f288f4e58b462414aad63c0ff26c7 (diff)
downloadports-a4a1eb4b3413ae807935477bcdb5babbd6c53db4.tar.gz
ports-a4a1eb4b3413ae807935477bcdb5babbd6c53db4.zip
Notes
Diffstat (limited to 'databases/php5-mysqli')
-rw-r--r--databases/php5-mysqli/files/patch-mysqli_api.c30
-rw-r--r--databases/php5-mysqli/files/patch-mysqli_nonapi.c46
-rw-r--r--databases/php5-mysqli/files/patch-php_mysqli.h20
3 files changed, 96 insertions, 0 deletions
diff --git a/databases/php5-mysqli/files/patch-mysqli_api.c b/databases/php5-mysqli/files/patch-mysqli_api.c
new file mode 100644
index 000000000000..9319bd87845b
--- /dev/null
+++ b/databases/php5-mysqli/files/patch-mysqli_api.c
@@ -0,0 +1,30 @@
+--- mysqli_api.c.orig 2008-02-16 12:23:59.000000000 +0100
++++ mysqli_api.c 2008-02-16 12:32:26.000000000 +0100
+@@ -1373,8 +1373,13 @@ PHP_FUNCTION(mysqli_prepare)
+ stmt->stmt = NULL;
+
+ /* restore error messages */
++#if MYSQL_VERSION_ID > 50122
++ mysql->mysql->net.client_last_errno = last_errno;
++ memcpy(mysql->mysql->net.client_last_error, last_error, MYSQL_ERRMSG_SIZE);
++#else
+ mysql->mysql->net.last_errno = last_errno;
+ memcpy(mysql->mysql->net.last_error, last_error, MYSQL_ERRMSG_SIZE);
++#endif
+ memcpy(mysql->mysql->net.sqlstate, sqlstate, SQLSTATE_LENGTH+1);
+ }
+ }
+@@ -1450,8 +1455,13 @@ PHP_FUNCTION(mysqli_real_connect)
+
+ if (mysql_real_connect(mysql->mysql,hostname,username,passwd,dbname,port,socket,flags) == NULL) {
+ php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC);
++#if MYSQL_VERSION_ID > 50122
++ php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.client_last_errno TSRMLS_CC,
++ "%s", mysql->mysql->net.client_last_error);
++#else
+ php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.last_errno TSRMLS_CC,
+ "%s", mysql->mysql->net.last_error);
++#endif
+
+ /* change status */
+ MYSQLI_SET_STATUS(&mysql_link, MYSQLI_STATUS_INITIALIZED);
diff --git a/databases/php5-mysqli/files/patch-mysqli_nonapi.c b/databases/php5-mysqli/files/patch-mysqli_nonapi.c
new file mode 100644
index 000000000000..4ea78370307c
--- /dev/null
+++ b/databases/php5-mysqli/files/patch-mysqli_nonapi.c
@@ -0,0 +1,46 @@
+--- mysqli_nonapi.c.orig 2008-02-16 18:27:15.000000000 +0100
++++ mysqli_nonapi.c 2008-02-16 18:30:38.000000000 +0100
+@@ -106,8 +106,13 @@ PHP_FUNCTION(mysqli_connect)
+ if (mysql_real_connect(mysql->mysql,hostname,username,passwd,dbname,port,socket,CLIENT_MULTI_RESULTS) == NULL) {
+ /* Save error messages */
+
++#if MYSQL_VERSION_ID > 50122
++ php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.client_last_errno TSRMLS_CC,
++ "%s", mysql->mysql->net.client_last_error);
++#else
+ php_mysqli_throw_sql_exception( mysql->mysql->net.sqlstate, mysql->mysql->net.last_errno TSRMLS_CC,
+ "%s", mysql->mysql->net.last_error);
++#endif
+
+ php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC);
+
+@@ -212,9 +217,14 @@ PHP_FUNCTION(mysqli_multi_query)
+ MYSQLI_DISABLE_MQ;
+
+ /* restore error information */
++#if MYSQL_VERSION_ID > 50122
++ strcpy(mysql->mysql->net.client_last_error, s_error);
++ mysql->mysql->net.client_last_errno = s_errno;
++#else
+ strcpy(mysql->mysql->net.last_error, s_error);
+- strcpy(mysql->mysql->net.sqlstate, s_sqlstate);
+ mysql->mysql->net.last_errno = s_errno;
++#endif
++ strcpy(mysql->mysql->net.sqlstate, s_sqlstate);
+
+ RETURN_FALSE;
+ }
+@@ -266,8 +276,13 @@ PHP_FUNCTION(mysqli_query)
+ result = (resultmode == MYSQLI_USE_RESULT) ? mysql_use_result(mysql->mysql) : mysql_store_result(mysql->mysql);
+
+ if (!result) {
++#if MYSQL_VERSION_ID > 50122
++ php_mysqli_throw_sql_exception(mysql->mysql->net.sqlstate, mysql->mysql->net.client_last_errno TSRMLS_CC,
++ "%s", mysql->mysql->net.client_last_error);
++#else
+ php_mysqli_throw_sql_exception(mysql->mysql->net.sqlstate, mysql->mysql->net.last_errno TSRMLS_CC,
+ "%s", mysql->mysql->net.last_error);
++#endif
+ RETURN_FALSE;
+ }
+
diff --git a/databases/php5-mysqli/files/patch-php_mysqli.h b/databases/php5-mysqli/files/patch-php_mysqli.h
new file mode 100644
index 000000000000..17d117141a2c
--- /dev/null
+++ b/databases/php5-mysqli/files/patch-php_mysqli.h
@@ -0,0 +1,20 @@
+--- php_mysqli.h.orig 2008-02-16 12:26:48.000000000 +0100
++++ php_mysqli.h 2008-02-16 12:30:02.000000000 +0100
+@@ -291,10 +291,17 @@ PHP_MYSQLI_EXPORT(zend_object_value) mys
+ #define MYSQLI_REPORT_CLOSE 8
+ #define MYSQLI_REPORT_ALL 255
+
++#if MYSQL_VERSION_ID > 50122
++#define MYSQLI_REPORT_MYSQL_ERROR(mysql) \
++if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql->net.client_last_errno) { \
++ php_mysqli_report_error(mysql->net.sqlstate, mysql->net.client_last_errno, mysql->net.client_last_error TSRMLS_CC); \
++}
++#else
+ #define MYSQLI_REPORT_MYSQL_ERROR(mysql) \
+ if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql->net.last_errno) { \
+ php_mysqli_report_error(mysql->net.sqlstate, mysql->net.last_errno, mysql->net.last_error TSRMLS_CC); \
+ }
++#endif
+
+ #define MYSQLI_REPORT_STMT_ERROR(stmt) \
+ if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && stmt->last_errno) { \