Skip to content

Commit

Permalink
#171: Missing upgrades to the new ResultCode APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
groue committed Mar 1, 2017
1 parent b873162 commit fe05ac9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions GRDB/FTS/FTS5CustomTokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
tokenizerHandle.pointee = tokenizerPointer
return SQLITE_OK
} catch let error as DatabaseError {
return error.code
return error.extendedResultCode.rawValue
} catch {
return SQLITE_ERROR
}
Expand Down Expand Up @@ -134,7 +134,7 @@
}
guard code == SQLITE_OK else {
// Assume a GRDB bug: there is no point throwing any error.
fatalError(DatabaseError(resultCode: code, message: lastErrorMessage).description)
fatalError(DatabaseError(resultCode: ResultCode(rawValue: code), message: lastErrorMessage).description)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion GRDB/FTS/FTS5Pattern.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}
} catch let error as DatabaseError {
// Remove private SQL & arguments from the thrown error
throw DatabaseError(resultCode: error.code, message: error.message, sql: nil, arguments: nil)
throw DatabaseError(resultCode: error.extendedResultCode, message: error.message, sql: nil, arguments: nil)
}

// Pattern is valid
Expand Down
8 changes: 4 additions & 4 deletions GRDB/FTS/FTS5Tokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
return SQLITE_OK
})
if (code != SQLITE_OK) {
throw DatabaseError(resultCode: code)
throw DatabaseError(resultCode: ResultCode(rawValue: code))
}
}
return context.tokens
Expand Down Expand Up @@ -147,13 +147,13 @@
}

guard code == SQLITE_OK else {
throw DatabaseError(resultCode: code, message: "failed fts5_tokenizer.xCreate")
throw DatabaseError(resultCode: ResultCode(rawValue: code), message: "failed fts5_tokenizer.xCreate")
}

if let tokenizerPointer = tokenizerPointer {
self.tokenizerPointer = tokenizerPointer
} else {
throw DatabaseError(resultCode: code, message: "nil tokenizer")
throw DatabaseError(resultCode: ResultCode(rawValue: code), message: "nil tokenizer")
}
}

Expand Down Expand Up @@ -205,7 +205,7 @@
xTokenizerPointer)

guard code == SQLITE_OK else {
throw DatabaseError(resultCode: code)
throw DatabaseError(resultCode: ResultCode(rawValue: code))
}

let contextPointer = contextHandle.pointee
Expand Down
4 changes: 2 additions & 2 deletions GRDB/FTS/FTS5WrapperTokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@
// Inject token bytes into SQLite
let code = tokenCallback(context, flags.rawValue, pToken, nToken, iStart, iEnd)
guard code == SQLITE_OK else {
throw DatabaseError(resultCode: code, message: "token callback failed")
throw DatabaseError(resultCode: ResultCode(rawValue: code), message: "token callback failed")
}
}
})

return SQLITE_OK
} catch let error as DatabaseError {
return error.code
return error.extendedResultCode.rawValue
} catch {
return SQLITE_ERROR
}
Expand Down

0 comments on commit fe05ac9

Please sign in to comment.