[sqlite] Problem to switch between WAL and delete journal modes

2010-07-08 Thread Alexey Pechnikov
Some times database can return journal_mode=delete when exists WAL journal: $ ls|grep grow grow.db grow.db-shm grow.db-wal $ sqlite3 SQLite version 3.7.0 Enter .help for instructions Enter SQL statements terminated with a ; sqlite pragma journal_mode; delete sqlite .q $ ls|grep grow grow.db

[sqlite] Which SQLite API return SQLITE_BUSY?

2010-07-08 Thread Lloyd
Hi, Which are all the type of SQLite APIs can return SQLITE_BUSY? sqlite3_open_v2 sqlite3_prepare_v2 sqlite3_step sqlite3_finalize sqlite3_bind_blob sqlite3_column_int Thanks, Lloyd __ Scanned and protected by Email scanner

Re: [sqlite] How to determine when to VACUUM?

2010-07-08 Thread Max Vlasov
(I guess it well might not on an SSD disk, but on a conventional rotational disk, pager could read several pages ahead with one seek - but does it?) No, the pager does not. Among other things, my feeling is that the locality of pages is not very strong, unless the database was just

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
I see this too: $ sqlite3 grow.db 'pragma journal_mode' delete $ hexdump -s 17 -n 2 grow.db | head -n1 011 0200 $ sqlite3 grow.db 'pragma journal_mode=delete' delete $ hexdump -s 17 -n 2 grow.db | head -n1 011 0100 -- Best regards, Alexey Pechnikov. http://pechnikov.tel/

[sqlite] SQLite for .NET Framework 4.0

2010-07-08 Thread Daniel
Hi All, does anyone know if there is a support for SQLite in .NET Framework 4.0. best regards Daniel ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] How to determine when to VACUUM?

2010-07-08 Thread Simon Slavin
On 8 Jul 2010, at 9:30am, Max Vlasov wrote: Actually the SSD possibility makes it worse, not better. Simon, you gave an interesting explanation, but does this rule work in general? I mean there are many models, many sizes and so on. Don't know. You could test it. Write a program that

Re: [sqlite] SQLite for .NET Framework 4.0

2010-07-08 Thread Simon Slavin
On 8 Jul 2010, at 11:24am, Daniel wrote: does anyone know if there is a support for SQLite in .NET Framework 4.0. .NET is a set of library calls from a superset of C. SQLite is a set of library calls from C. The two are compatible: you can do both from the same piece of code. Simon.

Re: [sqlite] Problem to switch between WAL and delete journal modes

2010-07-08 Thread Simon Slavin
On 8 Jul 2010, at 7:46am, Alexey Pechnikov wrote: $ ls|grep grow grow.db grow.db-shm grow.db-wal $ sqlite3 SQLite version 3.7.0 Enter .help for instructions Enter SQL statements terminated with a ; sqlite pragma journal_mode; delete sqlite .q That 'sqlite3' command does not refer

Re: [sqlite] Problem to switch between WAL and delete journal modes

2010-07-08 Thread Simon Slavin
On 8 Jul 2010, at 11:50am, Simon Slavin wrote: That 'sqlite3' command does not refer to the grow.db database Whoops. Sorry, I should have read your post more carefully. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] EXTERNAL:Re: EXTERNAL: setup sqlite in vc++

2010-07-08 Thread Black, Michael (IS)
Try this project -- it should be completely self contained. Michael D. Black Senior Scientist Northrop Grumman Mission Systems From: sqlite-users-boun...@sqlite.org on behalf of smengl90 Sent: Wed 7/7/2010 1:06 PM To: sqlite-users@sqlite.org Subject: Re:

[sqlite] Temp views and sqlite_temp_master

2010-07-08 Thread Jon Polfer
I'm currently running SQLite 3.5.9. I've been experimenting around with temporary views, and discovered that: a) They don't appear in sqlite_master after you create them; they do however appear in a (I believe undocumented) table called sqlite_temp_master that I found by running an EXPLAIN on

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 12:45 AM, Max Vlasov max.vla...@gmail.com wrote: Alexey, I read this sentence, but it didn't help. So I suppose there's a bug in PRAGMA journal_mode logic Steps to reproduce. 1. Create an empty base with some table. Look at the 18,19 offsets, they both = 1, it's ok,

Re: [sqlite] Temp views and sqlite_temp_master

2010-07-08 Thread Simon Davies
On 8 July 2010 02:20, Jon Polfer jpol...@forceamerica.com wrote: I'm currently running SQLite 3.5.9. I've been experimenting around with temporary views, and discovered that: a)  They don't appear in sqlite_master after you create them; they do however appear in a (I believe undocumented)

Re: [sqlite] Problem to switch between WAL and delete journal modes

2010-07-08 Thread Igor Tandetnik
Alexey Pechnikov pechni...@mobigroup.ru wrote: Some times database can return journal_mode=delete when exists WAL journal: Why shouldn't it? journal_mode reports the kind of journal this connection is going to write for upcoming transactions - not the kind of journal that the previous crashed

Re: [sqlite] WAL questions

2010-07-08 Thread Max Vlasov
You want PRAGMA main.journal_mode A PRAGMA journal_mode; (without the main.) shows you the default journal mode used by newly created databases, which is always DELETE unless you have changed it with a prior PRAGMA journal_mode=MODE command. Though, I will admit, this is confusing, and I

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 7:51 AM, Max Vlasov max.vla...@gmail.com wrote: So all his current code base works once it started using this version of sqlite, but consequently small (or maybe large part) of his bases becomes WAL-enabled (number 2 in the file format). The latter may appear because of

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 7:10 AM, Richard Hipp d...@sqlite.org wrote: Though, I will admit, this is confusing, and I was thinking last night about ways we could possibly change it Current behavior: (1) PRAGMA name.journal_mode=MODE; -- set the mode to MODE for database name. (2) PRAGMA

[sqlite] sqlite_temp_master schema

2010-07-08 Thread Jon Polfer
I'm running SQLite 3.5.9. In the interactive client sqlite3, when I type: .schema sqlite_temp_master No schema description is returned, even when data exists in the table. Is this to be expected? -Jon __ Jon Polfer Project Engineer - High Level Software

Re: [sqlite] WAL questions

2010-07-08 Thread Max Vlasov
Second Proposed Change: Remove the WAL mode from PRAGMA journal_mode. The journal_mode pragma only specifies the various rollback journal modes. Enable the WAL using a separate pragma such as PRAGMA wal=ON; PRAGMA wal=OFF; Thoughts? Comments? Other suggestions? Maybe it's not the

Re: [sqlite] SQLite for .NET Framework 4.0

2010-07-08 Thread Michael Knigge
Daniel schrieb: does anyone know if there is a support for SQLite in .NET Framework 4.0. As always: http://sqlite.phxsoftware.com/ -- Yours sincerely Michael Knigge Development S.E.T. Software GmbH Lister Straße 15 30163 Hannover GERMANY Tel. +49 511/3 97 80-23 Fax +49 511/3 97 80-65

Re: [sqlite] Reg: In Memory Database Using SQLite

2010-07-08 Thread Eric Smith
Subhadeep Ghosh wrote: I finally managed to create a wrapper around the SQLite core to support the creation of in-memory databases. The wrapper comprises of three functions - one to serialize the database, one to de-serialize a database and the third one to do the cleanup job. The

Re: [sqlite] Reg: In Memory Database Using SQLite

2010-07-08 Thread Subhadeep Ghosh
Hello Eric, I am aware of the functionality which you mentioned. But the reason why I ended up coding the feature was because of a very specific requirement. My requirement was such that some of my client applications were running on disk-less systems where I was not using any kind of network

Re: [sqlite] SQLite for .NET Framework 4.0

2010-07-08 Thread Daniel
I forgot to say I have Visual Studio 2010 with .NET Framework 4.0 for programming in C#. In VS2008 it worked fine and after changing to Version 2010 it don't. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Getting declared datatype of a column in C

2010-07-08 Thread Andrew Wood
Just thought of something else. Even if I fix the way a blob is inserted so that it causes it to be correctly detected as a blob by sqlite3_column_type() theres still a problem - because if a field comes back as SQLITE_NULL my application still needs to know what type the field was supposed

Re: [sqlite] Books which cover C API

2010-07-08 Thread Andrew Wood
Id seen the book page but wasnt sure which one covered the C API the best. Ill try the APress one for now, thanks for the tip. On 07/07/10 19:55, Jay A. Kreibich wrote: On Wed, Jul 07, 2010 at 07:45:02PM +0100, Andrew Wood scratched on the wall: Which of the books on the market is the

Re: [sqlite] How to determine when to VACUUM?

2010-07-08 Thread Max Vlasov
Simon, you gave an interesting explanation, but does this rule work in general? I mean there are many models, many sizes and so on. Don't know. You could test it. Write a program that creates a file half the size of the drive, then writes to random parts of it timing each command.

Re: [sqlite] adb shell command gives very inconsistent results

2010-07-08 Thread ca44
My apology. It was late when I posted this and wasn't paying enough attention to where I was posting it to. -Chris - Original Message - From: Simon Slavin slav...@bigfraud.org To: General Discussion of SQLite Database sqlite-users@sqlite.org Sent: Wednesday, July 7, 2010

Re: [sqlite] SQLite for .NET Framework 4.0

2010-07-08 Thread Roosevelt Anderson
You should ask your question here http://sqlite.phxsoftware.com/forums/ On Thu, Jul 8, 2010 at 9:24 AM, Daniel dim...@web.de wrote: I forgot to say I have Visual Studio 2010 with .NET Framework 4.0 for programming in C#. In VS2008 it worked fine and after changing to Version 2010 it don't.

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
Remove the WAL mode from PRAGMA journal_mode. The journal_mode pragma only specifies the various rollback journal modes. Enable the WAL using a separate pragma such as PRAGMA wal=ON; PRAGMA wal=OFF; It's more clean I think. With wal=on and journal_mode=delete SQLite may delete WAL journal

[sqlite] docs bug: tclsqlite.html

2010-07-08 Thread Eric Smith
tclsqlite.html lists an unlock_notify method with no other documentation. Trying to use it gives me this: -bash-2.05b$ tcl % package require sqlite 3.6.23 % sqlite3 db /tmp/foo % db unlock_notify unlock_notify not available in this build % -- Eric A. Smith The concept is interesting and

[sqlite] work-arounds for (possibly buggy) nfs?

2010-07-08 Thread Eric Smith
I'm forced into a situation where I have to use an nfs server that I think is buggy. I can read/write files normally using fopen() on the exported filesystem, but can't do anything useful with sqlite 3.6.23.1: -bash-2.05b$ tclsh % package require sqlite 3.6.23 % sqlite3 db ./foo % db eval

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 10:15 AM, Alexey Pechnikov pechni...@mobigroup.ruwrote: Remove the WAL mode from PRAGMA journal_mode. The journal_mode pragma only specifies the various rollback journal modes. Enable the WAL using a separate pragma such as PRAGMA wal=ON; PRAGMA wal=OFF;

Re: [sqlite] work-arounds for (possibly buggy) nfs?

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 10:31 AM, Eric Smith eas@gmail.com wrote: I'm forced into a situation where I have to use an nfs server that I think is buggy. Try using: sqlite3 db ./foo -vfs unix-dotfile That uses an alternative VFS that uses dot-file locking instead of posix advisory

Re: [sqlite] docs bug: tclsqlite.html

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 10:19 AM, Eric Smith eas@gmail.com wrote: tclsqlite.html lists an unlock_notify method with no other documentation. Trying to use it gives me this: -bash-2.05b$ tcl % package require sqlite 3.6.23 % sqlite3 db /tmp/foo % db unlock_notify unlock_notify not

Re: [sqlite] work-arounds for (possibly buggy) nfs?

2010-07-08 Thread Eric Smith
Richard Hipp wrote: sqlite3 db ./foo -vfs unix-dotfile Works like a charm! That uses an alternative VFS that uses dot-file locking instead of posix advisory locks. The dot-file locks are someone slower and have less concurrency, so the use of PRAGMA locking_mode=EXCLUSIVE might also be

Re: [sqlite] sqlite_temp_master schema

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 8:49 AM, Jon Polfer jpol...@forceamerica.com wrote: I'm running SQLite 3.5.9. In the interactive client sqlite3, when I type: .schema sqlite_temp_master No schema description is returned, even when data exists in the table. Is this to be expected? Cannot

Re: [sqlite] Reg: In Memory Database Using SQLite

2010-07-08 Thread Eric Smith
Subhadeep Ghosh wrote: I am aware of the functionality which you mentioned. But the reason why I ended up coding the feature was because of a very specific requirement. My requirement was such that some of my client applications were running on disk-less systems where I was not using

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
2010/7/8 Richard Hipp d...@sqlite.org In the current implementation, if you call PRAGMA wal_checkpoint just prior to closing the database, the WAL file will be deleted automatically. But it keeps the database in WAL mode, so the WAL is recreated the next time you open and write to the

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 10:50 AM, Alexey Pechnikov pechni...@mobigroup.ruwrote: 2010/7/8 Richard Hipp d...@sqlite.org In the current implementation, if you call PRAGMA wal_checkpoint just prior to closing the database, the WAL file will be deleted automatically. But it keeps the database

Re: [sqlite] Which SQLite API return SQLITE_BUSY?

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 12:42:36PM +0530, Lloyd scratched on the wall: Hi, Which are all the type of SQLite APIs can return SQLITE_BUSY? sqlite3_open_v2 sqlite3_prepare_v2 All styles of these calls, not just the _v2 versions. sqlite3_step That's the big one. sqlite3_finalize

Re: [sqlite] Getting declared datatype of a column in C

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 02:27:02PM +0100, Andrew Wood scratched on the wall: Even if I fix the way a blob is inserted so that it causes it to be correctly detected as a blob by sqlite3_column_type() theres still a problem - because if a field comes back as SQLITE_NULL my application

Re: [sqlite] sqlite_temp_master schema

2010-07-08 Thread Jon Polfer
My apologies - I took a closer look and realized that I was actually putting a semicolon on the end of the statement: .schema sqlite_temp_master; -- doesn't work. -Jon __ Jon Polfer Project Engineer - High Level Software Engineering Office Phone:

Re: [sqlite] work-arounds for (possibly buggy) nfs?

2010-07-08 Thread Eric Smith
Richard Hipp wrote: sqlite3 db ./foo -vfs unix-dotfile That uses an alternative VFS that uses dot-file locking instead of posix advisory locks. The dot-file locks are someone slower and have less concurrency, so the use of PRAGMA locking_mode=EXCLUSIVE might also be a good idea in

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 06:50:52PM +0400, Alexey Pechnikov scratched on the wall: 2010/7/8 Richard Hipp d...@sqlite.org In the current implementation, if you call PRAGMA wal_checkpoint just prior to closing the database, the WAL file will be deleted automatically. But it keeps the

Re: [sqlite] Temp views and sqlite_temp_master

2010-07-08 Thread Jay A. Kreibich
On Wed, Jul 07, 2010 at 08:20:13PM -0500, Jon Polfer scratched on the wall: I'm currently running SQLite 3.5.9. I've been experimenting around with temporary views, and discovered that: a) They don't appear in sqlite_master after you create them; they do however appear in a (I believe

Re: [sqlite] sqlite_temp_master schema

2010-07-08 Thread Simon Slavin
On 8 Jul 2010, at 4:09pm, Jon Polfer wrote: My apologies - I took a closer look and realized that I was actually putting a semicolon on the end of the statement: .schema sqlite_temp_master; -- doesn't work. Which is correct. Semicolons are for SQL commands. '.schema' is not a SQL

[sqlite] LIKE with BLOB

2010-07-08 Thread Matthew Jones
From a web search (and abbreviated): I have BLOBs in my schema and the data will often start with bytes of 0 value. I'm having a tough time coming up with the proper SQL syntax to select all the columns that start with 2 0's (or any zeros). SELECT * FROM mytable WHERE myblob LIKE

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
2010/7/8 Jay A. Kreibich j...@kreibi.ch It's not helpful for backward compability. How about version downgrade of the Android or some other mobile OS and as result impossibility to open any SQLite database?.. That's not backwards compatibility (newer versions working with items from

Re: [sqlite] LIKE with BLOB

2010-07-08 Thread Pavel Ivanov
If it is possible, how would I define a prepared statement so that I can just bind the (10 byte) value into it? Is it possible to pre-process your 10 bytes and insert e.g. symbol '\' before any '\', '_' and '%' symbol? After that you can query SELECT * FROM mytable WHERE myblob LIKE ? ESCAPE

Re: [sqlite] LIKE with BLOB

2010-07-08 Thread Igor Tandetnik
Matthew Jones matthew.jo...@hp.com wrote: From a web search (and abbreviated): I have BLOBs in my schema and the data will often start with bytes of 0 value. I'm having a tough time coming up with the proper SQL syntax to select all the columns that start with 2 0's (or any zeros).

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 08:23:55AM -0400, Richard Hipp scratched on the wall: On Thu, Jul 8, 2010 at 7:10 AM, Richard Hipp d...@sqlite.org wrote: Though, I will admit, this is confusing, and I was thinking last night about ways we could possibly change it Current behavior: (1)

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 08:06:23PM +0400, Alexey Pechnikov scratched on the wall: 2010/7/8 Jay A. Kreibich j...@kreibi.ch It's not helpful for backward compability. How about version downgrade of the Android or some other mobile OS and as result impossibility to open any SQLite

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 12:23 PM, Jay A. Kreibich j...@kreibi.ch wrote: First Proposed Change: (1) and (2) are the same. (3) PRAGMA journal_mode=MODE; -- set the mode to MODE for all attached databases. Databases created by subsequent ATTACH use MODE. Existing databases added by

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 12:45 PM, Richard Hipp d...@sqlite.org wrote: PRAGMA name.journal_mode=MODE; -- set the mode of database name to MODE. PRAGMA name.journal_mode; -- report the mode of database name. PRAGMA journal_mode; -- an alias for PRAGMA main.journal_mode PRAGMA

[sqlite] importing data from file with 3 colums to table with 4 columns

2010-07-08 Thread ca44
Hello, I have a db tbl with the following schema: _ID integer primary key autoincrement name varchar(40) category varchar(40) recommendation varchar(40) I have a data file I want to import which contains 3 columns worth of data. It looks like this: Barracuda|seafood|No

Re: [sqlite] importing data from file with 3 colums to table with 4 columns

2010-07-08 Thread Simon Davies
On 9 July 2010 00:07, c...@comcast.net wrote: Hello, I have a db tbl with the following schema: _ID integer primary key autoincrement name varchar(40) category varchar(40) recommendation varchar(40) I have a data file I want to import which contains 3 columns worth of data.

Re: [sqlite] importing data from file with 3 colums to table with 4 columns

2010-07-08 Thread ca44
Thank you very much Simon. That worked very slick. Say, is there a way to put all of the SQLite3 commands  I used into a script and have SQLite3 execute them in the script sequentially? -Chris - Original Message - From: Simon Davies simon.james.dav...@googlemail.com To: