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

Re: [sqlite] Performing Multiple SQL Statements Within A Transactions Using TCL

2013-10-10 Thread Gerry Snyder
On 10/10/2013 2:14 PM, Tilsley, Jerry M. wrote: All, Does anybody have any examples of wrapping multiple SQL insert/update statements in a transaction using the TCL API? Sure: db transaction { db eval {create table if not exists s2011.tclcode(procname text, version text, tcl text,

Re: [sqlite] Inserting or replacing in the same db based on one key

2013-10-10 Thread James K. Lowden
On Thu, 10 Oct 2013 12:29:21 -0400 "jose isaias cabrera" wrote: > > INSERT INTO SimplePrices > > SELECT cust || '1', class, slang, tlang, TransferCost, Price > > FROM SimplePrices WHERE cust = 'XEROX'; > > > > Kudos for the primary key declaration, btw. :-) > > Thanks

[sqlite] Performing Multiple SQL Statements Within A Transactions Using TCL

2013-10-10 Thread Tilsley, Jerry M.
All, Does anybody have any examples of wrapping multiple SQL insert/update statements in a transaction using the TCL API? Thanks, Jerry Tilsley, CIS Lvl 2 St. Claire Regional Medical Center Sr Systems Analyst jerry.tils...@st-claire.org Disclaimer This

[sqlite] LIMIT expression in subquery cannot reference outer query tables

2013-10-10 Thread Samuel Neff
When using LIMIT in a subquery it seems the expression cannot access the outer query's tables. Other complex expressions are supported in LIMIT, so I was curious if this is a defined limitation or something else? Example: sqlite> create table test (f int); sqlite> insert into test values (1);

Re: [sqlite] Temporary Tables

2013-10-10 Thread Igor Tandetnik
On 10/10/2013 1:16 PM, John wrote: Do you need to/should you drop temporary tables when you are done with them? You may. If you don't, the temp db and all tables in it will be deleted when you close the connection. -- Igor Tandetnik ___

[sqlite] Temporary Tables

2013-10-10 Thread John
Do you need to/should you drop temporary tables when you are done with them? Thanks. John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Inserting or replacing in the same db based on one key

2013-10-10 Thread jose isaias cabrera
"James K. Lowden" wrote... On Wed, 9 Oct 2013 17:00:36 -0400 "jose isaias cabrera" wrote: CREATE TABLE SimplePrices ( cust TEXT, class TEXT, slang TEXT, tlang TEXT, TransferCost, Price,

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

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

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

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

Re: [sqlite] Using an sqlite db as a mutex?

2013-10-10 Thread Stephan Beal
On Sat, Sep 28, 2013 at 10:09 AM, Stephan Beal wrote: > On Thu, Sep 26, 2013 at 5:31 PM, Dan Kennedy wrote: > >> It does. Both open a write transaction on the database. In the\ >> parent posts case either would work. >> > > Follow-up: i implemented

Re: [sqlite] Bug: analyze.c does not honor SQLITE_64BIT_STATS

2013-10-10 Thread Ryan Johnson
On 09/10/2013 9:53 PM, Richard Hipp wrote: On Wed, Oct 9, 2013 at 9:49 PM, James K. Lowden wrote: It's difficult to do portably because you have to account for every combination of standard C library and integer size Remember that SQLite does not use the

Re: [sqlite] Bug: analyze.c does not honor SQLITE_64BIT_STATS

2013-10-10 Thread Ralf Junker
On 10.10.2013 03:53, Richard Hipp wrote: I think that http://www.sqlite.org/src/info/e97d7d3044 fixes this issue. Works well for me. Please correct me if I've missed something. You committed to the "row-size-est" branch. I guess this will be merged into "trunk" for 3.8.1? Ralf