Re: [sqlite] Using several .commands from a Script

2013-10-10 Thread James K. Lowden
On Thu, 10 Oct 2013 16:27:21 +0200 Stephan Beal wrote: > > (echo .separator "||"; echo .import path tbl) | sqlite3 dbfile > > > > Alternately, most Unix shells allow: > > echo -e ".separator '[||'\n.import ..." > > the -e enables the conventional set of backslash escapes. We're OT here, but

Re: [sqlite] Using several .commands from a Script

2013-10-10 Thread John
(echo .separator "||"; echo .import path tbl) | sqlite3 dbfile worked perfectly. Thank you Clemens, Stephan and Simon for the ideas. I learned a bunch of new things today. John On Thu, Oct 10, 2013 at 10:18 AM, Clemens Ladisch wrote: > John wrote: > > I am having problems creating a

Re: [sqlite] Using several .commands from a Script

2013-10-10 Thread Simon Slavin
On 10 Oct 2013, at 3:02pm, John wrote: > Combining .commands does NOT work: > > do shell script ("sqlite3 " & databasePath & " .separator \"||\" ; .import > path/to/csv Main") > - > > Is my syntax wrong or can .commands not be included in

Re: [sqlite] Using several .commands from a Script

2013-10-10 Thread Stephan Beal
On Thu, Oct 10, 2013 at 4:18 PM, Clemens Ladisch wrote: > If you cannot generate newline characters, try to execute something > like this: > > (echo .separator "||"; echo .import path tbl) | sqlite3 dbfile > Alternately, most Unix shells allow: echo -e ".separator '[||'\n.import ..." the -e

Re: [sqlite] Using several .commands from a Script

2013-10-10 Thread Clemens Ladisch
John wrote: > I am having problems creating a "do shell script" command which includes > both the import command and the insert command. The reason they need to be > combined is that the shells instance ends with the command. > > do shell script ("sqlite3 " & databasePath & " .separator \"||\" ; .

[sqlite] Using several .commands from a Script

2013-10-10 Thread John
I have a fairly long AppleScript that I creates a csv file which then needs to be imported into a database. I am trying to use the .import command from AppleScript's "do shell script" command to import a csv file into a temporary table. I then need to import the temporary table into the Main table