![]() Use the INSERT INTO command to copy data from acctdb to portaldb. ATTACH DATABASE filename AS portaldb Note: The filename represents the path to the database. Use the ATTACH command to add the portaldb to acctdb. Rs = db.sqlselect("select sql from attached.sqlite_master")ĭb.sqlexecute rs.field("sql"). The following steps are involved in copying data: Connect to the account database using command-line. now read all the sql from the attached db and recreate everything in the in memory one first drop everything in the in memory dbĭim rs as recordset = db.sqlselect("select name, type from sqlite_master")ĭim stmt as string = "drop " + rs.field("type").stringvalue + " " + rs.field("name").stringvalue This may be close (I wrote it in line in the forum so there may be bugs) You can get all the names of tables, indexes etc etc and all the sql required to create themĪnd you can read all this from the attached one as well so you can drop all the tables in the in memory one, then recreate all the tables etc from the data in the attached database & insert all the data into the in memory one using “insert into select” as you already are You could literally wipe out the in memory database (check out the data you get by running “select * from sqlite_master”) If Not My_SQLiteDatabase.Error And My_RecordSet Nil Then My_SQLiteDatabase.SQLExecute TextInputStream.Open(("MyTest.SQLiteDatabaseDump")).ReadAllĭim My_RecordSet As RecordSet = My_SQLiteDatabase.SQLSelect("Select MyTextField From MyTable") My_Shell.Execute "echo '.dump' | sqlite3 " + My_ + " > " + ("MyTest.SQLiteDatabaseDump").NativePath My_SQLiteDatabase.BackUp My_SQLiteDatabaseBackup, Nil, -1 If My_SQLiteDatabaseBackup.CreateDatabaseFile Then My_SQLiteDatabaseBackup.DatabaseFile = ("MyTest.SQLiteDatabaseBackup") My_SQLiteDatabase.SQLExecute "Insert Into MyTable (MyTextField) Values ('Some Data')"ĭim My_SQLiteDatabaseBackup As New SQLiteDatabase ![]() My_SQLiteDatabase.SQLExecute "Create Table MyTable (MyTable_Id Integer Primary Key, MyTextField Text)" Dim My_SQLiteDatabase As New SQLiteDatabase
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |