[sqlite] Problems with pragma journal_mode

2015-04-17 Thread Dominique Devienne
On Fri, Apr 17, 2015 at 12:59 PM, Janke, Julian 
wrote:

> Unfortunately, I can't run the shell tool on the es and try the same
> sequence of commands.
>

Why? Don't you have some kind of shell on that embedded system that can run
executables?

According to https://www.sqlite.org/howtocompile.html, the amalgamation
also comes with shell.c, the source code for the SQLite shell, and you can
compile it into an exe with your VFS, and then easily test everything at
the command line of the board/embedded OS. --DD


[sqlite] Problems with pragma journal_mode

2015-04-17 Thread Janke, Julian
Unfortunately not.
There are no shell on the system to which I have access as an application 
developer,
so I don't can run executables.

The only thing I can do is to download c-code applications on a given interface 
to the board.


-Original Message-
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Dominique 
Devienne
Sent: Freitag, 17. April 2015 13:50
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Problems with pragma journal_mode

On Fri, Apr 17, 2015 at 12:59 PM, Janke, Julian 
wrote:

> Unfortunately, I can't run the shell tool on the es and try the same
> sequence of commands.
>

Why? Don't you have some kind of shell on that embedded system that can run 
executables?

According to https://www.sqlite.org/howtocompile.html, the amalgamation also 
comes with shell.c, the source code for the SQLite shell, and you can compile 
it into an exe with your VFS, and then easily test everything at the command 
line of the board/embedded OS. --DD 
___
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] Problems with pragma journal_mode

2015-04-17 Thread Simon Slavin

On 17 Apr 2015, at 11:59am, Janke, Julian  wrote:

> I've changed the stmt to "SELECT 'Hello World !!';"
> In this case,
> 
> sqlite3_step() returns SQLITE_ROW
> sqlite3_column_text() returns 'Hello World !!'
> 
> That, looks right.

I agree.  And it shows that your C code is working perfectly.  For comparison I 
will show you what the shell tool does with the PRAGMA command:

dyn-171-167:~ simon$ sqlite3 ~/Desktop/test.sqlite
SQLite version 3.8.5 2014-08-15 22:37:57
Enter ".help" for usage hints.
sqlite> CREATE TABLE myTable (myColumn TEXT);
sqlite> INSERT INTO myTable VALUES ('first line');
sqlite> INSERT INTO myTable VALUES ('second line');
sqlite> SELECT * FROM myTable;
first line
second line
sqlite> PRAGMA journal_mode=WAL;
wal
sqlite> PRAGMA journal_mode=WAL;
wal
sqlite> .quit

As you can see, the PRAGMA command returns a response of 'wal' even if the mode 
is already WAL.  My understanding of your previous answers is that the command 
returns SQLITE_OK, but no lines of data.  That does seem wrong to me.

I suspect that you are coming up with some aspect of writing your own VFS.  I'm 
sorry but I do not know enough about writing your own VFS to understand what to 
do next.  I hope somebody else reading this can help you further.

Simon.


[sqlite] Problems with pragma journal_mode

2015-04-17 Thread Simon Slavin

On 17 Apr 2015, at 11:12am, Janke, Julian  wrote:

> I changed my code again:

Move the DROP TABLE command on line 5 to after the _finalize() call.  But I 
don't think it'll make any difference.

You should not be getting SQLITE_DONE back from your call to _step().  The 
documentation says that that PRAGMA command should return a row of data.  
Please try changing the PRAMGA command to

sqlite3_prepare_v2(db, "SELECT 'Hello World !!';", 24, , NULL);

and see what you get back from it.

> 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?

No.  I'm coming to the conclusion that there's something wrong with your 
compilation process.

How are you getting your sqlite3 library ?  Have you downloaded the 
amalgamation source code and included it in your project ?  If not, please try 
doing this.

Can you download the sqlite3 shell tool and try the same sequence of commands ? 
 You can find it here:



Simon.


[sqlite] Problems with pragma journal_mode

2015-04-17 Thread Janke, Julian
Yes, I downloaded the amalgamation and included it into my project. Since it is 
an embedded system with a not out of the box supported operating system, I 
wrote my own vfs. Insert, select, delete operations properly work on a database 
and as desired.

I've changed the stmt to "SELECT 'Hello World !!';"
In this case,

sqlite3_step() returns SQLITE_ROW
sqlite3_column_text() returns 'Hello World !!'

That, looks right.

Unfortunately, I can't run the shell tool on the es and try the same sequence 
of cammands.


If you think that there's something wrong with the compilation process,
should then also standard SQL instructions do not work?



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


On 17 Apr 2015, at 11:12am, Janke, Julian  wrote:

> I changed my code again:

Move the DROP TABLE command on line 5 to after the _finalize() call.  But I 
don't think it'll make any difference.

You should not be getting SQLITE_DONE back from your call to _step().  The 
documentation says that that PRAGMA command should return a row of data.  
Please try changing the PRAMGA command to

sqlite3_prepare_v2(db, "SELECT 'Hello World !!';", 24, , NULL);

and see what you get back from it.

> 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?

No.  I'm coming to the conclusion that there's something wrong with your 
compilation process.

How are you getting your sqlite3 library ?  Have you downloaded the 
amalgamation source code and included it in your project ?  If not, please try 
doing this.

Can you download the sqlite3 shell tool and try the same sequence of commands ? 
 You can find it here:



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] Problems with pragma journal_mode

2015-04-17 Thread Richard Hipp
On 4/17/15, Janke, Julian  wrote:
> Hello,
> Thanks for your reply.
>
> I changed my code again:
>
> 1) rc = sqlite3_open(dbPath, ); --> SQLITE_OK
> 2) rc = sqlite3_exec(db, "DROP TABLE IF EXISTS nosuchtable;",
> testCallbackPrint, 0, );
> 3) rc = sqlite3_prepare_v2(db, "PRAGMA journal_mode=WAL;", 24, , 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, );
> 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, , 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 
> 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, , 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] Problems with pragma journal_mode

2015-04-17 Thread Janke, Julian
Hello,
Thanks for your reply.

I changed my code again:

1) rc = sqlite3_open(dbPath, ); --> SQLITE_OK
2) rc = sqlite3_exec(db, "DROP TABLE IF EXISTS nosuchtable;", 
testCallbackPrint, 0, );
3) rc = sqlite3_prepare_v2(db, "PRAGMA journal_mode=WAL;", 24, , NULL); 
--> SQLITE_OK
4) rc = sqlite3_step(stmt); --> SQLITE_DONE
5) rc = sqlite3_exec(db, "DROP TABLE IF EXISTS nosuchtable;", 
testCallbackPrint, 0, );
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, , 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-boun...@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  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, , 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] Best way to temporarily store data before processing

2015-04-17 Thread Jonathan Moules
Thanks for all the responses. In the end I went with the CREATE TEMP TABLE ... 
option which has worked very well and seems to have negligible overhead (on the 
order of 0.006s to create ~40 temporary tables and similarly quick to drop 
them).


-Original Message-
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Petite 
Abeille
Sent: Wednesday, April 15, 2015 6:24 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Best way to temporarily store data before processing


> On Apr 14, 2015, at 11:40 AM, Jonathan Moules  
> wrote:
>
> Options that have come to mind (probably missed a lot):

I personally use temp tables, e.g. 'create temporary table if not exists foo?, 
coupled with 'pragma temp_store = memory?, and drop/create them as necessary, 
e.g. 'drop table if exists?. There is a set of ETL (Extract, Transform and 
Load) operations to massage the data just so to their final resting place.

Will not qualify this as ?best?, but it?s very workable and without much of a 
headache. As always, your milage may vary.

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


This message has been scanned for viruses by MailControl - www.mailcontrol.com



Click 
https://www.mailcontrol.com/sr/qYyWV6h9JtHGX2PQPOmvUj!GOBh06pKK75cHS8CBt56rbyGA4ThgbelonLeAq9lKW2cQtZ6+iOpzr!jqbv!p6A==
 to report this email as spam.



HR Wallingford and its subsidiaries uses faxes and emails for confidential and 
legally privileged business communications. They do not of themselves create 
legal commitments. Disclosure to parties other than addressees requires our 
specific consent. We are not liable for unauthorised disclosures nor reliance 
upon them.
If you have received this message in error please advise us immediately and 
destroy all copies of it.

HR Wallingford Limited
Howbery Park, Wallingford, Oxfordshire, OX10 8BA, United Kingdom
Registered in England No. 02562099