From 1f7684a8d075a77914301aea444e2a244347249d Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 15 Nov 2015 21:17:36 +0100 Subject: Add basic support for JSON type (part of #2199) --- .../SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h | 6 +++++- Frameworks/SPMySQLFramework/SPMySQLDataTypes.h | 1 + Frameworks/SPMySQLFramework/SPMySQLDataTypes.m | 1 + .../Source/SPMySQLResult Categories/Data Conversion.m | 1 + .../Source/SPMySQLResult Categories/Field Definitions.m | 5 ++++- 5 files changed, 12 insertions(+), 2 deletions(-) (limited to 'Frameworks') diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h index f2345be6..8a8c019d 100644 --- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h +++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/include/mysql_com.h @@ -348,7 +348,11 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, MYSQL_TYPE_BIT, - MYSQL_TYPE_NEWDECIMAL=246, + MYSQL_TYPE_TIMESTAMP2, + MYSQL_TYPE_DATETIME2, + MYSQL_TYPE_TIME2, + MYSQL_TYPE_JSON=245, + MYSQL_TYPE_NEWDECIMAL=246, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, MYSQL_TYPE_TINY_BLOB=249, diff --git a/Frameworks/SPMySQLFramework/SPMySQLDataTypes.h b/Frameworks/SPMySQLFramework/SPMySQLDataTypes.h index def1e988..31acf6b8 100644 --- a/Frameworks/SPMySQLFramework/SPMySQLDataTypes.h +++ b/Frameworks/SPMySQLFramework/SPMySQLDataTypes.h @@ -72,3 +72,4 @@ extern NSString *SPMySQLMultiPointType; extern NSString *SPMySQLMultiLineStringType; extern NSString *SPMySQLMultiPolygonType; extern NSString *SPMySQLGeometryCollectionType; +extern NSString *SPMySQLJsonType; diff --git a/Frameworks/SPMySQLFramework/SPMySQLDataTypes.m b/Frameworks/SPMySQLFramework/SPMySQLDataTypes.m index 06708f1b..d7f54c0e 100644 --- a/Frameworks/SPMySQLFramework/SPMySQLDataTypes.m +++ b/Frameworks/SPMySQLFramework/SPMySQLDataTypes.m @@ -74,3 +74,4 @@ NSString *SPMySQLMultiPointType = @"MULTIPOINT"; NSString *SPMySQLMultiLineStringType = @"MULTILINESTRING"; NSString *SPMySQLMultiPolygonType = @"MULTIPOLYGON"; NSString *SPMySQLGeometryCollectionType = @"GEOMETRYCOLLECTION"; +NSString *SPMySQLJsonType = @"JSON"; diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Data Conversion.m b/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Data Conversion.m index b2336aaa..3b29fb5e 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Data Conversion.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Data Conversion.m @@ -78,6 +78,7 @@ static NSStringEncoding NSFromCFStringEncodingGBK_95; fieldProcessingMap[MYSQL_TYPE_NEWDATE] = SPMySQLResultFieldAsString; fieldProcessingMap[MYSQL_TYPE_VARCHAR] = SPMySQLResultFieldAsString; fieldProcessingMap[MYSQL_TYPE_BIT] = SPMySQLResultFieldAsBit; + fieldProcessingMap[MYSQL_TYPE_JSON] = SPMySQLResultFieldAsString; fieldProcessingMap[MYSQL_TYPE_NEWDECIMAL] = SPMySQLResultFieldAsString; fieldProcessingMap[MYSQL_TYPE_ENUM] = SPMySQLResultFieldAsString; fieldProcessingMap[MYSQL_TYPE_SET] = SPMySQLResultFieldAsString; diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Field Definitions.m b/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Field Definitions.m index 09bd9580..ec52e0e3 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Field Definitions.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLResult Categories/Field Definitions.m @@ -372,7 +372,7 @@ const SPMySQLResultCharset SPMySQLCharsetMap[] = switch (type) { - case FIELD_TYPE_BIT: + case MYSQL_TYPE_BIT: return @"BIT"; case MYSQL_TYPE_DECIMAL: @@ -475,6 +475,9 @@ const SPMySQLResultCharset SPMySQLCharsetMap[] = case MYSQL_TYPE_GEOMETRY: return @"GEOMETRY"; + + case MYSQL_TYPE_JSON: + return @"JSON"; default: return @"UNKNOWN"; -- cgit v1.2.3