-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DatabaseError's
isSyntaxError
and isConnectionClosed
properties n…
…ow correctly respect `MySQLError.invalidSyntax` and `MySQLError.closed`. A unit tests for these behaviors is included. (#203) Also avoids double-running the FluentBenchmark tests and adds the missing `testSQL()` benchmark test.
- Loading branch information
Showing
2 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
extension MySQLError: DatabaseError { | ||
public var isSyntaxError: Bool { | ||
return false | ||
switch self { | ||
case .invalidSyntax(_): | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
public var isConstraintFailure: Bool { | ||
switch self { | ||
case .duplicateEntry(_): | ||
return true | ||
|
||
default: | ||
return false | ||
} | ||
} | ||
|
||
public var isConnectionClosed: Bool { | ||
return false | ||
switch self { | ||
case .closed: | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters