Ok, actually I'm a little bit confused, never used prepare(), step() and 
finalize() manually before.
Maybe it's his absolute basics are missing me here, but maybe someone can still 
help me
On which point I should get "wal" back?

I changed my code to the following:

rc = sqlite3_open(dbPath, &db);
sqlite3_exec(db, "DROP TABLE IF EXISTS nosuchtable;", testCallbackPrint, 0, 
&zErrMsg);
rc = sqlite3_prepare_v2(db, "PRAGMA journal_mode=WAL;", 24, &stmt, NULL);
--> returns SQLITE_OK

rc = sqlite3_step(stmt);
--> returns SQLITE_DONE

sqlite3_finalize(stmt);
sqlite3_exec(db, "DROP TABLE IF EXISTS nosuchtable;", testCallbackPrint, 0, 
&zErrMsg);
[...]
sqlite3_close(db);


Thanks.

-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin
Sent: Donnerstag, 16. April 2015 14:15
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Problems with pragma journal_mode


On 16 Apr 2015, at 10:10am, Janke, Julian <julian.janke at capgemini.com> wrote:

> rc = sqlite3_open(dbPath, &db);
> rc = sqlite3_exec(db, "PRAGMA journal_mode=WAL;", testCallbackPrint,
> 0, &zErrMsg); [?] sqlite3_close(db);

Execute your PRAGMA as if it's a SELECT call (i.e. use sqlite3_prepare_v2(), 
sqlite3_step(), and sqlite3_finalize()) and check the value returned by 
_step().  If the command worked you should get "wal" back.

Before and after your existing PRAGMA, submit any SQL command that needs 
database access.  For example

DROP TABLE IF EXISTS nosuchtable;
PRAGMA journal_mode=WAL;
DROP TABLE IF EXISTS nosuchtable;

You can use _exec() for these other commands.  I do not know that this is 
definitely your problem, but I seem to remember that there has to be some kind 
of file access for a journal mode change to take effect.

In connection with another post to this thread, you should be able to change 
the journal mode at any time you have the only connection to the database.  
This includes changing between traditional journal modes and WAL mode.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

________________________________

Firma: Capgemini Deutschland GmbH
Aufsichtsratsvorsitzender: Antonio Schnieder ? Gesch?ftsf?hrer: Dr. Michael 
Schulte (Sprecher) ? Jost F?rster ? Dr. Peter Lempp ? Dr. Volkmar Varnhagen

Amtsgericht Berlin-Charlottenburg, HRB 98814
This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.

Reply via email to