summaryrefslogtreecommitdiff
path: root/ext/mysql/php_mysql.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-06-23 19:12:15 +0800
committerXinchen Hui <laruence@php.net>2014-06-23 19:27:24 +0800
commit92a708989380bfb5d5da00665895025398bdbc91 (patch)
treefb888b41c25d52169f87f250b6b4d557accf42f3 /ext/mysql/php_mysql.c
parent64c6b9bd5873240c53d803399ee8a8a0ad962dbf (diff)
downloadphp-git-92a708989380bfb5d5da00665895025398bdbc91.tar.gz
Use zend_string in mysqlnd
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r--ext/mysql/php_mysql.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index dfde6a4857..db02c24f9a 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -1969,7 +1969,11 @@ Q: String or long first?
}
mysql_field_seek(mysql_result, 0);
while ((tmp_field = mysql_fetch_field(mysql_result))) {
+#ifdef MYSQL_USE_MYSQLND
+ if ((!table_name || !strncasecmp(tmp_field->table->val, table_name, tmp_field->table->len)) && !strncasecmp(tmp_field->name->val, field_name, tmp_field->name->len)) {
+#else
if ((!table_name || !strcasecmp(tmp_field->table, table_name)) && !strcasecmp(tmp_field->name, field_name)) {
+#endif
field_offset = i;
break;
}
@@ -2419,9 +2423,15 @@ PHP_FUNCTION(mysql_fetch_field)
}
object_init(return_value);
+#if MYSQL_USE_MYSQLND
+ add_property_str(return_value, "name", STR_COPY(mysql_field->name));
+ add_property_str(return_value, "table", STR_COPY(mysql_field->table));
+ add_property_str(return_value, "def", STR_COPY(mysql_field->def));
+#else
add_property_string(return_value, "name", (mysql_field->name?mysql_field->name:""));
add_property_string(return_value, "table", (mysql_field->table?mysql_field->table:""));
add_property_string(return_value, "def", (mysql_field->def?mysql_field->def:""));
+#endif
add_property_long(return_value, "max_length", mysql_field->max_length);
add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
@@ -2491,10 +2501,18 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
switch (entry_type) {
case PHP_MYSQL_FIELD_NAME:
+#ifdef MYSQL_USE_MYSQLND
+ RETVAL_STR(STR_COPY(mysql_field->name));
+#else
RETVAL_STRING(mysql_field->name);
+#endif
break;
case PHP_MYSQL_FIELD_TABLE:
+#ifdef MYSQL_USE_MYSQLND
+ RETVAL_STR(STR_COPY(mysql_field->table));
+#else
RETVAL_STRING(mysql_field->table);
+#endif
break;
case PHP_MYSQL_FIELD_LEN:
RETVAL_LONG(mysql_field->length);