GPKGAlterTable
Objective-C
@interface GPKGAlterTable : NSObject
Swift
class GPKGAlterTable : NSObject
Builds and performs alter table statements
-
Create the ALTER TABLE SQL command prefix
Declaration
Objective-C
+ (NSString *)alterTable:(NSString *)table;
Swift
class func alterTable(_ table: String!) -> String!
Parameters
table
table name
Return Value
alter table SQL prefix
-
Rename a table
Declaration
Objective-C
+ (void)renameTable:(NSString *)tableName toTable:(NSString *)newTableName withConnection:(GPKGConnection *)db;
Swift
class func renameTable(_ tableName: String!, toTable newTableName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
newTableName
new table name
-
Create the rename table SQL
Declaration
Objective-C
+ (NSString *)renameTableSQL:(NSString *)tableName toTable:(NSString *)newTableName;
Swift
class func renameTableSQL(_ tableName: String!, toTable newTableName: String!) -> String!
Parameters
tableName
table name
newTableName
new table name
Return Value
rename table SQL
-
Rename a column
Declaration
Objective-C
+ (void)renameColumn:(NSString *)columnName inTable:(NSString *)tableName toColumn:(NSString *)newColumnName withConnection:(GPKGConnection *)db;
Swift
class func renameColumn(_ columnName: String!, inTable tableName: String!, toColumn newColumnName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
columnName
column name
newColumnName
new column name
-
Create the rename column SQL
Declaration
Objective-C
+ (NSString *)renameColumnSQL:(NSString *)columnName inTable:(NSString *)tableName toColumn:(NSString *)newColumnName;
Swift
class func renameColumnSQL(_ columnName: String!, inTable tableName: String!, toColumn newColumnName: String!) -> String!
Parameters
tableName
table name
columnName
column name
newColumnName
new column name
Return Value
rename table SQL
-
Add a column
Declaration
Objective-C
+ (void)addColumn:(NSString *)columnName withDefinition:(NSString *)columnDef toTable:(NSString *)tableName withConnection:(GPKGConnection *)db;
Swift
class func addColumn(_ columnName: String!, withDefinition columnDef: String!, toTable tableName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
columnName
column name
columnDef
column definition
-
Create the add column SQL
Declaration
Objective-C
+ (NSString *)addColumnSQL:(NSString *)columnName withDefinition:(NSString *)columnDef toTable:(NSString *)tableName;
Swift
class func addColumnSQL(_ columnName: String!, withDefinition columnDef: String!, toTable tableName: String!) -> String!
Parameters
tableName
table name
columnName
column name
columnDef
column definition
Return Value
add column SQL
-
Drop a column
Declaration
Objective-C
+ (void)dropColumn:(NSString *)columnName fromTable:(GPKGUserTable *)table withConnection:(GPKGConnection *)db;
Swift
class func dropColumn(_ columnName: String!, from table: GPKGUserTable!, with db: GPKGConnection!)
Parameters
db
connection
table
table
columnName
column name
-
Drop columns
Declaration
Objective-C
+ (void)dropColumns:(NSArray<NSString *> *)columnNames fromTable:(GPKGUserTable *)table withConnection:(GPKGConnection *)db;
Swift
class func dropColumns(_ columnNames: [String]!, from table: GPKGUserTable!, with db: GPKGConnection!)
Parameters
db
connection
table
table
columnNames
column names
-
Drop a column
Declaration
Objective-C
+ (void)dropColumn:(NSString *)columnName fromTableName:(NSString *)tableName withConnection:(GPKGConnection *)db;
Swift
class func dropColumn(_ columnName: String!, fromTableName tableName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
columnName
column name
-
Drop columns
Declaration
Objective-C
+ (void)dropColumns:(NSArray<NSString *> *)columnNames fromTableName:(NSString *)tableName withConnection:(GPKGConnection *)db;
Swift
class func dropColumns(_ columnNames: [String]!, fromTableName tableName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
columnNames
column names
-
Alter a column
Declaration
Objective-C
+ (void)alterColumn:(GPKGUserColumn *)column inTable:(GPKGUserTable *)table withConnection:(GPKGConnection *)db;
Swift
class func alter(_ column: GPKGUserColumn!, in table: GPKGUserTable!, with db: GPKGConnection!)
Parameters
db
connection
table
table
column
column
-
Alter columns
Declaration
Objective-C
+ (void)alterColumns:(NSArray<GPKGUserColumn *> *)columns inTable:(GPKGUserTable *)table withConnection:(GPKGConnection *)db;
Swift
class func alter(_ columns: [GPKGUserColumn]!, in table: GPKGUserTable!, with db: GPKGConnection!)
Parameters
db
connection
table
table
columns
columns
-
Alter a column
Declaration
Objective-C
+ (void)alterColumn:(GPKGUserCustomColumn *)column inTableName:(NSString *)tableName withConnection:(GPKGConnection *)db;
Swift
class func alter(_ column: GPKGUserCustomColumn!, inTableName tableName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
column
column
-
Alter columns
Declaration
Objective-C
+ (void)alterColumns:(NSArray<GPKGUserCustomColumn *> *)columns inTableName:(NSString *)tableName withConnection:(GPKGConnection *)db;
Swift
class func alter(_ columns: [GPKGUserCustomColumn]!, inTableName tableName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
columns
columns
-
Copy the table and row content
Declaration
Objective-C
+ (void)copyTable:(GPKGUserTable *)table toTable:(NSString *)newTableName withConnection:(GPKGConnection *)db;
Swift
class func copy(_ table: GPKGUserTable!, toTable newTableName: String!, with db: GPKGConnection!)
Parameters
db
connection
table
table
newTableName
new table name
-
Copy the table
Declaration
Objective-C
+ (void)copyTable:(GPKGUserTable *)table toTable:(NSString *)newTableName andTransfer:(BOOL)transferContent withConnection:(GPKGConnection *)db;
Swift
class func copy(_ table: GPKGUserTable!, toTable newTableName: String!, andTransfer transferContent: Bool, with db: GPKGConnection!)
Parameters
db
connection
table
table
newTableName
new table name
transferContent
transfer row content to the new table
-
Copy the table and row content
Declaration
Objective-C
+ (void)copyTableName:(NSString *)tableName toTable:(NSString *)newTableName withConnection:(GPKGConnection *)db;
Swift
class func copyName(_ tableName: String!, toTable newTableName: String!, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
newTableName
new table name
-
Copy the table
Declaration
Objective-C
+ (void)copyTableName:(NSString *)tableName toTable:(NSString *)newTableName andTransfer:(BOOL)transferContent withConnection:(GPKGConnection *)db;
Swift
class func copyName(_ tableName: String!, toTable newTableName: String!, andTransfer transferContent: Bool, with db: GPKGConnection!)
Parameters
db
connection
tableName
table name
newTableName
new table name
transferContent
transfer row content to the new table
-
Alter a table with a new table schema assuming a default table mapping.
This removes views on the table, creates a new table, transfers the old table data to the new, drops the old table, and renames the new table to the old. Indexes, triggers, and views that reference deleted columns are not recreated. An attempt is made to recreate the others including any modifications for renamed columns.
Making Other Kinds Of Table Schema Changes:
Declaration
Objective-C
+ (void)alterTable:(GPKGUserTable *)newTable withConnection:(GPKGConnection *)db;
Swift
class func alter(_ newTable: GPKGUserTable!, with db: GPKGConnection!)
Parameters
db
connection
newTable
new table schema
-
Alter a table with a new table schema and table mapping.
Altering a table: Removes views on the table, creates a new table, transfers the old table data to the new, drops the old table, and renames the new table to the old. Indexes, triggers, and views that reference deleted columns are not recreated. An attempt is made to recreate the others including any modifications for renamed columns.
Creating a new table: Creates a new table and transfers the table data to the new. Triggers are not created on the new table. Indexes and views that reference deleted columns are not recreated. An attempt is made to create the others on the new table.
Making Other Kinds Of Table Schema Changes:
Declaration
Objective-C
+ (void)alterTable:(GPKGUserTable *)newTable withMapping:(GPKGTableMapping *)tableMapping withConnection:(GPKGConnection *)db;
Swift
class func alter(_ newTable: GPKGUserTable!, with tableMapping: GPKGTableMapping!, with db: GPKGConnection!)
Parameters
db
connection
newTable
new table schema
tableMapping
table mapping
-
Alter a table with a new table SQL creation statement and table mapping.
Altering a table: Removes views on the table, creates a new table, transfers the old table data to the new, drops the old table, and renames the new table to the old. Indexes, triggers, and views that reference deleted columns are not recreated. An attempt is made to recreate the others including any modifications for renamed columns.
Creating a new table: Creates a new table and transfers the table data to the new. Triggers are not created on the new table. Indexes and views that reference deleted columns are not recreated. An attempt is made to create the others on the new table.
Making Other Kinds Of Table Schema Changes:
Declaration
Objective-C
+ (void)alterTableSQL:(NSString *)sql withMapping:(GPKGTableMapping *)tableMapping withConnection:(GPKGConnection *)db;
Swift
class func alterTableSQL(_ sql: String!, with tableMapping: GPKGTableMapping!, with db: GPKGConnection!)
Parameters
db
connection
sql
new table SQL
tableMapping
table mapping