瀏覽代碼

[PHP] check flags to differ blob from text

Ingo Jakobs 12 年之前
父節點
當前提交
8316d363b1
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      std/php/_std/sys/db/Mysql.hx

+ 8 - 1
std/php/_std/sys/db/Mysql.hx

@@ -114,9 +114,16 @@ private class MysqlResultSet implements ResultSet {
 		if(_fieldsDesc == null) {
 			_fieldsDesc = [];
 			for (i in 0...nfields) {
+				var type = untyped __call__("mysql_field_type", __r, i);
+				if ( type == "blob" ) {
+					var flags : String = untyped __call__("mysql_field_flags", __r, i);
+					if ( flags.indexOf("blobs") == -1 && flags.indexOf("binary") == -1 ) {
+						type = "text";
+					}
+				}
 				var item = {
 					name : untyped __call__("mysql_field_name", __r, i),
-					type : untyped __call__("mysql_field_type", __r, i)
+					type : type,
 				};
 				_fieldsDesc.push(item);
 			}