On 4/20/15, Janke, Julian <julian.janke at capgemini.com> wrote:
> 'EXPLAIN PRAGMA journal_mode=WAL' returns 2 rows
>
> 0: 0 Init 0 0 0
> 1: 1 Halt 0 0 0
>

You should get this:

addr  opcode         p1    p2    p3    p4             p5  comment
----  -------------  ----  ----  ----  -------------  --  -------------
0     Init           0     0     0                    00
1     JournalMode    0     1     5                    00
2     ResultRow      1     1     0                    00
3     Halt           0     0     0                    00

What does: "PRAGMA compile_options;" and "SELECT sqlite_source_id();" show?



> Is it the result of what you expected?
>
> -----Original Message-----
> From: sqlite-users-bounces at mailinglists.sqlite.org
> [mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Richard
> Hipp
> Sent: Freitag, 17. April 2015 16:59
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Problems with pragma journal_mode
>
> On 4/17/15, Janke, Julian <julian.janke at capgemini.com> wrote:
>> Hello,
>> Thanks for your reply.
>>
>> I changed my code again:
>>
>> 1) rc = sqlite3_open(dbPath, &db); --> SQLITE_OK
>> 2) rc = sqlite3_exec(db, "DROP TABLE IF EXISTS nosuchtable;",
>> testCallbackPrint, 0, &zErrMsg);
>> 3) rc = sqlite3_prepare_v2(db, "PRAGMA journal_mode=WAL;", 24, &stmt,
>> NULL);
>> --> SQLITE_OK
>> 4) rc = sqlite3_step(stmt); --> SQLITE_DONE
>
> I do not understand this.  "PRAGMA journal_mode" should always give a return
> value, even when it fails.  sqlite3_step() should have returned SQLITE_ROW.
>
> Please try instead, "EXPLAIN PRAGMA journal_mode=WAL".  Verify that you get
> multiple rows of output in that case.
>
>
>> 5) rc = sqlite3_exec(db, "DROP TABLE IF EXISTS nosuchtable;",
>> testCallbackPrint, 0, &zErrMsg);
>> 6) txt  = sqlite3_column_text (stmt, 0); --> returns an empty string
>> 7) rc = sqlite3_finalize(stmt); --> SQLITE_OK
>> 8) rc = sqlite3_close(db); --> SQLITE_OK
>>
>> Repeated the same steps with
>>
>> 3) rc = sqlite3_prepare_v2(db, "PRAGMA journal_mode;", 24, &stmt,
>> NULL); --> SQLITE_OK
>>
>> To my knowledge, at line 4 SQLITE_ROW instead of SQLITE_DONE should be
>> returned.
>>
>> "These routines may only be called when the most recent call to
>> sqlite3_step() has returned SQLITE_ROW and neither sqlite3_reset() nor
>> sqlite3_finalize() have been called subsequently."
>>
>> It looks as if all PRAGMA instructions are completely ignored, since
>> the query for the status of the JOURNAL_MODE returns no result.
>>
>> Is it possible that I have turned off PRAMAs by anything or something
>> is missing, so PRAMAs can run?
>>
>> Thanks for your help
>>
>>
>> -----Original Message-----
>> From: sqlite-users-bounces at mailinglists.sqlite.org
>> [mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of
>> Simon Slavin
>> Sent: Donnerstag, 16. April 2015 17:56
>> To: General Discussion of SQLite Database
>> Subject: Re: [sqlite] Problems with pragma journal_mode
>>
>>
>> On 16 Apr 2015, at 2:33pm, Janke, Julian <julian.janke at capgemini.com>
>> wrote:
>>
>>> rc = sqlite3_step(stmt);
>>> --> returns SQLITE_DONE
>>
>> After the above two lines, print the value returned by
>>
>> sqlite3_column_text(stmt, 0)
>>
>> I'm not good at C off the top of my head but I think it's something
>> like
>>
>> -----------------
>>
>> const unsigned char * theText;
>>
>> [...]
>>
>> rc = sqlite3_prepare_v2(db, "PRAGMA journal_mode=WAL;", 24, &stmt,
>> NULL);
>>
>> rc = sqlite3_step(stmt);
>> theText  = sqlite3_column_text (stmt, 0); printf ("text returned: %s",
>> theText);
>>
>> rc = sqlite3_finalize(stmt);
>>
>> -----------------
>>
>> Hope if I got it wrong someone else will tell you.  By the way, you
>> can also check the values returned from sqlite3_finalize() and
>> sqlite3_close() since they can tell you useful things if something went
>> wrong.
>>
>> 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.
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
> --
> D. Richard Hipp
> drh at sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 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.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to