Re: [sqlite] Trouble with Journal_Mode Pragma
I think I found out why I'm getting a raised error and this will be something I'll have to remember later on dealing with PRAGMAs. There are two ways to get things done with this unit. There is GetTable which expects results back, and ExecSQL which expects exactly zero rows back. In the CLI and SQLite Expert, when I ran the exact same PRAGMA, I got a result back, but that just went over my head. I did think it odd that I'd get a result off a statement, but I didn't clue in, as I was concentrating on the raised error in my program, and not getting one in the CLI or a third party app. Then this morning, when tracing code to figure out a way to give you guys and gals more information to assist me with why this is happening, I traced through the code like 5 more times before it dawned on me about the expectations of ExecSQL. I was in the frame of mind yesterday that the results, assuming perfect syntax, of a PRAGMA would be the same as a DELETE. No results back. But the grey matter didn't equate that PRAGMA JOURNAL_MODE returned a result which in fact doesn't equal the results back of a DELETE. So a quick change to use GetTable instead of ExecSQL should get me the results I want. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Trouble with Journal_Mode Pragma
Kevin Benson wrote: > Maybe it should be: > > TempDB.ExecSQL('PRAGMA journal_mode = OFF;'); > > (Note the additional semicolon in the string literal) No, semicolons are needed only as delimiter between statements (and only if multiple statements are allowed at all). Regards, Clemens ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Trouble with Journal_Mode Pragma
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.Backup(TempDB); > > tempdb.free; > > end; > > > > It fails at the PRAGMA statement. > Maybe it should be: TempDB.ExecSQL('PRAGMA journal_mode = OFF;'); (Note the additional semicolon in the string literal) ...as in the sample code at http://www.itwriting.com/repos/sqlitewrapper/trunk/SQLiteTable3.pas -- -- -- --Ô¿Ô-- K e V i N ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Trouble with Journal_Mode Pragma
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; > > It fails at the PRAGMA statement. And the error message that you get is only "this fails"? Regards, Clemens ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users