mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 10:47:21 +00:00
Delete some unused code.
This commit is contained in:
1 parent
66bdf3a7ab
commit
a1ce49286e
2 files changed
+2
-34
No files matched your search
@@ -29,12 +29,6 @@ public typealias DatabaseBlock = @Sendable (DatabaseResult) -> Void
|
||||
/// Completion block that provides an optional DatabaseError.
|
||||
public typealias DatabaseCompletionBlock = @Sendable (DatabaseError?) -> Void
|
||||
|
||||
/// Result type for fetching an Int or getting a DatabaseError.
|
||||
public typealias DatabaseIntResult = Result<Int, DatabaseError>
|
||||
|
||||
/// Completion block for DatabaseIntResult.
|
||||
public typealias DatabaseIntCompletionBlock = (DatabaseIntResult) -> Void
|
||||
|
||||
/// Dictionary representing one row of database values, keyed by column name.
|
||||
public typealias DatabaseDictionary = [String: Any]
|
||||
|
||||
|
||||
@@ -23,11 +23,6 @@ public extension DatabaseTable {
|
||||
return database.rs_selectRowsWhereKey(key, equalsValue: value, tableName: name)
|
||||
}
|
||||
|
||||
func selectSingleRowWhere(key: String, equals value: Any, in database: FMDatabase) -> FMResultSet? {
|
||||
|
||||
return database.rs_selectSingleRowWhereKey(key, equalsValue: value, tableName: name)
|
||||
}
|
||||
|
||||
func selectRowsWhere(key: String, inValues values: [Any], in database: FMDatabase) -> FMResultSet? {
|
||||
if values.isEmpty {
|
||||
return nil
|
||||
@@ -68,34 +63,13 @@ public extension DatabaseTable {
|
||||
|
||||
// MARK: Counting
|
||||
|
||||
func numberWithCountResultSet(_ resultSet: FMResultSet) -> Int {
|
||||
guard resultSet.next() else {
|
||||
func numberWithSQLAndParameters(_ sql: String, _ parameters: [Any], in database: FMDatabase) -> Int {
|
||||
guard let resultSet = database.executeQuery(sql, withArgumentsIn: parameters), resultSet.next() else {
|
||||
return 0
|
||||
}
|
||||
return Int(resultSet.int(forColumnIndex: 0))
|
||||
}
|
||||
|
||||
func numberWithSQLAndParameters(_ sql: String, _ parameters: [Any], in database: FMDatabase) -> Int {
|
||||
|
||||
if let resultSet = database.executeQuery(sql, withArgumentsIn: parameters) {
|
||||
return numberWithCountResultSet(resultSet)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MARK: Mapping
|
||||
|
||||
func mapResultSet<T>(_ resultSet: FMResultSet, _ completion: (_ resultSet: FMResultSet) -> T?) -> [T] {
|
||||
|
||||
var objects = [T]()
|
||||
while resultSet.next() {
|
||||
if let obj = completion(resultSet) {
|
||||
objects += [obj]
|
||||
}
|
||||
}
|
||||
return objects
|
||||
}
|
||||
|
||||
// MARK: Columns
|
||||
|
||||
func containsColumn(_ columnName: String, in database: FMDatabase) -> Bool {
|
||||
|
||||
Reference in new issue
Block a user