Re: [sqlite] Stricter parsing rules

2012-11-14 Thread Simon Slavin
On 14 Nov 2012, at 9:46pm, BareFeetWare wrote: > I agree. this tolerance by SQLite for misquoted identifiers allows a lot of > errors. I'd really like to see the rules tightened to remove ambiguous input. Me three. Perhaps this and a couple of similar things will be fixed in SQLite4. Simon.

Re: [sqlite] Stricter parsing rules

2012-11-14 Thread BareFeetWare
I agree. this tolerance by SQLite for misquoted identifiers allows a lot of errors. I'd really like to see the rules tightened to remove ambiguous input. Thanks, Tom Tom Brodhurst-Hill BareFeetWare -- iPhone/iPad/iPod and Mac software development, specialising in databases develo...@barefeetwar

[sqlite] Stricter parsing rules

2012-11-14 Thread NSRT Mail account.
In accordance with SQL standards and SQLite developing guidelines, my entire team always uses double quotes around identifiers, and single quotes around string literals. Some relevant documentation is here: http://www.sqlite.org/lang_keywords.html "SQLite adds new keywords from time to time when

Re: [sqlite] Trigger logic with INSERT OR REPLACE

2012-11-14 Thread Simon Slavin
On 14 Nov 2012, at 3:17pm, kyan wrote: > PS: Because of this the INSERT OR REPLACE statement cannot be > considered logically equivalent to MSSQL or ORACLE's MERGE statement > (http://en.wikipedia.org/wiki/Merge_%28SQL%29) which IMHO should be > added to SQLite at some point. The two are suffi

Re: [sqlite] Trigger logic with INSERT OR REPLACE

2012-11-14 Thread kyan
> No. INSERT OR REPLACE does an INSERT, possibly after doing a DELETE. It > never does an UPDATE. http://www.sqlite.org/lang_conflict.html Similarly any detail rows that are linked with foreign keys to the affected row will be handled according to the FK's ON DELETE clause. For instance if the

Re: [sqlite] Trigger logic with INSERT OR REPLACE

2012-11-14 Thread Daniel Polski
Ok thanks! Simon Slavin skrev 2012-11-14 16:04: On 14 Nov 2012, at 2:58pm, Daniel Polski wrote: If I have a value in a table, and use INSERT OR REPLACE to update the value, a trigger created with AFTER UPDATE ON won't fire. Shouldn't an INSERT OR REPLACE to a table which already contain d

Re: [sqlite] Trigger logic with INSERT OR REPLACE

2012-11-14 Thread Simon Slavin
On 14 Nov 2012, at 2:58pm, Daniel Polski wrote: > If I have a value in a table, and use INSERT OR REPLACE to update the value, > a trigger created with AFTER UPDATE ON won't fire. Shouldn't an INSERT OR > REPLACE to a table which already contain data which are beeing replaced be > considered

[sqlite] Trigger logic with INSERT OR REPLACE

2012-11-14 Thread Daniel Polski
Hello, If I have a value in a table, and use INSERT OR REPLACE to update the value, a trigger created with AFTER UPDATE ON won't fire. Shouldn't an INSERT OR REPLACE to a table which already contain data which are beeing replaced be considered an "update" of the table? CREATE table t1 ( v

Re: [sqlite] inserting record datinto mutliple tables with a composite primary key

2012-11-14 Thread Igor Tandetnik
LMHmedchem wrote: > As it happens, some of the text strings that will be added to the database > have single quotes, > > N,N'-dimethylethylenediamine > > do I need to do anything different for these Normally, your program shouldn't use string literals directly, but instead uses parameterized q

Re: [sqlite] added new db with other journal mode. Any issue?

2012-11-14 Thread Durga D
this the sequence of sqlite statements: -- sqlite3_open sqlite3_key sqlite3_prepare_v2 sqlite3_step sqlite3_finalize sqlite3_prepare_v2 --- //my application crashed here On Wed, Nov 14, 2012 at 5:14 PM, Durga D wrote: > sqlite_source_id():

Re: [sqlite] inserting record datinto mutliple tables with a composite primary key

2012-11-14 Thread Simon Slavin
On 13 Nov 2012, at 5:41pm, LMHmedchem wrote: > Thanks for the clarification. So my proper syntax for inserts with > AUTOINCREMENT is one of, > > INSERT INTO Structure > VALUES(null,'phosphoserine','phosphoserine.mol',185073,856147,73543,25338,'C3H8NO6P',185.073); > > or > > INSERT INTO Struct

Re: [sqlite] added new db with other journal mode. Any issue?

2012-11-14 Thread Durga D
sqlite_source_id(): 2012-03-20 11:35:50 00bb9c9ce4f465e6ac321ced2a9d0062dc364669 I will send the sequence of sql stmts. On Wed, Nov 14, 2012 at 4:51 PM, Richard Hipp wrote: > On Wed, Nov 14, 2012 at 3:41 AM, Durga D wrote: > > > I got the below error: > > --- > > The datab

Re: [sqlite] inserting record datinto mutliple tables with a composite primary key

2012-11-14 Thread LMHmedchem
Thanks for the clarification. So my proper syntax for inserts with AUTOINCREMENT is one of, INSERT INTO Structure VALUES(null,'phosphoserine','phosphoserine.mol',185073,856147,73543,25338,'C3H8NO6P',185.073); or INSERT INTO Structure(id, name, filePath, iH1, iH2, iH3, iH4, formula, fw) VALUES(nu

Re: [sqlite] added new db with other journal mode. Any issue?

2012-11-14 Thread Richard Hipp
On Wed, Nov 14, 2012 at 3:41 AM, Durga D wrote: > I got the below error: > --- > The database disk image is malformed. > Please send: (1) The version of SQLite you are running - the output of "SELECT sqlite_source_id();". (2) The exact sequence of SQL statements and API call

Re: [sqlite] Minor documentation error

2012-11-14 Thread Richard Hipp
On Wed, Nov 14, 2012 at 5:26 AM, Kevin Benson wrote: > On Oct 29, 2012; 9:09am Simon Slavin wrote: > > The page > > > > says "As long a connection is using a shared-memory wal-index" near the > bottom. I believe that this should be "As long as a connection is using

Re: [sqlite] added new db with other journal mode. Any issue?

2012-11-14 Thread Durga D
I got the below error: --- The database disk image is malformed. I am able to open. It's throwing above error when I try to set journal mode as truncate after db open before tables creation. How to solve this? On Wed, Nov 14, 2012 at 11:59 AM, Simon Slavin wrote: > > On 14

Re: [sqlite] added new db with other journal mode. Any issue?

2012-11-14 Thread Simon Slavin
On 14 Nov 2012, at 7:35am, Durga D wrote: > I have 8 sqlite databases with TRUNCATE journal mode. I have added new > database with WAL journal mode. Now, 9 databases in my application. Will it > give any database corruption? You can mix different modes for different databases without problems.