Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/PostgresStORM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ open class PostgresStORM: StORM, StORMProtocol {
let result = thisConnection.server.exec(statement: statement, params: params)

// set exec message
errorMsg = thisConnection.server.errorMessage().trimmingCharacters(in: .whitespacesAndNewlines)
if StORMdebug { LogFile.info("Error msg: \(errorMsg)", logFile: "./StORMlog.txt") }
errorMsg = thisConnection.server.errorMessage().trimmingCharacters(in: .whitespacesAndNewlines)
if isError() {
if StORMdebug { LogFile.info("Error msg: \(errorMsg)", logFile: "./StORMlog.txt") }
thisConnection.server.close()
throw StORMError.error(errorMsg)
}
Expand Down Expand Up @@ -107,8 +107,8 @@ open class PostgresStORM: StORM, StORMProtocol {

// set exec message
errorMsg = thisConnection.server.errorMessage().trimmingCharacters(in: .whitespacesAndNewlines)
if StORMdebug { LogFile.info("Error msg: \(errorMsg)", logFile: "./StORMlog.txt") }
if isError() {
if StORMdebug { LogFile.info("Error msg: \(errorMsg)", logFile: "./StORMlog.txt") }
thisConnection.server.close()
throw StORMError.error(errorMsg)
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/parseRows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ extension PostgresStORM {
let output = result.getFieldString(tupleIndex: x, fieldIndex: f)
let formatter = DateFormatter()
formatter.dateFormat = "yyyy/MM/dd hh:mm Z"
params[result.fieldName(index: f)!] = formatter.date(from: output!)
if let output = output {
params[result.fieldName(index: f)!] = formatter.date(from: output)
}

// time
// timestamp
Expand Down