Re: [sqlite] Insert statement

2013-09-08 Thread Kees Nuyt
On Sun, 8 Sep 2013 22:56:20 +, "Joseph L. Casale" wrote: >Hi, >What is the most efficient way to insert several records into a table which >has a fk ref to the auto incrementing pk of another insert I need to do in the >same statement. What is efficient?

Re: [sqlite] SQLite and Virtual PC

2013-09-08 Thread Bert Huijben
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Gintaras Didzgalvis > Sent: zondag 8 september 2013 06:32 > To: sqlite-users@sqlite.org > Subject: [sqlite] SQLite and Virtual PC > > Hi, > > SQLite running on

Re: [sqlite] Insert statement

2013-09-08 Thread Simon Slavin
On 9 Sep 2013, at 3:36am, Joseph L. Casale wrote: > That is the procedure I utilize normally, the requirement for this specific > case is > that the entire set of inserts into table_a be bundled with their associated > inserts > into table_b in one statement where I

Re: [sqlite] Insert statement

2013-09-08 Thread David Bicking
You might be able to store your "variable" in a table: CREATE TABLE table_lastid  (id INTEGER); INSERT INTO table_lastid (id) VALUES(0); Then in your sequence: INSERT INTO table_a (val) VALUES ('xx'); UPDATE table_lastid SET id = last_insert_rowid(); INSERT INTO table_b (id, key, val)  

Re: [sqlite] Insert statement

2013-09-08 Thread Keith Medcalf
val would have to be declared unique (have a unique index) in order for that to work as intended, otherwise it will insert as many rows as there are duplicate val values ... > -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On

Re: [sqlite] Insert statement

2013-09-08 Thread Keith Medcalf
If you are using a programming language, simply retrieve the id after the first insert, then bind that host variable when executing subsequent statements. You can also try something like: BEGIN IMMEDIATE; Insert into table1 values ('...'); Insert into table2 (id, key, val) Select id, key,

Re: [sqlite] Insert statement

2013-09-08 Thread Joseph L. Casale
> Look up the last_insert_rowid() you want and store it in your programming > language. That's what programming languages are for. But if you want to do > it less efficiently ... Hey Simon, That is the procedure I utilize normally, the requirement for this specific case is that the entire set

Re: [sqlite] Insert statement

2013-09-08 Thread Simon Slavin
On 9 Sep 2013, at 3:17am, Joseph L. Casale wrote: > INSERT INTO table_a (val) VALUES ('xx'); > INSERT INTO table_b (id, key, val) > SELECT last_insert_rowid(), 'yyy', 'zzz'; > > Just not sure how to perform 20 or 30 of those inserts into table_b after the

Re: [sqlite] Insert statement

2013-09-08 Thread Joseph L. Casale
> If I understand the question, and there is no key other than the > auto-incrementing > integer, there might not be a good way. It sounds like the database's design > may > have painted you into a corner. Hi James, Well, after inserting one row into table A which looks like (without

Re: [sqlite] Insert statement

2013-09-08 Thread James K. Lowden
On Sun, 8 Sep 2013 22:56:20 + "Joseph L. Casale" wrote: > What is the most efficient way to insert several records into a table > which has a fk ref to the auto incrementing pk of another insert I > need to do in the same statement. If I understand the question,

Re: [sqlite] SQLite and Virtual PC

2013-09-08 Thread Teg
Hello Stephen, My experience is that shared folders under Virtual PC are completely unreliable. SMB actually works better, other than the fact Sqlite doesn't seem to like SMB. C Sunday, September 8, 2013, 4:46:04 PM, you wrote: SC> You're using it via a network which is a no-no for

[sqlite] Insert statement

2013-09-08 Thread Joseph L. Casale
Hi, What is the most efficient way to insert several records into a table which has a fk ref to the auto incrementing pk of another insert I need to do in the same statement. I am migrating some code away from using the SQLAlchemy orm to using the Core. The way the data is returned to me is a

Re: [sqlite] SQLite and Virtual PC

2013-09-08 Thread Stephen Chrzanowski
You're using it via a network which is a no-no for SQLite. ANY remote access of a file under any networking infrastructure isn't guaranteed with SQLite. On Sun, Sep 8, 2013 at 12:31 AM, Gintaras Didzgalvis < supp...@quickmacros.com> wrote: > Hi, > > SQLite running on Microsoft Virtual PC 2007

[sqlite] SQLite and Virtual PC

2013-09-08 Thread Gintaras Didzgalvis
Hi, SQLite running on Microsoft Virtual PC 2007 cannot read and write databases that are on host PC. Details: sqlite3_open_v2(SQLITE_OPEN_READWRITE) succeeds, but sqlite3_exec returns SQLITE_BUSY, even with SELECT. Using the official downloaded sqlite3.dll, version 3.8.0. OS on guest PC,

[sqlite] SQLite Linq not being loaded

2013-09-08 Thread Steve Palmer
Hi! Has anybody successfully used System.Data.SQLite.Linq in their project and can perhaps help me with this? Even after including this DLL in my project reference, it is apparent that Linq is calling the wrong provider when building the appropriate SQL statements. It is throwing an exception in