diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bea433 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +.DS_Store diff --git a/MySQLDriver.xcodeproj/project.pbxproj b/MySQLDriver.xcodeproj/project.pbxproj index afb2403..98cd0ab 100644 --- a/MySQLDriver.xcodeproj/project.pbxproj +++ b/MySQLDriver.xcodeproj/project.pbxproj @@ -529,6 +529,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -860,7 +861,7 @@ SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -913,7 +914,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -962,6 +963,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1000,6 +1002,7 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1055,7 +1058,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1106,7 +1109,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -1159,7 +1162,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1200,7 +1203,7 @@ PRODUCT_BUNDLE_IDENTIFIER = mcorega.MySQLDriveriOSTests; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -1253,6 +1256,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1297,6 +1301,7 @@ PRODUCT_BUNDLE_IDENTIFIER = mcorega.MySQLSampleiOS; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -1341,7 +1346,7 @@ SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1377,7 +1382,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = macosx; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/MySQLDriver.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MySQLDriver.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/MySQLDriver.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/MySQLDriver.xcodeproj/project.xcworkspace/xcuserdata/carles.xcuserdatad/UserInterfaceState.xcuserstate b/MySQLDriver.xcodeproj/project.xcworkspace/xcuserdata/carles.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..7399fee Binary files /dev/null and b/MySQLDriver.xcodeproj/project.xcworkspace/xcuserdata/carles.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/MySQLDriver.xcodeproj/xcuserdata/carles.xcuserdatad/xcschemes/xcschememanagement.plist b/MySQLDriver.xcodeproj/xcuserdata/carles.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..370b922 --- /dev/null +++ b/MySQLDriver.xcodeproj/xcuserdata/carles.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,29 @@ + + + + + SchemeUserState + + MySQLDriver.xcscheme_^#shared#^_ + + orderHint + 2 + + MySQLDriveriOS.xcscheme_^#shared#^_ + + orderHint + 3 + + MySQLSampleOSX.xcscheme_^#shared#^_ + + orderHint + 0 + + MySQLSampleiOS.xcscheme_^#shared#^_ + + orderHint + 1 + + + + diff --git a/MySqlSwiftNative.podspec b/MySqlSwiftNative.podspec index d351b4b..12aae25 100644 --- a/MySqlSwiftNative.podspec +++ b/MySqlSwiftNative.podspec @@ -1,14 +1,14 @@ Pod::Spec.new do |s| s.name = "MySqlSwiftNative" - s.version = "1.0.10" + s.version = "1.4.1" s.summary = "MySQL Native Swift Driver." s.homepage = "https://github.com/mcorega/MySqlSwiftNative" s.license = { :type => 'Copyright', :file => 'LICENSE' } s.author = { "Marius Corega" => "mcorega@gmail.com" } s.ios.deployment_target = "8.0" s.osx.deployment_target = "10.9" - s.source = { :git => "https://github.com/mcorega/MySqlSwiftNative.git", :tag => "1.0.10" } - s.source_files = 'Sources/MySqlSwiftNative/*.{h,m,swift}' + s.source = { :git => "https://github.com/mcorega/MySqlSwiftNative.git", :tag => "1.4.1" } + s.source_files = 'Sources/MySQLDriver/*.{h,m,swift}' end diff --git a/Sources/MySQLDriver/Statement.swift b/Sources/MySQLDriver/Statement.swift index 5e86c91..8747ef6 100644 --- a/Sources/MySQLDriver/Statement.swift +++ b/Sources/MySQLDriver/Statement.swift @@ -250,8 +250,8 @@ public extension MySQL { break case let str as String: - if str.characters.count < MySQL.maxPackAllowed - 1024*1024 { - let lenArr = MySQL.Utils.lenEncIntArray(UInt64(str.characters.count)) + if str.count < MySQL.maxPackAllowed - 1024*1024 { + let lenArr = MySQL.Utils.lenEncIntArray(UInt64(str.count)) dataTypeArr += [UInt8].UInt16Array(UInt16(MysqlTypes.MYSQL_TYPE_STRING)) argsArr += lenArr argsArr += [UInt8](str.utf8) diff --git a/Sources/MySQLDriver/Utils.swift b/Sources/MySQLDriver/Utils.swift index 4f4eb01..0cb5979 100644 --- a/Sources/MySQLDriver/Utils.swift +++ b/Sources/MySQLDriver/Utils.swift @@ -300,7 +300,7 @@ extension MySQL { static func encPasswd(_ pwd:String, scramble:[UInt8]) -> [UInt8]{ - if pwd.characters.count == 0 { + if pwd.count == 0 { return [UInt8]() } @@ -386,12 +386,11 @@ public extension Date static var dateStringFormatter : DateFormatter? = nil static var token : Int = 0 } - - // dispatch_once(&statDFT.token) { - statDFT.dateStringFormatter = DateFormatter() - statDFT.dateStringFormatter!.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSS" - statDFT.dateStringFormatter!.locale = Locale(identifier: "en_US_POSIX") - // } + + statDFT.dateStringFormatter = DateFormatter() + statDFT.dateStringFormatter!.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSS" + statDFT.dateStringFormatter!.timeZone = TimeZone(abbreviation: "UTC") + statDFT.dateStringFormatter!.locale = Locale(identifier: "en_US_POSIX") if let d = statDFT.dateStringFormatter!.date(from: dateTimeStringUsec) { self.init(timeInterval:0, since:d) diff --git a/Sources/MySQLDriver/sha1.swift b/Sources/MySQLDriver/sha1.swift index e7e71cd..86b3e50 100644 --- a/Sources/MySQLDriver/sha1.swift +++ b/Sources/MySQLDriver/sha1.swift @@ -84,8 +84,8 @@ func arrayOfBytes(_ value: T, length totalBytes: Int = MemoryL bytes[totalBytes - 1 - j] = (bytesPointer + j).pointee } - valuePointer.deinitialize() - valuePointer.deallocate(capacity: 1) + valuePointer.deinitialize(count: 1) + valuePointer.deallocate() return bytes }