Suggestions: '.mode insert table' output to be within transaction, and REPLACE equivalent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Suggestions: '.mode insert table' output to be within transaction, and REPLACE equivalent

Tony Papadimitriou
A couple of suggestions (I don’t know if they have come up before):

1. I often update the same table (e.g., a phone directory table) in various independent databases and it’s simpler to cascade the changes by doing this:

sql a.db “.mode insert table” “select * from table” | sql b.db

than with this:

sql a.db “.mode insert table_name” “select * from table_name” > xxx.sql
sql b.db
>begin;
>.read xxx.sql
>end;

The problem is the shell command method lacks the transaction and the process takes a lot longer for large tables.

So, my suggestion is for the ‘.mode insert table’ output to automatically include the beginning BEGIN; and the corresponding ending END; (or COMMIT;).

If the current behavior is also required as is then perhaps some option to do it this or that way so that this procedure can be accomplished with a single line shell command.

2. For the same case as above, but instead of INSERT to use REPLACE (or INSERT OR REPLACE) with a new mode, e.g.: .mode replace table_name

Thank you.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users