summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-04-27 10:53:27 +0000
committerAndrey Hristov <andrey@php.net>2010-04-27 10:53:27 +0000
commitbe5920b3e9f31cc7fa732308a5836b457deabda7 (patch)
treeef6a471b175f8991f0df771a2b280acbefb8419b /ext/mysqlnd/mysqlnd.c
parenta5d361e3eaed7962bea787a45ca88bbd7551c1b9 (diff)
downloadphp-git-be5920b3e9f31cc7fa732308a5836b457deabda7.tar.gz
Move the macro to mysqlnd_enum_n_def.h, because it can be reused
in other places. Also, premultiply the values by 4 and add some reserve for future releases of the server.
Diffstat (limited to 'ext/mysqlnd/mysqlnd.c')
-rw-r--r--ext/mysqlnd/mysqlnd.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index bae82d4849..4f5bdf992c 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -30,9 +30,6 @@
/* for php_get_current_user() */
#include "ext/standard/basic_functions.h"
-/* the server doesn't support 4byte utf8, but let's make it forward compatible */
-#define MYSQLND_MAX_ALLOWED_USER_LEN 256 /* 64 char * 4byte */
-#define MYSQLND_MAX_ALLOWED_DB_LEN 256 /* 64 char * 4byte */
/*
TODO :
- Don't bind so tightly the metadata with the result set. This means
@@ -1066,7 +1063,7 @@ MYSQLND_RES *
MYSQLND_METHOD(mysqlnd_conn, list_fields)(MYSQLND * conn, const char *table, const char *achtung_wild TSRMLS_DC)
{
/* db + \0 + wild + \0 (for wild) */
- char buff[MYSQLND_MAX_ALLOWED_DB_LEN * 4 * 2 + 1 + 1], *p;
+ char buff[MYSQLND_MAX_ALLOWED_DB_LEN * 2 + 1 + 1], *p;
size_t table_len, wild_len;
MYSQLND_RES *result = NULL;
DBG_ENTER("mysqlnd_conn::list_fields");
@@ -1074,14 +1071,14 @@ MYSQLND_METHOD(mysqlnd_conn, list_fields)(MYSQLND * conn, const char *table, con
p = buff;
if (table && (table_len = strlen(table))) {
- size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+ size_t to_copy = MIN(table_len, MYSQLND_MAX_ALLOWED_DB_LEN);
memcpy(p, table, to_copy);
p += to_copy;
*p++ = '\0';
}
if (achtung_wild && (wild_len = strlen(achtung_wild))) {
- size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN * 4);
+ size_t to_copy = MIN(wild_len, MYSQLND_MAX_ALLOWED_DB_LEN);
memcpy(p, achtung_wild, to_copy);
p += to_copy;
*p++ = '\0';