No, I'm trying to do what I said I'm trying to do. Pass a series of commands to a single sqlite action and get back all the results.
Here's a little more representative example done as applescript. I'm trying to generalize it so I can use it with some other command line tools (FileMaker shell script plugins in this case) The example creates a simple table, populates it, creates a derivative table, performs selects in a few different modes, performs a dump, and passes ALL the results back as stdout. It works fine and does all those things when performed as applescript. -- start applescript set cmd to "CREATE TABLE t1 (recID, Name, statusMarker); INSERT INTO t1 VALUES (1, \"one\", 3); INSERT INTO t1 VALUES (2, \"Line A Line B Line C\", 3); INSERT INTO t1 VALUES (22, \"tw22o\", 12); CREATE TABLE t2 as select recID as R1 , Name as R2 from t1; .dump .mode html .header on .echo off SELECT * FROM t1; select R1 as \"Record ID\", R2 as NAME from t2 as table2; .mode line SELECT * FROM t1 order by name;" set cmd to "echo '" & cmd & "'|sqlite3 :memory: " do shell script cmd -- end script ========================================================= RESULT showing the sql dump + HTML output + line output ========================================================= "BEGIN TRANSACTION; CREATE TABLE t1 (recID, Name, statusMarker); INSERT INTO \"t1\" VALUES(1, 'one', 3); INSERT INTO \"t1\" VALUES(2, 'Line A Line B Line C', 3); INSERT INTO \"t1\" VALUES(22, 'tw22o', 12); CREATE TABLE t2(R1,R2); INSERT INTO \"t2\" VALUES(1, 'one'); INSERT INTO \"t2\" VALUES(2, 'Line A Line B Line C'); INSERT INTO \"t2\" VALUES(22, 'tw22o'); COMMIT; <TR><TH>recID</TH><TH>Name</TH><TH>statusMarker</TH></TR> <TR><TD>1</TD> <TD>one</TD> <TD>3</TD> </TR> <TR><TD>2</TD> <TD>Line A Line B Line C</TD> <TD>3</TD> </TR> <TR><TD>22</TD> <TD>tw22o</TD> <TD>12</TD> </TR> <TR><TH>Record ID</TH><TH>NAME</TH></TR> <TR><TD>1</TD> <TD>one</TD> </TR> <TR><TD>2</TD> <TD>Line A Line B Line C</TD> </TR> <TR><TD>22</TD> <TD>tw22o</TD> </TR> recID = 2 Name = Line A Line B Line C statusMarker = 3 recID = 1 Name = one statusMarker = 3 recID = 22 Name = tw22o statusMarker = 12" > On Sat, May 31, 2008 at 8:30 PM, Bruce Robertson <[EMAIL PROTECTED]> wrote: >> An example of how to do this with the shell would be helpful. >> >> Oddly enough I can do it with applescript; but I can't do it with some other >> shell tools I'm trying to use. >> >> My problem has to do with how to pass multiple lines to a single command. >> I'm sure it's quite simple but I keep poking around not getting anywhere. >> >> This is the applescript version: >> >> set this to "echo ' >> .read /a.sql >> .o stdout >> .dump >> .q >> '|sqlite3 " >> set this to paragraphs of this >> set applescript's text item delimiters to "\n" >> do shell script (this as text) >> -- result: >> "BEGIN TRANSACTION; >> CREATE TABLE Responses (GFUP_ID TEXT,FullQNum TEXT,ResponseNumber >> TEXT,SurveyVersion TEXT,RecordID TEXT); >> INSERT INTO \"Responses\" VALUES('36780001', '00.1.01', '1', '2000', '1'); >> INSERT INTO \"Responses\" VALUES('36780001', '02.1.01', '1', '2000', '2'); >> INSERT INTO \"Responses\" VALUES('36780001', '02.1.02', '', '2000', '3'); > > Are you trying to dump one database into another, new database? I > played around at the command line and came up with this. Not sure it > fits your needs. (I create a database test.db and then dump into a new > database test2.db.) > > $ sqlite3 test.db > SQLite version 3.5.7 > Enter ".help" for instructions > sqlite> create table test (one integer, two integer); > sqlite> insert into test values (1,2); > sqlite> select * from test; > 1|2 > $ > $ echo '.dump' | sqlite3 test.db | sqlite3 test2.db > $ sqlite3 test2.db > SQLite version 3.5.7 > Enter ".help" for instructions > sqlite> select * from test; > 1|2 > sqlite> > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users