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
tabletable 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
dbconnection
tableNametable name
newTableNamenew 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
tableNametable name
newTableNamenew 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
dbconnection
tableNametable name
columnNamecolumn name
newColumnNamenew 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
tableNametable name
columnNamecolumn name
newColumnNamenew 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
dbconnection
tableNametable name
columnNamecolumn name
columnDefcolumn 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
tableNametable name
columnNamecolumn name
columnDefcolumn 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
dbconnection
tabletable
columnNamecolumn 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
dbconnection
tabletable
columnNamescolumn 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
dbconnection
tableNametable name
columnNamecolumn 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
dbconnection
tableNametable name
columnNamescolumn 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
dbconnection
tabletable
columncolumn
-
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
dbconnection
tabletable
columnscolumns
-
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
dbconnection
tableNametable name
columncolumn
-
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
dbconnection
tableNametable name
columnscolumns
-
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
dbconnection
tabletable
newTableNamenew 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
dbconnection
tabletable
newTableNamenew table name
transferContenttransfer 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
dbconnection
tableNametable name
newTableNamenew 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
dbconnection
tableNametable name
newTableNamenew table name
transferContenttransfer 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
dbconnection
newTablenew 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
dbconnection
newTablenew table schema
tableMappingtable 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
dbconnection
sqlnew table SQL
tableMappingtable mapping
View on GitHub
GPKGAlterTable Class Reference