Database.isGRDBInternalTable(_:)

This commit is contained in:
Gwendal Roué committed 2018-03-15 20:04:50 +01:00
1 parent d61551cedb
commit 0d7f392bcd
3 files changed
+13 -2

No files matched your search

+1
View File
@@ -6,6 +6,7 @@ Release Notes
### New
- `Database.isSQLiteInternalTable(_:)` returns whether a table name is an internal SQLite table.
- `Database.isGRDBInternalTable(_:)` returns whether a table name is an internal GRDB table.
### Breaking Changes
+10 -1
View File
@@ -32,6 +32,8 @@ extension Database {
/// Returns whether a table is an internal SQLite table.
///
/// Those are tables whose name begins with "sqlite_".
///
/// For more information, see https://www.sqlite.org/fileformat2.html
public func isSQLiteInternalTable(_ tableName: String) -> Bool {
// https://www.sqlite.org/fileformat2.html#internal_schema_objects
@@ -42,7 +44,14 @@ extension Database {
// > "sqlite_".
return tableName.starts(with: "sqlite_")
}
/// Returns whether a table is an internal GRDB table.
///
/// Those are tables whose name begins with "grdb_".
public func isGRDBInternalTable(_ tableName: String) -> Bool {
return tableName.starts(with: "grdb_")
}
/// Returns whether a view exists.
public func viewExists(_ viewName: String) throws -> Bool {
// SQlite identifiers are case-insensitive, case-preserving (http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html)
+2 -1
View File
@@ -1647,7 +1647,8 @@ try db.indexes(on: "players") // [IndexInfo], the indexes defined on the tab
try db.foreignKeys(on: "players") // [ForeignKeyInfo], the foreign keys defined on the table
try db.primaryKey("players") // PrimaryKeyInfo
try db.table("players", hasUniqueKey: ["email"]) // Bool, true if column(s) is a unique key
Database.isSQLiteInternalTable("players") // Bool, true if argument is the name of an internal to SQLite table
Database.isSQLiteInternalTable(...) // Bool, true if argument is the name of an internal SQLite table
Database.isGRDBInternalTable(...) // Bool, true if argument is the name of an internal GRDB table
```