On 20 Jul 2016 at 23:14, Robby Helperin <[email protected]> wrote:
> Thanks, Simon, this looks promising!
>
> Is this something that can be done programmatically in code (vb.net) or only
> from the command prompt?
>
> If programmatically, could you shoot me a quick syntax example?
Here's an example of what I do in PHP to move a row from one database to
another. I need to go via a memory database in order to get a unique absid in
the destination db:
$dbh->exec ("attach database ':memory:' as mem');
$dbh->exec ("create table mem.messages as select * from main.messages
where absid=" . $absid);
$dbh->exec ("update mem.messages set absid=null");
$dbh->exec ("attach database '/path/to/destination/db' as dst");
$dbh->exec ("insert into dst.messages select * from mem.messages");
$dbh->exec ("delete from main.messages where absid=" . $absid);
Here, $dbh is a handle for the source database, $absid gives the id of the row
to be moved from the source db. In the destination db it has a new, unique, id.
Doing it as above means that you don't need to know what the schema is for the
messages table, as long as it is the same in both db.
--
Cheers -- Tim
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users