bule
04-08-2009, 04:27 PM
Alter table (rename / add columns) support for SQLite 2.8 and IndigoRose AutoPlay Media Studio
SQLiteAddColumns accepts the following attributes:
1: SQLite database handle
2: SQLite table name
3: an array with new column names as indexes and column types as strings
4: name of the primary key column (default: 'id')
5: whether to keep the temporary table used in the process (default: false)
There is also a function SQLiteRenameTable(db, oldname, newname, primarykey) at your disposal.
Please note that the processing time of adding a new column to the table depends on the amount of data in your table. In order to implement alter table for the 2.x SQLite, data must be first writen to the temporary table, and than again to the original one!
WARNING: Any triggers or indexes you have on your table will be LOST, so make sure you recreate them after using either SQLiteAddColumns or SQLiteRenameTable functions!
Attached script version: 0.9.
It should work fine, but please test it a bit. It assumes you use SQLite 2 plugin bundled with APMS.
Also, please rename the file extension to .lua
SQLiteAddColumns accepts the following attributes:
1: SQLite database handle
2: SQLite table name
3: an array with new column names as indexes and column types as strings
4: name of the primary key column (default: 'id')
5: whether to keep the temporary table used in the process (default: false)
There is also a function SQLiteRenameTable(db, oldname, newname, primarykey) at your disposal.
Please note that the processing time of adding a new column to the table depends on the amount of data in your table. In order to implement alter table for the 2.x SQLite, data must be first writen to the temporary table, and than again to the original one!
WARNING: Any triggers or indexes you have on your table will be LOST, so make sure you recreate them after using either SQLiteAddColumns or SQLiteRenameTable functions!
Attached script version: 0.9.
It should work fine, but please test it a bit. It assumes you use SQLite 2 plugin bundled with APMS.
Also, please rename the file extension to .lua