Re: [sqlite] Intended use case for 'without rowid'?

2013-11-16 Thread Pepijn Van Eeckhoudt
> For Peter & Pepijn - I think the issue is essentially a forward-compatibility > problem moreso than a backward-compatibility one. So I think your idea on > introducing some version control would be the least painful. Indeed. The lack of rowid itself is not an issue. It's that someone could cr

Re: [sqlite] help writing DELETE with JOIN

2013-11-16 Thread David Cotter
outside of the parens? shouldn't it go inside the parens? eg: say the playlist ID i want is "57", would i do this? also: what is the "1" for? sorry for my newb-ness, still learning! but fun! DELETE FROM playlist WHERE EXISTS(SELECT 1 FROM songlist WHERE playlist.playlistID=songlis

Re: [sqlite] help writing DELETE with JOIN

2013-11-16 Thread David Cotter
what about "playlistID=X" ? the playlist table has "playlistID", (different playlists) i only want the ones in a particular playlist On Nov 15, 2013, at 5:36 AM, Richard Hipp wrote: > On Fri, Nov 15, 2013 at 2:55 AM, David M. Cotter wrote: > >> i have a "song" table S that has "songID", "play

Re: [sqlite] SQL 2003 in sqlite

2013-11-16 Thread James K. Lowden
On Wed, 13 Nov 2013 19:03:44 + Simon Slavin wrote: > I'm wondering what particular thing MERGE does that this person > needs, which doesn't happen if they use just the single commands > INSERT OR REPLACE or UPDATE OR REPLACE. On Wed, 13 Nov 2013 20:31:25 +0100 Petite Abeille wrote: > There

Re: [sqlite] executing queries on normalized database

2013-11-16 Thread James K. Lowden
On Sun, 10 Nov 2013 14:54:17 +0400 dd wrote: > After applying normalization, there are twelve tables with foreign > key support. Well done. > For insert/delete operations, it has to execute twelve queries > instead of two. Is it recommended way? Yes. In a user-defined transaction. Each

Re: [sqlite] executing queries on normalized database

2013-11-16 Thread James K. Lowden
On Mon, 11 Nov 2013 18:35:31 +0400 dd wrote: > Can I conclude this way: Foreign keys works pretty well when > application deals with parent keys only. But, application may need to > execute more queries when dealing with child key/tables. Constraints express rules that the DBMS enforces for you.

Re: [sqlite] What is wrong with this trigger?

2013-11-16 Thread James K. Lowden
On Sun, 10 Nov 2013 14:36:06 -0800 Igor Korot wrote: > Well from strictly mathematical point of view maximum or minimum of > nothing is nothing. And since nothing is 0, than it is zero. Who is the oldest female US president? You largest of a set must be a member of that set. Actually, I susp

Re: [sqlite] SQL 2003 in sqlite

2013-11-16 Thread Simon Slavin
On 16 Nov 2013, at 3:11pm, James K. Lowden wrote: > http://www.schemamania.org/sql/#some.rows > > The logical equivalent of MERGE is accomplished by one INSERT and one > UPDATE inside a user-defined transaction. Given SQLite's locking > semantics, it's atomic. Nothing procedural about it.

Re: [sqlite] What is wrong with this trigger?

2013-11-16 Thread Simon Slavin
On 16 Nov 2013, at 3:14pm, James K. Lowden wrote: > On Sun, 10 Nov 2013 14:36:06 -0800 > Igor Korot wrote: > >> Well from strictly mathematical point of view maximum or minimum of >> nothing is nothing. And since nothing is 0, than it is zero. > > Who is the oldest female US president? And,

Re: [sqlite] SQL 2003 in sqlite

2013-11-16 Thread Petite Abeille
On Nov 16, 2013, at 4:11 PM, James K. Lowden wrote: > The logical equivalent of MERGE is accomplished by one INSERT and one > UPDATE inside a user-defined transaction. Given SQLite's locking > semantics, it's atomic. Nothing procedural about it. Well, one would still need to wrap these tran

Re: [sqlite] Intended use case for 'without rowid'?

2013-11-16 Thread RSmith
Perhaps we should make the allowed DDL subset a part of the spec. That way we make explicit what is allowed and anything outside of that is forbidden. Pepijn Perhaps. It would involve a rather large document though, one which an average user is sure to skip over but at least it provides indem

Re: [sqlite] help writing DELETE with JOIN

2013-11-16 Thread David M. Cotter
okay i realize my requirements were wrong, here's a better summary: the plID (playlist ID) in the song table is different (the OLD id 33), the plID in the playlist table is the new ID 35, so i have to test them separately. the song ID's must match the playlist table's index is the plID, so i gu

[sqlite] Correct order of 'using' in System.Data.SQLite

2013-11-16 Thread William Drago
All, I am still new to SQLite and C#. I am wondering if I have the correct order of 'using' statements in the code below. In particular, I am wondering if 'using (transaction...)' should come before 'using (SQLCommand...)' Any other comments are appreciated. Thanks, -Bill =

Re: [sqlite] help writing DELETE with JOIN

2013-11-16 Thread RSmith
On 2013/11/16 20:02, David M. Cotter wrote: okay i realize my requirements were wrong, here's a better summary: the plID (playlist ID) in the song table is different (the OLD id 33), the plID in the playlist table is the new ID 35, so i have to test them separately. the song ID's must match t

[sqlite] Trouble with Journal_Mode Pragma

2013-11-16 Thread Stephen Chrzanowski
I'm not sure why this code is breaking: procedure SaveDatabaseTo(fName:string); var TempDB:tsqlitedatabase; begin TempDB:=TSQLiteDatabase.Create(fName); TempDB.ExecSQL('PRAGMA journal_mode = OFF'); db.Backup(TempDB); tempdb.free; end; It fails at the PRAGMA statement. In the CLI, the c

Re: [sqlite] SQL 2003 in sqlite

2013-11-16 Thread Kees Nuyt
On Sat, 16 Nov 2013 17:19:06 +0100, Petite Abeille wrote: > >On Nov 16, 2013, at 4:11 PM, James K. Lowden wrote: > >> The logical equivalent of MERGE is accomplished by one INSERT and one >> UPDATE inside a user-defined transaction. Given SQLite's locking >> semantics, it's atomic. Nothing pro

Re: [sqlite] SQL 2003 in sqlite

2013-11-16 Thread Petite Abeille
On Nov 16, 2013, at 11:02 PM, Kees Nuyt wrote: > For the application, the merge would look like a single > INSERT INTO merge_t statement. H…. clever lateral thinking, but I doubt this will fly in practice :) Two main issues: (1) ‘or ignore’ is most likely inappropriate as unrelated constr

Re: [sqlite] Trouble with Journal_Mode Pragma

2013-11-16 Thread Clemens Ladisch
Stephen Chrzanowski wrote: > I'm not sure why this code is breaking: > > procedure SaveDatabaseTo(fName:string); > var > TempDB:tsqlitedatabase; > begin > TempDB:=TSQLiteDatabase.Create(fName); > TempDB.ExecSQL('PRAGMA journal_mode = OFF'); > db.Backup(TempDB); > tempdb.free; > end; > > I

[sqlite] SQLite server/file-locking scenario

2013-11-16 Thread Joshua Grauman
Hello all, I am writing a server program that reads and writes several different sqlite databases. Each client program can do one of the following at a time 1) send a file with a bunch of SQL statements that the server will run on the appropriate database, or 2) request an entire database file

Re: [sqlite] SQLite server/file-locking scenario

2013-11-16 Thread Simon Slavin
On 16 Nov 2013, at 11:37pm, Joshua Grauman wrote: > Or conversely, that if sqlite has the file open to write, my program will > read a cached version (if reading and writing happen at the same time, I'm > fine with the reader getting a slightly stale version). But I'm not > completely clear o

Re: [sqlite] Trouble with Journal_Mode Pragma

2013-11-16 Thread Kevin Benson
On Sat, Nov 16, 2013: > Stephen Chrzanowski wrote: > > I'm not sure why this code is breaking: > > > > procedure SaveDatabaseTo(fName:string); > > var > > TempDB:tsqlitedatabase; > > begin > > TempDB:=TSQLiteDatabase.Create(fName); > > TempDB.ExecSQL('PRAGMA journal_mode = OFF'); > > db.Ba

Re: [sqlite] SQLite server/file-locking scenario

2013-11-16 Thread Joshua Grauman
Thanks so much for the reply. Sorry for the ignorance, but wouldn't only the sectors (page cache) that are being written need to be cached? And I was trying to read up on how sqlite does atomic writes, but doesn't the way sqlite handles atomic writes guarentee that the file is *always* in a val