From f56e89a041b6d07e87f0890cbe939a089d836d4e Mon Sep 17 00:00:00 2001 From: tanner0101 Date: Thu, 20 Sep 2018 16:21:22 +0200 Subject: [PATCH 1/2] sql 2.1 updates --- Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift | 2 +- Sources/SQLite/SQL/SQLiteCreateTable.swift | 2 +- Sources/SQLite/SQL/SQLiteDropIndex.swift | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift b/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift index f5d0239..0ffbed5 100644 --- a/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift +++ b/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift @@ -1,4 +1,4 @@ -extension SQLAlterTableBuilder where Connection.Query.AlterTable == SQLiteAlterTable { +extension SQLAlterTableBuilder where Connection.Connection.Query.AlterTable == SQLiteAlterTable { /// Renames the table. /// /// conn.alter(table: Bar.self).rename(to: "foo").run() diff --git a/Sources/SQLite/SQL/SQLiteCreateTable.swift b/Sources/SQLite/SQL/SQLiteCreateTable.swift index 99a5cda..e34b78c 100644 --- a/Sources/SQLite/SQL/SQLiteCreateTable.swift +++ b/Sources/SQLite/SQL/SQLiteCreateTable.swift @@ -1,4 +1,4 @@ -extension SQLCreateTableBuilder where Connection.Query.CreateTable == SQLiteCreateTable { +extension SQLCreateTableBuilder where Connection.Connection.Query.CreateTable == SQLiteCreateTable { /// By default, every row in SQLite has a special column, usually called the "rowid", that uniquely identifies that row within /// the table. However if the phrase "WITHOUT ROWID" is added to the end of a CREATE TABLE statement, then the special "rowid" /// column is omitted. There are sometimes space and performance advantages to omitting the rowid. diff --git a/Sources/SQLite/SQL/SQLiteDropIndex.swift b/Sources/SQLite/SQL/SQLiteDropIndex.swift index a69f78e..55d8077 100644 --- a/Sources/SQLite/SQL/SQLiteDropIndex.swift +++ b/Sources/SQLite/SQL/SQLiteDropIndex.swift @@ -13,14 +13,14 @@ public struct SQLiteDropIndex: SQLDropIndex { } /// SQLite specific drop index builder. -public final class SQLiteDropIndexBuilder: SQLQueryBuilder - where Connection: SQLConnection, Connection.Query == SQLiteQuery +public final class SQLiteDropIndexBuilder: SQLQueryBuilder + where Connectable: SQLConnectable, Connectable.Connection.Query == SQLiteQuery { /// `AlterTable` query being built. public var dropIndex: SQLiteDropIndex /// See `SQLQueryBuilder`. - public var connection: Connection + public var connection: Connectable /// See `SQLQueryBuilder`. public var query: SQLiteQuery { @@ -28,14 +28,14 @@ public final class SQLiteDropIndexBuilder: SQLQueryBuilder } /// Creates a new `SQLCreateIndexBuilder`. - public init(_ dropIndex: SQLiteDropIndex, on connection: Connection) { + public init(_ dropIndex: SQLiteDropIndex, on connection: Connectable) { self.dropIndex = dropIndex self.connection = connection } } -extension SQLConnection where Query == SQLiteQuery { +extension SQLConnectable where Connection.Query == SQLiteQuery { /// Drops an index from a SQLite database. public func drop(index identifier: SQLiteIdentifier) -> SQLiteDropIndexBuilder { return .init(SQLiteDropIndex(identifier: identifier), on: self) From 8f6b598f71e0e800f36f3f708fa5302808c02618 Mon Sep 17 00:00:00 2001 From: tanner0101 Date: Thu, 20 Sep 2018 16:35:57 +0200 Subject: [PATCH 2/2] update to connectable --- Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift | 2 +- Sources/SQLite/SQL/SQLiteCreateTable.swift | 2 +- Sources/SQLite/SQL/SQLiteDropIndex.swift | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift b/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift index 0ffbed5..f294542 100644 --- a/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift +++ b/Sources/SQLite/SQL/SQLiteAlterTableBuilder.swift @@ -1,4 +1,4 @@ -extension SQLAlterTableBuilder where Connection.Connection.Query.AlterTable == SQLiteAlterTable { +extension SQLAlterTableBuilder where Connectable.Connection.Query.AlterTable == SQLiteAlterTable { /// Renames the table. /// /// conn.alter(table: Bar.self).rename(to: "foo").run() diff --git a/Sources/SQLite/SQL/SQLiteCreateTable.swift b/Sources/SQLite/SQL/SQLiteCreateTable.swift index e34b78c..d8a01df 100644 --- a/Sources/SQLite/SQL/SQLiteCreateTable.swift +++ b/Sources/SQLite/SQL/SQLiteCreateTable.swift @@ -1,4 +1,4 @@ -extension SQLCreateTableBuilder where Connection.Connection.Query.CreateTable == SQLiteCreateTable { +extension SQLCreateTableBuilder where Connectable.Connection.Query.CreateTable == SQLiteCreateTable { /// By default, every row in SQLite has a special column, usually called the "rowid", that uniquely identifies that row within /// the table. However if the phrase "WITHOUT ROWID" is added to the end of a CREATE TABLE statement, then the special "rowid" /// column is omitted. There are sometimes space and performance advantages to omitting the rowid. diff --git a/Sources/SQLite/SQL/SQLiteDropIndex.swift b/Sources/SQLite/SQL/SQLiteDropIndex.swift index 55d8077..3ef791e 100644 --- a/Sources/SQLite/SQL/SQLiteDropIndex.swift +++ b/Sources/SQLite/SQL/SQLiteDropIndex.swift @@ -20,7 +20,7 @@ public final class SQLiteDropIndexBuilder: SQLQueryBuilder public var dropIndex: SQLiteDropIndex /// See `SQLQueryBuilder`. - public var connection: Connectable + public var connectable: Connectable /// See `SQLQueryBuilder`. public var query: SQLiteQuery { @@ -28,9 +28,9 @@ public final class SQLiteDropIndexBuilder: SQLQueryBuilder } /// Creates a new `SQLCreateIndexBuilder`. - public init(_ dropIndex: SQLiteDropIndex, on connection: Connectable) { + public init(_ dropIndex: SQLiteDropIndex, on connectable: Connectable) { self.dropIndex = dropIndex - self.connection = connection + self.connectable = connectable } }