mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Cleanup
This commit is contained in:
1 parent
a46b4edb0a
commit
a3ad726111
4 files changed
+72
-152
No files matched your search
@@ -1,61 +0,0 @@
|
||||
// MARK: - SQLSelectQuery
|
||||
|
||||
/// This protocol is an implementation detail of the query interface.
|
||||
/// Do not use it directly.
|
||||
///
|
||||
/// See https://github.com/groue/GRDB.swift/#the-query-interface
|
||||
///
|
||||
/// # Low Level Query Interface
|
||||
///
|
||||
/// SQLSelectQuery is the protocol for types that represent a full select query.
|
||||
public protocol SQLSelectQuery : Request {
|
||||
|
||||
/// This function is an implementation detail of the query interface.
|
||||
/// Do not use it directly.
|
||||
///
|
||||
/// See https://github.com/groue/GRDB.swift/#the-query-interface
|
||||
///
|
||||
/// # Low Level Query Interface
|
||||
///
|
||||
/// Returns the SQL string of the select query.
|
||||
///
|
||||
/// When the arguments parameter is nil, any value must be written down as
|
||||
/// a literal in the returned SQL.
|
||||
///
|
||||
/// When the arguments parameter is not nil, then values may be replaced by
|
||||
/// `?` or colon-prefixed tokens, and fed into arguments.
|
||||
func selectQuerySQL(_ arguments: inout StatementArguments?) -> String
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Request adoption
|
||||
|
||||
extension SQLSelectQuery {
|
||||
|
||||
/// A tuple that contains a prepared statement that is ready to be
|
||||
/// executed, and an eventual row adapter.
|
||||
public func prepare(_ db: Database) throws -> (SelectStatement, RowAdapter?) {
|
||||
var arguments: StatementArguments? = StatementArguments()
|
||||
let sql = self.selectQuerySQL(&arguments)
|
||||
let statement = try db.makeSelectStatement(sql)
|
||||
try statement.setArgumentsWithValidation(arguments!)
|
||||
return (statement, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - QueryInterfaceSelectQueryDefinition
|
||||
|
||||
extension QueryInterfaceSelectQueryDefinition : SQLSelectQuery {
|
||||
/// This function is an implementation detail of the query interface.
|
||||
/// Do not use it directly.
|
||||
///
|
||||
/// See https://github.com/groue/GRDB.swift/#the-query-interface
|
||||
///
|
||||
/// # Low Level Query Interface
|
||||
///
|
||||
/// See SQLSelectQuery.selectQuerySQL(_:arguments:)
|
||||
func selectQuerySQL(_ arguments: inout StatementArguments?) -> String {
|
||||
return sql(&arguments)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user