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

2010-07-07 Thread Simon Slavin

On 8 Jul 2010, at 6:18am, c...@comcast.net wrote:

>  I do not own an Android phone and am working exclusively in the 
> Eclipse/emulator environment on my laptop. 

You're posting to the sqlite discussion list.  You need to ask about this on a 
list about Eclipse or something.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how can i unsubscribe from this forum?

2010-07-07 Thread John Drescher
Follow the link at the bottom of  each message.

On Thu, Jul 8, 2010 at 12:54 AM, Ravi Kiran  wrote:
> --
> Best Regards,
> Ravi
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
John M. Drescher
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] "adb shell" command gives very inconsistent results

2010-07-07 Thread ca44


 I do not own an Android phone and am working exclusively in the 
Eclipse/emulator environment on my laptop. 

When I type in the "adb shell" cmd from the tools directory I get very 
inconsistent results. 
Sometimes it says "error: device not found". 
Sometimes it says "error: device offline". 
If I start a small application and continue to type in the "adb shell" command 
until the emulator starts I get the 2 errors I just mentioned in that order and 
then the "adb shell" command actually works and I can see the "#" prompt, and 
type in commands such as "ls -l" and see the results. 
Then as I'm working in the shell it suddenly ends and I'm back at the Windows 
prompt. 
I am running on Windows XP Pro Version 2002 Service Pack 3. 

I would very much appreciate some help with this situation. 

Thank You 
-Chris 


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] how can i unsubscribe from this forum?

2010-07-07 Thread Ravi Kiran
-- 
Best Regards,
Ravi
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL questions

2010-07-07 Thread Max Vlasov
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, the base is compatible
with full range of sqlite3 versions.

2. Do PRAGMA journal_mode=WAL; , it returns wal, so WAL is set.
Look at the 18,19 offsets, they both = 2, the base no longer compatible with
older versions, checking... yes, they say "encrypted" or something.
Query PRAGMA journal_mode; alone (just to check not set) , it still says
"wal", ok

3. Close the database. offsets 18,19 still = 2, so the WAL setting are kept
between sessions.

4. Open the db again, offsets 18,19 still = 2,
query PRAGMA journal_mode; it says  "delete", but definetely should return
"wal".

Max


On Thu, Jul 8, 2010 at 12:09 AM, Alexey Pechnikov wrote:

> See http://sqlite.org/draft/wal.html :
>
> "An SQLite database _connection_
> defaults
> to journal_mode=DELETE. To convert to WAL mode, use the following
> pragma: PRAGMA journal_mode=WAL;"
>
> --
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Subhadeep Ghosh
Hello Seak,

Try doing the following,

1. In your project select and right click on the sqlite3.c file.
2. Then click on the 'Properties' on the drop down menu.
3. When the 'sqlite3.c Property Pages' dialog opens up, click on the 'C/C++'
tree node.
4. Next click on the 'Advanced' item in the 'C/C++' tree node.
5. In the right pane of the dialog locate the 'Compile As' item. I suspect
that it is set to 'Compile as C++ code (/TP)'. If that is the case then you
could click on it and another drop down should appear from which you should
select the 'Compile as C Code (/TC)' option.

That should take care of your compiler errors.

Thank you and regards,
Subhadeep Ghosh.

On Thu, Jul 8, 2010 at 4:24 AM, smengl90 <
fixed-term.seak.meng...@us.bosch.com> wrote:

>
> Still doesn't work. Do I need the precompiled binaries at all? or including
> sqlite3.c and sqlite3.h found in the amalgamation is enough?
>
>
>
> SimonDavies wrote:
> >
> > On 7 July 2010 18:19, smengl90 
> > wrote:
> >>
> >> Ok, I did just that, but now I get errors when compiling, all related to
> >> the
> >> malloc operations.
> >>
> >> 1>Compiling...
> >> 1>TestSqlite.cpp
> >> 1>c:\documents and settings\las1pal\my documents\visual studio
> >> 2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot
> >> convert
> >> from 'void *' to 'char *'
> > .
> > .
> > .
> > .
> >> ...
> >>
> >> Is it because I include a .c source file in a c++ project?
> >
> > Maybe - have you marked that 1 file as 'compile as c code'?
> >
> > (Properties -> C/C++ -> Advanced tab)
> >
> >>
> >> Thanks
> >>
> >
> > Regards,
> > Simon
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p2909.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Books which cover C API

2010-07-07 Thread Mohit Sindhwani
On 8/7/2010 8:17 AM, Tito Ciuro wrote:
> Yes. The book is quite good, I admit, but if you need to find specific 
> things... the answer might not be referenced where you think it'd be. Or not 
> mentioned at all. Is it really *that* difficult? I truly hope they pay 
> attention to this whenever in future releases.
>

To be fair, I read the book cover to cover when I started out on 
SQLite... so, I'm probably more familiar with where the content that I 
need is.

Best Regards,
Mohit.
8/7/2010 | 8:21 AM.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Books which cover C API

2010-07-07 Thread Tito Ciuro

On 08/07/2010, at 02:11, Mohit Sindhwani wrote:

> On 8/7/2010 8:06 AM, Tito Ciuro wrote:
>> On 8 Jul 2010, at 01:58, Mohit Sindhwani  wrote:
>> 
>> 
>>> On 8/7/2010 2:55 AM, 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 best for covering the C API?
> 
> 
   http://sqlite.org/books.html
 
 
 
 
   If you want to go out and buy something today, the most popular book
   is "The Definitive Guide to SQLite" by Mike Owens.  It is a bit
   older, but the core APIs haven't really changed:
 
 http://www.amazon.com/Definitive-Guide-SQLite-Mike-Owens/dp/1590596730/
 
 
>>> +1 for the definitive guide - it is very good!
>>> 
>>> Best Regards,
>>> Mohit.
>>> 8/7/2010 | 7:58
>>> 
>> ... except for the index. It's useless.
>> 
> 
> which is ironic for a book about databases :D
> 
> Cheers,
> Mohit.
> 8/7/2010 | 8:11 AM.

Yes. The book is quite good, I admit, but if you need to find specific 
things... the answer might not be referenced where you think it'd be. Or not 
mentioned at all. Is it really *that* difficult? I truly hope they pay 
attention to this whenever in future releases.

-- Tito
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Books which cover C API

2010-07-07 Thread Mohit Sindhwani
On 8/7/2010 8:06 AM, Tito Ciuro wrote:
> On 8 Jul 2010, at 01:58, Mohit Sindhwani  wrote:
>
>
>> On 8/7/2010 2:55 AM, 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 best for covering the C API?

  
>>>http://sqlite.org/books.html
>>>
>>>
>>>
>>>
>>>If you want to go out and buy something today, the most popular book
>>>is "The Definitive Guide to SQLite" by Mike Owens.  It is a bit
>>>older, but the core APIs haven't really changed:
>>>
>>> http://www.amazon.com/Definitive-Guide-SQLite-Mike-Owens/dp/1590596730/
>>>
>>>
>> +1 for the definitive guide - it is very good!
>>
>> Best Regards,
>> Mohit.
>> 8/7/2010 | 7:58
>>  
> ... except for the index. It's useless.
>

which is ironic for a book about databases :D

Cheers,
Mohit.
8/7/2010 | 8:11 AM.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Books which cover C API

2010-07-07 Thread Tito Ciuro
On 8 Jul 2010, at 01:58, Mohit Sindhwani  wrote:

> On 8/7/2010 2:55 AM, 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 best for covering the C API?
>>> 
>>   http://sqlite.org/books.html
>> 
>> 
>> 
>> 
>>   If you want to go out and buy something today, the most popular book
>>   is "The Definitive Guide to SQLite" by Mike Owens.  It is a bit
>>   older, but the core APIs haven't really changed:
>> 
>> http://www.amazon.com/Definitive-Guide-SQLite-Mike-Owens/dp/1590596730/
>> 
> 
> +1 for the definitive guide - it is very good!
> 
> Best Regards,
> Mohit.
> 8/7/2010 | 7:58

... except for the index. It's useless.

-- Tito
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] setup sqlite in vc++

2010-07-07 Thread Sam Carleton
On Wed, Jul 7, 2010 at 7:12 PM, Simon Slavin  wrote:

>
> The precompiled binaries are for those who see SQLite as some sort of
> external library and don't want to include it in their own application.
>  It's a useful alternative for those who want to keep their own app as slim
> as possible.
>

Or, in my case, have multiple programs/processes that will be accessing the
same DB and the desire is to have them all to use the exact same DLL.

Sam
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Books which cover C API

2010-07-07 Thread Mohit Sindhwani
On 8/7/2010 2:55 AM, 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 best for covering the C API?
>>  
>http://sqlite.org/books.html
>
>
>
>
>If you want to go out and buy something today, the most popular book
>is "The Definitive Guide to SQLite" by Mike Owens.  It is a bit
>older, but the core APIs haven't really changed:
>
> http://www.amazon.com/Definitive-Guide-SQLite-Mike-Owens/dp/1590596730/
>

+1 for the definitive guide - it is very good!

Best Regards,
Mohit.
8/7/2010 | 7:58 AM.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to access and open an existing SQLite database (in Eclipse/Emulator)

2010-07-07 Thread Simon Slavin

On 7 Jul 2010, at 11:12pm, Chris wrote:

> I would like to know what the accepted practice is for where to put
> the database in my Eclipse Android project folder structure, and how
> to access it in my java code.
> 
> Is it possible to do this or do I have to open the db file as a
> regular file and copy it to a new file I create via my code and then
> open that new file as a SQLite db?

A SQLite database is just a file: the SQLite library doesn't demand it's stored 
in a certain way or tagged with some special tag.  The file format on all 
platforms is identical.  You can make the file on your desktop computer, put 
whatever data into it you like (using SQLite functions), copy it to your phone, 
and use the application on your phone to open it and read the data (using 
SQLite functions).

You can also go the other way: use SQLite function calls to make a database on 
your phone, copy the file to your computer, and read the data out using an 
application on your computer.

> I am very unclear about this as I am beginning to understand that the
> db becomes part of the application itself and I have never worked in a
> model like that.

Your phrase "the db becomes part of the application" is not part of the sqlite 
approach -- sqlite will handle the file wherever it is.  It may be part of the 
Android way of doing things (just like it is part of the iPhone way of doing 
things).  Since it's Android which is telling you to do things that way, you'll 
find an explanation of it in the documentation for Android, not in the 
documentation for sqlite.

> It would also be good to know how to test for the existence of the
> database file before trying to open it as it is my understanding that
> a new db will be created if the open method does not find an existing
> one.

First, it will be a file, so you can use normal file-handling routines to see 
whether a file with that name exists in that folder.  You may find that 
sufficient, but if you want to check to see whether this is just a file full of 
gibberish or a proper sqlite database, you can open the file as text and read 
the beginning.  It should begin with text

SQLite format 3

If the first 15 bytes are anything else, it's not really a SQLite database.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] setup sqlite in vc++

2010-07-07 Thread Simon Slavin

On 7 Jul 2010, at 11:54pm, smengl90 wrote:

> Still doesn't work. Do I need the precompiled binaries at all? or including
> sqlite3.c and sqlite3.h found in the amalgamation is enough?

SQLite is distributed as source code.  The two files sqlite3.c and sqlite3.h 
are everything you need to use SQLite: compile them into your application and 
you have full SQLite support: just call the functions listed sqlite3.h in your 
own code.

The precompiled binaries are for those who see SQLite as some sort of external 
library and don't want to include it in their own application.  It's a useful 
alternative for those who want to keep their own app as slim as possible.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread smengl90

Still doesn't work. Do I need the precompiled binaries at all? or including
sqlite3.c and sqlite3.h found in the amalgamation is enough?



SimonDavies wrote:
> 
> On 7 July 2010 18:19, smengl90 
> wrote:
>>
>> Ok, I did just that, but now I get errors when compiling, all related to
>> the
>> malloc operations.
>>
>> 1>Compiling...
>> 1>TestSqlite.cpp
>> 1>c:\documents and settings\las1pal\my documents\visual studio
>> 2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot
>> convert
>> from 'void *' to 'char *'
> .
> .
> .
> .
>> ...
>>
>> Is it because I include a .c source file in a c++ project?
> 
> Maybe - have you marked that 1 file as 'compile as c code'?
> 
> (Properties -> C/C++ -> Advanced tab)
> 
>>
>> Thanks
>>
> 
> Regards,
> Simon
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p2909.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread smengl90

still doesn't work. Do I need to download the precompiled binaries at all? or
including the sqlite3.c and sqite3.h found in the amalgamation is enough?



smengl90 wrote:
> 
> Here is my email address fixed-term.seak.meng...@us.bosch.com
> 
> Thanks
> 
> 
> Black, Michael (IS) wrote:
>> 
>> I've got Visual Express 2008 C++ -- I made a Win32 console application
>> and compiled this just fine.
>>  
>> If you want to send your email address I'll email you the project and you
>> can try it on the non-Express version.
>>  
>>  
>> Michael D. Black
>> Senior Scientist
>> Northrop Grumman Mission Systems
>>  
>> 
>> 
>> 
>> From: sqlite-users-boun...@sqlite.org on behalf of smengl90
>> Sent: Wed 7/7/2010 12:19 PM
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] EXTERNAL:Re: EXTERNAL: setup sqlite in vc++
>> 
>> 
>> 
>> 
>> Ok, I did just that, but now I get errors when compiling, all related to
>> the
>> malloc operations.
>> 
>> 1>Compiling...
>> 1>TestSqlite.cpp
>> 1>c:\documents and settings\las1pal\my documents\visual studio
>> 2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot
>> convert
>> from 'void *' to 'char *'
>> 1>Conversion from 'void*' to pointer to non-'void' requires an
>> explicit cast
>> 1>c:\documents and settings\las1pal\my documents\visual studio
>> 2008\projects\sqlite3\sqlite3.c(12975) : error C2440: '=' : cannot
>> convert
>> from 'void *' to 'sqlite3_int64 *'
>> 1>Conversion from 'void*' to pointer to non-'void' requires an
>> explicit cast
>> 1>c:\documents and settings\las1pal\my documents\visual studio
>> 2008\projects\sqlite3\sqlite3.c(13028) : error C2440: '=' : cannot
>> convert
>> from 'void *' to 'sqlite3_int64 *'
>> 1>Conversion from 'void*' to pointer to non-'void' requires an
>> explicit cast
>> 1>c:\documents and settings\las1pal\my documents\visual studio
>> 2008\projects\sqlite3\sqlite3.c(15959) : error C2440: '=' : cannot
>> convert
>> from 'void *' to 'sqlite3_mutex *'
>> 1>Conversion from 'void*' to pointer to non-'void' requires an
>> explicit cast
>> ...
>> 
>> Is it because I include a .c source file in a c++ project?
>> 
>> Thanks
>> 
>> 
>> 
>> 
>> 
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p2908.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to access and open an existing SQLite database (in Eclipse/Emulator)

2010-07-07 Thread Chris
Hello Everyone,
I have created and loaded a small amount of data into a database via
the SQLite3 command line tool.
I am developing in Eclipse and using the emulator to test with. I do
not have an Android phone.

I would like to know what the accepted practice is for where to put
the database in my Eclipse Android project folder structure, and how
to access it in my java code.

Is it possible to do this or do I have to open the db file as a
regular file and copy it to a new file I create via my code and then
open that new file as a SQLite db?

I am very unclear about this as I am beginning to understand that the
db becomes part of the application itself and I have never worked in a
model like that.

It would also be good to know how to test for the existence of the
database file before trying to open it as it is my understanding that
a new db will be created if the open method does not find an existing
one.

Thank You in advance to anyone who would like to reply.

-Chris
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Reg: In Memory Database Using SQLite

2010-07-07 Thread Subhadeep Ghosh
Hello People,

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 function which serializes a database, copies the entire contents of the
database to a block of memory. The function which de-serializes takes a
block of memory as input and creates a database object out of it.

I am including the source code for the interested souls and I've not put
comments as I hate doing it.

I hope you guys find the code useful or at-least interesting.

Thank you and regards,
Subhadeep Ghosh.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL questions

2010-07-07 Thread Alexey Pechnikov
See http://sqlite.org/draft/wal.html :

"An SQLite database _connection_ defaults
to journal_mode=DELETE. To convert to WAL mode, use the following
pragma: PRAGMA journal_mode=WAL;"

-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Books which cover C API

2010-07-07 Thread Sam Carleton
On Wed, Jul 7, 2010 at 2:55 PM, Jay A. Kreibich  wrote:

>
>  This one is coming out next month.  I like it.
>
> http://www.amazon.com/Using-SQLite-Jay-Kreibich/dp/0596521189/
>

Jay,

Without knowing anything more about the book other then the link you
provided, the one thing I do know is if you didn't like it, there is no way
I would ever buy it! :) hehehehehehe

Sam
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL journal size grow unlimited

2010-07-07 Thread Alexey Pechnikov
Thanks, the problem is fixed in trunk for my tests.

7 июля 2010 г. 19:03 пользователь Richard Hipp  написал:
>
> This problem should be fixed in the latest snapshot available at
> http://www.sqlite.org/draft/download.html (or from Alexey's fossil
> mirror.)
>
> --
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Books which cover C API

2010-07-07 Thread Jay A. Kreibich
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 best for covering the C API?

  http://sqlite.org/books.html




  If you want to go out and buy something today, the most popular book
  is "The Definitive Guide to SQLite" by Mike Owens.  It is a bit
  older, but the core APIs haven't really changed:

http://www.amazon.com/Definitive-Guide-SQLite-Mike-Owens/dp/1590596730/



  This one is coming out next month.  I like it.

http://www.amazon.com/Using-SQLite-Jay-Kreibich/dp/0596521189/


   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Books which cover C API

2010-07-07 Thread Andrew Wood
Which of the books on the market is the best for covering the C API?


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread smengl90

Here is my email address fixed-term.seak.meng...@us.bosch.com

Thanks


Black, Michael (IS) wrote:
> 
> I've got Visual Express 2008 C++ -- I made a Win32 console application and
> compiled this just fine.
>  
> If you want to send your email address I'll email you the project and you
> can try it on the non-Express version.
>  
>  
> Michael D. Black
> Senior Scientist
> Northrop Grumman Mission Systems
>  
> 
> 
> 
> From: sqlite-users-boun...@sqlite.org on behalf of smengl90
> Sent: Wed 7/7/2010 12:19 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] EXTERNAL:Re: EXTERNAL: setup sqlite in vc++
> 
> 
> 
> 
> Ok, I did just that, but now I get errors when compiling, all related to
> the
> malloc operations.
> 
> 1>Compiling...
> 1>TestSqlite.cpp
> 1>c:\documents and settings\las1pal\my documents\visual studio
> 2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot convert
> from 'void *' to 'char *'
> 1>Conversion from 'void*' to pointer to non-'void' requires an
> explicit cast
> 1>c:\documents and settings\las1pal\my documents\visual studio
> 2008\projects\sqlite3\sqlite3.c(12975) : error C2440: '=' : cannot convert
> from 'void *' to 'sqlite3_int64 *'
> 1>Conversion from 'void*' to pointer to non-'void' requires an
> explicit cast
> 1>c:\documents and settings\las1pal\my documents\visual studio
> 2008\projects\sqlite3\sqlite3.c(13028) : error C2440: '=' : cannot convert
> from 'void *' to 'sqlite3_int64 *'
> 1>Conversion from 'void*' to pointer to non-'void' requires an
> explicit cast
> 1>c:\documents and settings\las1pal\my documents\visual studio
> 2008\projects\sqlite3\sqlite3.c(15959) : error C2440: '=' : cannot convert
> from 'void *' to 'sqlite3_mutex *'
> 1>Conversion from 'void*' to pointer to non-'void' requires an
> explicit cast
> ...
> 
> Is it because I include a .c source file in a c++ project?
> 
> Thanks
> 
> 
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p29099389.html
Sent from the SQLite mailing list archive at Nabble.com.

___
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-07 Thread Simon Slavin

On 7 Jul 2010, at 4:14pm, Jay A. Kreibich wrote:

>> (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
>  VACUUMed.

Actually the SSD possibility makes it worse, not better.  A simplified 
explanation follows.  SSD units use separate sets of circuits for each memory 
chip.  Suppose for the sake of argument that an 80Gig SSD drive contains 10 
8Gig memory chips, circuitry around each one, and master circuits to handle the 
hard drive interface.  And suppose you want to write two blocks to this drive 
and you do it in two different 'fwrite' commands.

The first command happens to be for a block which is stored in chip number 3 of 
10.  The drive accepts the write command, routes the data to chip 3, then tells 
the OS that it's ready for another command.  Suppose that the second command 
also refers to data stored in chip 3.  Well the circuitry around chip 3 is 
still busy handling the first command.  The drive has to wait for that 
circuitry to become free before it can send the second command to it.  On the 
other hand, suppose that the second write concerns data held in chip 5 instead. 
 Well that can be executed immediately: chip 5 isn't busy.

"Well," you ask, "if that's how it works, why don't SSD drives stripe the data 
so that contiguous blocks are spread over the different chips ?"  Well, if a 
single command is for data that's spread over different blocks, it's faster to 
send one instruction to one memory chip and handle one long chunk of data then 
to have to talk to several different chips and assemble the data into one chunk 
before returning it.  So it's swings and roundabouts.

So for SSD drives, or any system where a 'drive' is made up of separate storage 
items, locality can make things worse, not better.

Add to that the fact that fragmentation is only really a problem for Windows 
these days.  Windows filesystem drivers rely heavily on read-ahead logic for 
speed, and both NTFS and WIndows drivers were designed with that in mind.  
Having been designed with this in mind they operate pretty well and give pretty 
fast results.  On the other hand, Macs and other forms of Unix and Linux 
systems are hell on fragmentation because all forms of Unix run background 
daemons which are constantly reading and writing to disk log files and journals 
irrespective of what your 'main' application is doing.  Drivers and file 
systems designed for systems like that were built with different assumptions 
and don't degrade much with fragmentation.  Not to mention that a few hours 
after you've run a defragmentation program you'll find you're fragmented again 
because of all the background stuff that's going on.

So the urge towards defragmentation is a typical example of someone who knows a 
bit about how computers work -- "Fragmentation bad !  Caveman not like !" -- 
will spend hours on optimization that doesn't save much of anything.  And 
fragmentation is not one unusual example, many things which naively look like 
they should be optimization actually aren't.  So write simple clean code first. 
 Only if you've decided it's not good enough is it worth improving it.  And 
when you write a newer version which is meant to be better, compare the too to 
check that it really is.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Simon Davies
On 7 July 2010 18:19, smengl90  wrote:
>
> Ok, I did just that, but now I get errors when compiling, all related to the
> malloc operations.
>
> 1>Compiling...
> 1>TestSqlite.cpp
> 1>c:\documents and settings\las1pal\my documents\visual studio
> 2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot convert
> from 'void *' to 'char *'
.
.
.
.
> ...
>
> Is it because I include a .c source file in a c++ project?

Maybe - have you marked that 1 file as 'compile as c code'?

(Properties -> C/C++ -> Advanced tab)

>
> Thanks
>

Regards,
Simon
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Black, Michael (IS)
I've got Visual Express 2008 C++ -- I made a Win32 console application and 
compiled this just fine.
 
If you want to send your email address I'll email you the project and you can 
try it on the non-Express version.
 
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of smengl90
Sent: Wed 7/7/2010 12:19 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] EXTERNAL:Re: EXTERNAL: setup sqlite in vc++




Ok, I did just that, but now I get errors when compiling, all related to the
malloc operations.

1>Compiling...
1>TestSqlite.cpp
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot convert
from 'void *' to 'char *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(12975) : error C2440: '=' : cannot convert
from 'void *' to 'sqlite3_int64 *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(13028) : error C2440: '=' : cannot convert
from 'void *' to 'sqlite3_int64 *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(15959) : error C2440: '=' : cannot convert
from 'void *' to 'sqlite3_mutex *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
...

Is it because I include a .c source file in a c++ project?

Thanks




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread smengl90

Ok, I did just that, but now I get errors when compiling, all related to the
malloc operations.

1>Compiling...
1>TestSqlite.cpp
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(12281) : error C2440: '=' : cannot convert
from 'void *' to 'char *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(12975) : error C2440: '=' : cannot convert
from 'void *' to 'sqlite3_int64 *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(13028) : error C2440: '=' : cannot convert
from 'void *' to 'sqlite3_int64 *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
1>c:\documents and settings\las1pal\my documents\visual studio
2008\projects\sqlite3\sqlite3.c(15959) : error C2440: '=' : cannot convert
from 'void *' to 'sqlite3_mutex *'
1>Conversion from 'void*' to pointer to non-'void' requires an
explicit cast
...

Is it because I include a .c source file in a c++ project?

Thanks


Black, Michael (IS) wrote:
> 
> You don't need the lib -- you just need to include sqlite3.c as another
> source file in your project.  
>  
> Michael D. Black
> Senior Scientist
> Northrop Grumman Mission Systems
>  
> 
> 
> 
> From: sqlite-users-boun...@sqlite.org on behalf of smengl90
> Sent: Tue 7/6/2010 5:09 PM
> To: sqlite-users@sqlite.org
> Subject: EXTERNAL:Re: [sqlite] EXTERNAL: setup sqlite in vc++
> 
> 
> 
> 
> I found out that including the header file alone is not enough. I need to
> link the sqlite lib to my project. But how can can I get the lib?
> 
> 
> 
> smengl90 wrote:
>>
>> Thanks for prompt replies. I did as you advised, and included the .h file
>> as a source file and copied your code. But when I compiled it, I got
>> these
>> linking errors:
>>
>> 1>Linking...
>> 1>TestSqlite.obj : error LNK2019: unresolved external symbol
>> _sqlite3_close referenced in function _main
>> 1>TestSqlite.obj : error LNK2019: unresolved external symbol
>> _sqlite3_free
>> referenced in function _main
>> 1>TestSqlite.obj : error LNK2019: unresolved external symbol
>> _sqlite3_exec
>> referenced in function _main
>> 1>TestSqlite.obj : error LNK2019: unresolved external symbol
>> _sqlite3_open
>> referenced in function _main
>> 1>C:\Documents and Settings\My Documents\Visual Studio
>> 2008\Projects\TestSqlite\Debug\TestSqlite.exe : fatal error LNK1120: 4
>> unresolved externals
>>
>> Any ideas what I did wrong?
>>
>> Thanks
>>
>>
>> Black, Michael (IS) wrote:
>>>
>>> You don't need C++ wrappers...just code in C.  There's lots more C
>>> examples out there than C++.
>>> 
>>> Easiest way for me to integrate is to download the amalgamation and
>>> include it as  a source file in your project.
>>> 
>>> The amalgamzation is at the top of the download page:
>>> 
>>> http://www.sqlite.org/download.html
>>> 
>>> Simple program for you to compile as C++ which I wrote from a question
>>> somebody had on the list here.
>>> 
>>> #include 
>>> #include 
>>> #include "sqlite3.h"
>>> int main()
>>> {
>>> sqlite3 *db;
>>> char *errmsg=NULL;
>>> int rc;
>>> int i;
>>> sqlite3_open("test.db",);
>>> rc=sqlite3_exec(db, "CREATE TABLE log (id_client varchar, utc
>>> number)",NULL,NULL,);
>>> if (rc != SQLITE_OK) {
>>> puts(errmsg);
>>> sqlite3_free(errmsg);
>>> }
>>> sqlite3_exec(db,"BEGIN",NULL,NULL,);
>>> for(i=0;i<10;i++) {
>>>  int j=i*10;
>>>  char sql[4096];
>>>  sprintf(sql,"INSERT INTO log VALUES ('%d',%d)",i,j);
>>>  rc=sqlite3_exec(db, sql,NULL,NULL,);
>>>  if (rc != SQLITE_OK) {
>>>  std::cout << errmsg << std::endl;
>>>  sqlite3_free(errmsg);
>>>  exit(-1);
>>>  }
>>> }
>>> sqlite3_exec(db,"COMMIT",NULL,NULL,);
>>> sqlite3_close(db);
>>> return 0;
>>> }
>>>
>>> 
>>> Michael D. Black
>>> Senior Scientist
>>> Northrop Grumman Mission Systems
>>> 
>>>
>>> 
>>>
>>> From: sqlite-users-boun...@sqlite.org on behalf of smengl90
>>> Sent: Tue 7/6/2010 2:33 PM
>>> To: sqlite-users@sqlite.org
>>> Subject: EXTERNAL:[sqlite] setup sqlite in vc++
>>>
>>>
>>>
>>>
>>> Hi guys,
>>>
>>> I am trying to setup sqlite to be used with VC++ 2008. Can someone show
>>> me
>>> where I can find instructions on how to set it up? and do I need a c++
>>> wrapper to code in C++? If yes, can someone also show how to setup the
>>> wrapper?
>>>
>>> Thanks
>>> --
>>> View this message in context:
>>> http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p29086729.html
>>> Sent from the SQLite mailing list archive at Nabble.com.
>>>
>>> 

Re: [sqlite] SqLite 3.7.0 amalgamation build warnings

2010-07-07 Thread Pavel Ivanov
> The build warning is my main concern:
>> warning BK4504 : file contains too many references; ignoring further
> references from this source

Looks like this warning can be safely ignored and internet even has
quite a few suggestions on its suppression. Here's what I found:
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/195e7065-b429-4324-9f38-35558867cfbd
http://www.tech-archive.net/Archive/VC/microsoft.public.vc.ide_general/2006-12/msg00026.html
http://connect.microsoft.com/VisualStudio/feedback/details/558219/bscmake-ignore-switch-ei


Pavel

On Wed, Jul 7, 2010 at 11:57 AM, Nick Shaw  wrote:
> Ah, ok thanks.  I'm not too concerned about the warnings myself; as I
> said, I can hide them.  I just wanted to highlight them incase they've
> not been spotted in the compilers the developers use.
>
> The build warning is my main concern:
>> warning BK4504 : file contains too many references; ignoring further
> references from this source
>
> I've never come across this warning before (in ANY project), but it
> doesn't sound too healthy to me.  I'm happy to ignore it too, but I
> can't hide it with a compiler pragma as it's from BSCMAKE, and that
> breaks our internal coding standards.  That's obviously not the sqlite
> developers' problem, but I wondered why this warning has appeared in
> 3.7.0 and was not in 3.6.x (implying it's in new bits code), which
> compiled (with a few compiler pragmas to ignore basic compile warnings)
> without issue?
>
> If it's safe to ignore, I'll see about finding a way to hide the
> warning.
>
> Thanks,
> Nick.
>
>> -Original Message-
>> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
>> boun...@sqlite.org] On Behalf Of Eric Smith
>> Sent: 07 July 2010 16:34
>> To: General Discussion of SQLite Database
>> Subject: Re: [sqlite] SqLite 3.7.0 amalgamation build warnings
>>
>> Nick Shaw wrote:
>>
>> > Realised I also fixed this warning before posting too:
>>
>> You may not be getting a lot of responses on this because the SQLite
>> devs have a philosophy that, for this project, chasing down compiler
>> warnings is generally a waste of time.
>>
>> See http://sqlite.org/testing.html#staticanalysis for details on that.
>>
>> If you want action regarding the warnings you see, I recommend arguing
>> how the relevant code will cause a real-world behavioral problem.  And
>> the best argument is to write a bit of code exercising the problem.
>>
>> --
>> Eric A. Smith
>>
>> Where a calculator on the ENIAC is equipped with 18,000 vaccuum tubes
>> and weighs 30 tons, computers in the future may have only
>> 1,000 vaccuum tubes and perhaps weigh 1 1/2 tons.
>>     -- Popular Mechanics, March 1949
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SqLite 3.7.0 amalgamation build warnings

2010-07-07 Thread Eric Smith
Nick Shaw wrote: 

> If it's safe to ignore 

Note that I was careful not to say that the warnings are safe to 
ignore.  :) I only said that the SQLite devs may ignore them without 
further evidence of problems.  

I'm not an expert on the SQLite code, so wouldn't make any specific 
claims about it.  

Eric 

-- 
Eric A. Smith

Peace, n.:
In international affairs, a period of cheating between two
periods of fighting.
-- Ambrose Bierce, "The Devil's Dictionary"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SqLite 3.7.0 amalgamation build warnings

2010-07-07 Thread Nick Shaw
Ah, ok thanks.  I'm not too concerned about the warnings myself; as I
said, I can hide them.  I just wanted to highlight them incase they've
not been spotted in the compilers the developers use.

The build warning is my main concern:
> warning BK4504 : file contains too many references; ignoring further
references from this source

I've never come across this warning before (in ANY project), but it
doesn't sound too healthy to me.  I'm happy to ignore it too, but I
can't hide it with a compiler pragma as it's from BSCMAKE, and that
breaks our internal coding standards.  That's obviously not the sqlite
developers' problem, but I wondered why this warning has appeared in
3.7.0 and was not in 3.6.x (implying it's in new bits code), which
compiled (with a few compiler pragmas to ignore basic compile warnings)
without issue?

If it's safe to ignore, I'll see about finding a way to hide the
warning.

Thanks,
Nick.

> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Eric Smith
> Sent: 07 July 2010 16:34
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] SqLite 3.7.0 amalgamation build warnings
> 
> Nick Shaw wrote:
> 
> > Realised I also fixed this warning before posting too:
> 
> You may not be getting a lot of responses on this because the SQLite
> devs have a philosophy that, for this project, chasing down compiler
> warnings is generally a waste of time.
> 
> See http://sqlite.org/testing.html#staticanalysis for details on that.
> 
> If you want action regarding the warnings you see, I recommend arguing
> how the relevant code will cause a real-world behavioral problem.  And
> the best argument is to write a bit of code exercising the problem.
> 
> --
> Eric A. Smith
> 
> Where a calculator on the ENIAC is equipped with 18,000 vaccuum tubes
> and weighs 30 tons, computers in the future may have only
> 1,000 vaccuum tubes and perhaps weigh 1 1/2 tons.
> -- Popular Mechanics, March 1949
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SqLite 3.7.0 amalgamation build warnings

2010-07-07 Thread Eric Smith
Nick Shaw wrote: 

> Realised I also fixed this warning before posting too: 

You may not be getting a lot of responses on this because the SQLite 
devs have a philosophy that, for this project, chasing down compiler 
warnings is generally a waste of time.  

See http://sqlite.org/testing.html#staticanalysis for details on that.  

If you want action regarding the warnings you see, I recommend arguing 
how the relevant code will cause a real-world behavioral problem.  And 
the best argument is to write a bit of code exercising the problem.  

-- 
Eric A. Smith

Where a calculator on the ENIAC is equipped with 18,000 vaccuum 
tubes and weighs 30 tons, computers in the future may have only 
1,000 vaccuum tubes and perhaps weigh 1 1/2 tons.
-- Popular Mechanics, March 1949
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SqLite 3.7.0 amalgamation build warnings

2010-07-07 Thread Nick Shaw
Realised I also fixed this warning before posting too:

  static const VdbeOp dummy;  /* Ignore the MSVC warning about no
initializer */
> warning C4132: 'dummy' : const object should be initialized

Another not entirely worrysome issue, but thought I'd mention it.

Here's another that was in 3.6.x that I just hid with a pragma:
  pPage->nFree -= (nCell*2 + nUsable - cellbody);
> warning C4244: '-=' : conversion from 'int' to 'u16', possible loss of
data

Thanks,
Nick.
--- 


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Nick Shaw
> Sent: 07 July 2010 14:47
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] SqLite 3.7.0 amalgamation build warnings
> 
> Forgot to say: I've got these lines added at the top of the file (thus
> the line number references are 7 lines lower than the original
source):
> 
> //---  Added lines:
> #pragma warning (disable:4127)
> #pragma warning (disable:4244)
> #pragma warning (disable:4706)
> #define SQLITE_ENABLE_COLUMN_METADATA
> // --- End added lines
> 
> The pragma warnings are to disable other build warnings that I
consider
> safe to ignore.  The lowest one, 4706 is the compile warning I mention
> below, and is caused by this specific line of code:
> 
> for(eMode=0; (zMode = sqlite3JournalModename(eMode)); eMode++){
> 
> Thanks,
> Nick.
> 
> > -Original Message-
> > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> > boun...@sqlite.org] On Behalf Of Nick Shaw
> > Sent: 07 July 2010 13:43
> > To: sqlite-users@sqlite.org
> > Subject: [sqlite] SqLite 3.7.0 amalgamation build warnings
> >
> > Hi,
> >
> >
> >
> > I wanted to test the upcoming 3.7.0 build of sqlite to assist in the
> > 'beta testing', however I'm getting the following build warnings
which
> > did not appear when compiling 3.6.x amalgamations.  Please let me
know
> > if they are considered safe to ignore:
> >
> >
> >
> > (building in Visual Studio 2008 as part of a static link library;
> sqlite
> > build is the amalgamation taken from yesterday's snapshot)
> >
> >
> >
> > When compiling:
> >
> > 1>c:\dev\tools\sqlite3.c(83600) : warning C4706: assignment within
> > conditional expression
> >
> >
> >
> > And when building:
> >
> > 1>c:\dev\tools\sqlite3.c(34990) : warning BK4504 : file contains too
> > many references; ignoring further references from this source
> >
> >
> >
> > The latter one concerns me the most.  I can hide the first one with
a
> > compiler pragma, but I can't hide the second as it's a BSCMAKE
> warning.
> >
> >
> >
> > Thanks,
> >
> > Nick.
> >
> >
> >
> >
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
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-07 Thread Jay A. Kreibich
On Wed, Jul 07, 2010 at 01:03:26PM +0400, Igor Sereda scratched on the wall:
> > It's never time to VACUUM a database.
> 
> This is an interesting statement. In our application, all tables get
> heavily fragmented with time (99% or more). I was considering VACUUM
> as a means to defragment, and, presumably, improve search performance.
> Was I misguided, and search performance does not degrade significantly
> with the increased fragmentation of the DB?

  No, you're not misguided, but the full picture is deeper.

  The VACUUM will repack the pages, putting more user-data in a
  smaller footprint.  This improves I/O performance since you
  pull in more usable data with a given number of reads (at least,
  until things are mixed up again).  This will typically only show up
  when doing large scans of tables that have been really thrashed,
  however (rows added and deleted and added and deleted over and over
  and over).

  VACUUM also puts all the pages of a given database object in the same
  spot in the file.  That will help with reads, but only if the low
  level block assignments on the disk are continuous.  Just because the
  blocks are next to each other in a file doesn't mean they're next to
  each other on the disk.

  In theory, the VACUUM also provides the filesystem an opportunity
  to defragment the file itself, but it is less clear how much this 
  actually happens.  VACUUM rebuilds the database into a temp file and
  then copies it back, but the copy is done as a low level page-by-page
  overwrite-- it does not actually delete the old file and then just
  copy or rename the rebuilt one.  This makes the whole operation
  transaction safe (complete with roll back ability right up to the
  final moment of success), but it means the original database file
  stays more or less intact on the filesystem, and is simply
  over-written one section at a time.  Some filesystems will take
  the chance to merge the file blocks, some will not.

  If you really want the best performance, your best bet is to copy the
  file after it has been VACUUMed.  Or defragment the filesystem.  Or
  use an auto-defragmenting filesystem.

> (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
  VACUUMed.  Memory for the page cache also tends to be very guarded.

  On a modern desktop system, it is likely the filesystem and/or the
  disk controller will do some level of read-ahead, however.  Any
  benefit will likely require contiguous physical layout.



  Overall, I agree with most others... if you're just starting
  application development, this should be way way down on your list of
  concerns.  It is likely this concern can even drop off the list,
  unless you know your files are significant in size, the database
  lifespan is significant, and the database will be subjected to an
  extremely high amount of flux and row thrashing.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL journal size grow unlimited

2010-07-07 Thread Richard Hipp
2010/7/7 Alexey Pechnikov 

> And additional problem fired when increased range j<=2000:
> ...
> 558
> database disk image is malformed
>while executing
> "db eval {insert into role (uuid) values (hex(randomblob(16)))}"
> ...
>

This problem should be fixed in the latest snapshot available at
http://www.sqlite.org/draft/download.html (or from Alexey's fossil mirror.)


> $ ls -lh|grep .db
> -rw-r--r-- 1 veter veter 4,4G Июл  7 09:10 grow.db
> -rw-r--r-- 1 veter veter 288K Июл  7 09:10 grow.db-shm
> -rw-r--r-- 1 veter veter 261M Июл  7 09:10 grow.db-wal
>
> --
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
-
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Numbers as CHARs.

2010-07-07 Thread Ted Rolle, Jr.
On Tue, 6 Jul 2010 17:13:44 -0500
P Kishor  wrote:
> I have no idea why you would say that. It works just fine.
> 
> sqlite> CREATE TABLE UPCs (UPC TEXT);
> sqlite> INSERT INTO UPCs VALUES ('043000205563');
> sqlite> SELECT * FROM UPCs;
> UPC
> 
> 043000205563
> sqlite>

Oh, by the way, '043000205563' is Jell-O Chocolate Fudge Pie Filling.
I don't believe that has any bearing on the problem, though. :-)

Ted
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Jay A. Kreibich
On Wed, Jul 07, 2010 at 02:35:58PM +0100, Andrew Wood scratched on the wall:
> Ok, what if I come at the problem from the opposite side:
> 
> The problem is, Ive got a BLOB field which contains  a char array as an 
> escpaped string but when I call sqlite3_column_type(preparedstatement, 
> x); it comes back as SQLITE_TEXT not SQLITE_BLOB

  It sounds like it is being inserted as a text value (or you're
  calling sqlite3_column_bytes16() or something silly).  Try
  selecting typeof(col) and see what that returns.

  If you're inserting literal values, BLOBs must be in hex.  For
  example, these will both insert the same three bytes
  (ASCII 'A' = 0x41): 


X'414243'is a BLOB value.
 'ABC'   is a text value.


-j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SqLite 3.7.0 amalgamation build warnings

2010-07-07 Thread Nick Shaw
Forgot to say: I've got these lines added at the top of the file (thus
the line number references are 7 lines lower than the original source):

//---  Added lines:
#pragma warning (disable:4127)
#pragma warning (disable:4244)
#pragma warning (disable:4706)
#define SQLITE_ENABLE_COLUMN_METADATA
// --- End added lines

The pragma warnings are to disable other build warnings that I consider
safe to ignore.  The lowest one, 4706 is the compile warning I mention
below, and is caused by this specific line of code:

for(eMode=0; (zMode = sqlite3JournalModename(eMode)); eMode++){

Thanks,
Nick.

> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Nick Shaw
> Sent: 07 July 2010 13:43
> To: sqlite-users@sqlite.org
> Subject: [sqlite] SqLite 3.7.0 amalgamation build warnings
> 
> Hi,
> 
> 
> 
> I wanted to test the upcoming 3.7.0 build of sqlite to assist in the
> 'beta testing', however I'm getting the following build warnings which
> did not appear when compiling 3.6.x amalgamations.  Please let me know
> if they are considered safe to ignore:
> 
> 
> 
> (building in Visual Studio 2008 as part of a static link library;
sqlite
> build is the amalgamation taken from yesterday's snapshot)
> 
> 
> 
> When compiling:
> 
> 1>c:\dev\tools\sqlite3.c(83600) : warning C4706: assignment within
> conditional expression
> 
> 
> 
> And when building:
> 
> 1>c:\dev\tools\sqlite3.c(34990) : warning BK4504 : file contains too
> many references; ignoring further references from this source
> 
> 
> 
> The latter one concerns me the most.  I can hide the first one with a
> compiler pragma, but I can't hide the second as it's a BSCMAKE
warning.
> 
> 
> 
> Thanks,
> 
> Nick.
> 
> 
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Andrew Wood
Ok, what if I come at the problem from the opposite side:

The problem is, Ive got a BLOB field which contains  a char array as an 
escpaped string but when I call sqlite3_column_type(preparedstatement, 
x); it comes back as SQLITE_TEXT not SQLITE_BLOB

I want a way to detect that it should really be a blob not a string so 
that its interpreted as a char array rather than just a regular string. 
I seem to recall in MySQL you can check this by testing the charset of 
the string.

On 07/07/10 13:37, Jay A. Kreibich wrote:
> On Wed, Jul 07, 2010 at 12:32:53PM +0100, Andrew Wood scratched on the wall:
>
>> Is there not just a function which will take the index of a column and
>> return its declared type?
>>  
>Not in the general case.  sqlite3_column_decltype() will do it for
>SELECT statements, but only if the result-set column is a direct
>column reference, and only if SQLite is compiled to handle meta-data.
>
>Declared types are fairly unimportant in SQLite.  They don't mean
>much.  Most applications never need to deal with them.
>
> -j
>
>
>> On 07/07/10 04:41, Jay A. Kreibich wrote:
>>  
>>> On Tue, Jul 06, 2010 at 11:27:09PM +0100, Andrew Wood scratched on the wall:
>>>
>>>
 How can I find out the declared type of a column.

  
>>> If you just want to know the declared type of a column you already
>>> know about, it use "PRAGMA table_info".
>>>
>>> http://www.sqlite.org/pragma.html
>>>
>>>  -j
>>>
>

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Pavel Ivanov
> So it means we can have mor than one valid db handle?

Yes.

Pavel

On Wed, Jul 7, 2010 at 9:29 AM, Lloyd  wrote:
> So it means we can have mor than one valid db handle?
>
> Thanks,
>  Lloyd
>
> - Original Message -
> From: "Pavel Ivanov" 
> To: "General Discussion of SQLite Database" 
> Sent: Wednesday, July 07, 2010 6:40 PM
> Subject: Re: [sqlite] sqlite3_step returns sqlite_busy
>
>
>>> one thread is preparing an "INSERT" statement (It returns SQLITE_OK),
>>> then it is executed using sqlite3_step. sqlite3_step returns an
>>> SQLITE_BUSY! Is there any possibility for this?
>>
>> Sure. Preparing INSERT statement doesn't acquire any "write" locks on
>> the database. It's executing the INSERT statement that acquires locks.
>> So if while executing statement finds that it can't get the locks then
>> sqlite3_step returns SQLITE_BUSY. And thread-safety is irrelevant
>> here.
>>
>>
>> Pavel
>>
>
>
> __
> Scanned and protected by Email scanner
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd
So it means we can have mor than one valid db handle?

Thanks,
  Lloyd

- Original Message - 
From: "Pavel Ivanov" 
To: "General Discussion of SQLite Database" 
Sent: Wednesday, July 07, 2010 6:40 PM
Subject: Re: [sqlite] sqlite3_step returns sqlite_busy


>> one thread is preparing an "INSERT" statement (It returns SQLITE_OK),
>> then it is executed using sqlite3_step. sqlite3_step returns an
>> SQLITE_BUSY! Is there any possibility for this?
> 
> Sure. Preparing INSERT statement doesn't acquire any "write" locks on
> the database. It's executing the INSERT statement that acquires locks.
> So if while executing statement finds that it can't get the locks then
> sqlite3_step returns SQLITE_BUSY. And thread-safety is irrelevant
> here.
> 
> 
> Pavel
> 


__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXTERNAL: sqlite3_step returns sqlite_busy

2010-07-07 Thread Pavel Ivanov
> You men to handle the BUSY by waiting for some time and trying to execute
> sqlite3_step?

You can call sqlite3_busy_timeout() with appropriate value after
opening a connection and SQLite will do this waiting for you. Just
remember that explicit transaction that began as read-only and then
transforms into writing can return SQLITE_BUSY anyway and you would
have to rollback it.


Pavel

On Wed, Jul 7, 2010 at 8:36 AM, Lloyd  wrote:
>
> - Original Message -
> From: "Black, Michael (IS)" 
> To: "General Discussion of SQLite Database" 
> Sent: Wednesday, July 07, 2010 5:35 PM
> Subject: Re: [sqlite] EXTERNAL: sqlite3_step returns sqlite_busy
>
>
> Of course it's possible -- multiple clients accesing the database is just
> fine.
>
> Is there any reason you need exclusive access for each thread in ping-pong
> mode?  If not, just handle the BUSY in both places.
>
> I just want to ensure that the "right data" is read always. And also I want
> it to return the data always. (Even if the database is locked, I am ready to
> wait and open it)
>
> You men to handle the BUSY by waiting for some time and trying to execute
> sqlite3_step?
>
> Thanks a lot,
>  Lloyd
>
>
>
> __
> Scanned and protected by Email scanner
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Pavel Ivanov
> one thread is preparing an "INSERT" statement (It returns SQLITE_OK),
> then it is executed using sqlite3_step. sqlite3_step returns an
> SQLITE_BUSY! Is there any possibility for this?

Sure. Preparing INSERT statement doesn't acquire any "write" locks on
the database. It's executing the INSERT statement that acquires locks.
So if while executing statement finds that it can't get the locks then
sqlite3_step returns SQLITE_BUSY. And thread-safety is irrelevant
here.


Pavel

On Wed, Jul 7, 2010 at 7:56 AM, Lloyd  wrote:
> Hi,
>
> We have a multi-threaded application (I know "threads are evil", but this is 
> a small server application). Each thread tries to access the SQLite database. 
> When trying to get a DB handle (sqlite3_open), if it returns SQLITE_BUSY, 
> then the thread will wait for some time and try to open it again (until it 
> gets the handle). In our case, two threads are running, one thread is 
> preparing an "INSERT" statement (It returns SQLITE_OK), then it is executed 
> using sqlite3_step. sqlite3_step returns an SQLITE_BUSY! Is there any 
> possibility for this? ( I think these two threads are obtaining the DB handle 
> at the same time using sqlite_open - with wrtie permission- is it possible?) 
> I have tried compiling the application with both  -DSQLITE_THREADSAFE=2 and 
> -DSQLITE_THREADSAFE=1.
>
> Any hint would be very helpful...
>
> Thanks a lot,
>  Lloyd
>
> __
> Scanned and protected by Email scanner
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SqLite 3.7.0 amalgamation build warnings

2010-07-07 Thread Nick Shaw
Hi,

 

I wanted to test the upcoming 3.7.0 build of sqlite to assist in the
'beta testing', however I'm getting the following build warnings which
did not appear when compiling 3.6.x amalgamations.  Please let me know
if they are considered safe to ignore:

 

(building in Visual Studio 2008 as part of a static link library; sqlite
build is the amalgamation taken from yesterday's snapshot)

 

When compiling:

1>c:\dev\tools\sqlite3.c(83600) : warning C4706: assignment within
conditional expression

 

And when building:

1>c:\dev\tools\sqlite3.c(34990) : warning BK4504 : file contains too
many references; ignoring further references from this source

 

The latter one concerns me the most.  I can hide the first one with a
compiler pragma, but I can't hide the second as it's a BSCMAKE warning. 

 

Thanks,

Nick.



 

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Jay A. Kreibich
On Wed, Jul 07, 2010 at 12:32:53PM +0100, Andrew Wood scratched on the wall:
> Is there not just a function which will take the index of a column and 
> return its declared type?

  Not in the general case.  sqlite3_column_decltype() will do it for
  SELECT statements, but only if the result-set column is a direct
  column reference, and only if SQLite is compiled to handle meta-data.

  Declared types are fairly unimportant in SQLite.  They don't mean
  much.  Most applications never need to deal with them.
  
   -j

> On 07/07/10 04:41, Jay A. Kreibich wrote:
> > On Tue, Jul 06, 2010 at 11:27:09PM +0100, Andrew Wood scratched on the wall:
> >
> >> How can I find out the declared type of a column.
> >>  
> >If you just want to know the declared type of a column you already
> >know about, it use "PRAGMA table_info".
> >
> >http://www.sqlite.org/pragma.html
> >
> > -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXTERNAL: sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd

- Original Message - 
From: "Black, Michael (IS)" 
To: "General Discussion of SQLite Database" 
Sent: Wednesday, July 07, 2010 5:35 PM
Subject: Re: [sqlite] EXTERNAL: sqlite3_step returns sqlite_busy


Of course it's possible -- multiple clients accesing the database is just 
fine.

Is there any reason you need exclusive access for each thread in ping-pong 
mode?  If not, just handle the BUSY in both places.

I just want to ensure that the "right data" is read always. And also I want 
it to return the data always. (Even if the database is locked, I am ready to 
wait and open it)

You men to handle the BUSY by waiting for some time and trying to execute 
sqlite3_step?

Thanks a lot,
  Lloyd 



__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXTERNAL: sqlite3_step returns sqlite_busy

2010-07-07 Thread Black, Michael (IS)
Of course it's possible -- multiple clients accesing the database is just fine.
 
Is there any reason you need exclusive access for each thread in ping-pong 
mode?  If not, just handle the BUSY in both places.
 
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of Lloyd
Sent: Wed 7/7/2010 6:56 AM
To: sqlite-users@sqlite.org
Subject: EXTERNAL:[sqlite] sqlite3_step returns sqlite_busy



Hi,

We have a multi-threaded application (I know "threads are evil", but this is a 
small server application). Each thread tries to access the SQLite database. 
When trying to get a DB handle (sqlite3_open), if it returns SQLITE_BUSY, then 
the thread will wait for some time and try to open it again (until it gets the 
handle). In our case, two threads are running, one thread is preparing an 
"INSERT" statement (It returns SQLITE_OK), then it is executed using 
sqlite3_step. sqlite3_step returns an SQLITE_BUSY! Is there any possibility for 
this? ( I think these two threads are obtaining the DB handle at the same time 
using sqlite_open - with wrtie permission- is it possible?) I have tried 
compiling the application with both  -DSQLITE_THREADSAFE=2 and 
-DSQLITE_THREADSAFE=1.

Any hint would be very helpful...

Thanks a lot,
  Lloyd

__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL journal size grow unlimited

2010-07-07 Thread Richard Hipp
FTS3 works by building small inverted indices and periodically merging the
smaller indices into larger indices.  The mergers are incremental.  But once
you get to the point of multi-gigabyte FTS3 tables and you are combining
100,000 inserts into a single transaction, you can end up with some very,
very large transactions.

The WAL must be big enough to contain an entire transaction.  Since you are
creating larger and larger transactions, the WAL is getting bigger and
bigger.

I modified your script as follows:

file delete -force grow.db grow.db-wal grow.db-journal grow.db-shm
sqlite3 db grow.db
db eval {pragma cache_size=32000}
db eval {pragma journal_mode=WAL}
db eval {PRAGMA synchronous=normal}

db eval {CREATE VIRTUAL TABLE role USING fts3(id INTEGER PRIMARY KEY, uuid
TEXT);}

for {set j 1} {$j<=2000} {incr j} {
  puts -nonewline "$j... "; flush stdout
  db transaction {
for {set i 0} {$i<10} {incr i} {
  db eval {insert into role (uuid) values (hex(randomblob(16)))}
}
  }
  puts "[file size grow.db] [file size grow.db-wal] [file size grow.db-shm]"
}

I'm running it now.  It is on iteration 235.  Sizes are 2.148GB, 241MB, and
1.86MB, respectively.  I'll keep it running to see if I can reproduce your
corrupt database problem

2010/7/6 Alexey Pechnikov 

> Oh, yes, check null size for new database is incorrect in WAL mode. I
> replace this script by more simple:
> ==
> http://mobigroup.ru/files/test.tcl
>
> #!/usr/bin/tclsh8.5
> package require sqlite3
>
> sqlite3 db grow.db
> db eval {pragma cache_size=32000}
> db eval {pragma journal_mode=WAL}
> db eval {PRAGMA synchronous=normal}
>
> db eval {CREATE VIRTUAL TABLE role USING fts3(id INTEGER PRIMARY KEY, uuid
> TEXT);}
>
> for {set j 1} {$j<=200} {incr j} {
>  puts $j
>  db transaction {
>for {set i 0} {$i<10} {incr i} {
>  db eval {insert into role (uuid) values (hex(randomblob(16)))}
>}
>  }
> }
>
> db close
> ==
>
> After step between 40 and 45 WAL journal starts grow:
>
> $ ls -lh|grep grow
> -rw-r--r-- 1 veter veter 358M Июл  7 07:09 grow.db
> -rw-r--r-- 1 veter veter  32K Июл  7 07:08 grow.db-shm
> -rw-r--r-- 1 veter veter  23M Июл  7 07:09 grow.db-wal
> $ ls -lh|grep grow
> -rw-r--r-- 1 veter veter 358M Июл  7 07:09 grow.db
> -rw-r--r-- 1 veter veter  32K Июл  7 07:08 grow.db-shm
> -rw-r--r-- 1 veter veter 105M Июл  7 07:09 grow.db-wal
> $ ls -lh|grep grow
> -rw-r--r-- 1 veter veter 374M Июл  7 07:09 grow.db
> -rw-r--r-- 1 veter veter 256K Июл  7 07:09 grow.db-shm
> -rw-r--r-- 1 veter veter 228M Июл  7 07:09 grow.db-wal
>
> There is only single process:
>
> $ ls -lh|grep grow
> -rw-r--r-- 1 veter veter 862M Июл  7 07:11 grow.db
> -rw-r--r-- 1 veter veter 256K Июл  7 07:10 grow.db-shm
> -rw-r--r-- 1 veter veter 254M Июл  7 07:11 grow.db-wal
> $ fuser grow.db
> grow.db: 16190
> $ ps aux|grep 16190|grep -v grep
> veter16190 84.8  3.2 304372 273136 pts/1   Dl+  07:07   3:48
> /usr/bin/tclsh8.5 ./test.tcl
> $ ls -lh|grep grow
> -rw-r--r-- 1 veter veter 862M Июл  7 07:11 grow.db
> -rw-r--r-- 1 veter veter 256K Июл  7 07:10 grow.db-shm
> -rw-r--r-- 1 veter veter 254M Июл  7 07:11 grow.db-wal
>
> --
> Best regards, Alexey Pechnikov.
> http://pechnikov.tel/
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
-
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd
Hi,

We have a multi-threaded application (I know "threads are evil", but this is a 
small server application). Each thread tries to access the SQLite database. 
When trying to get a DB handle (sqlite3_open), if it returns SQLITE_BUSY, then 
the thread will wait for some time and try to open it again (until it gets the 
handle). In our case, two threads are running, one thread is preparing an 
"INSERT" statement (It returns SQLITE_OK), then it is executed using 
sqlite3_step. sqlite3_step returns an SQLITE_BUSY! Is there any possibility for 
this? ( I think these two threads are obtaining the DB handle at the same time 
using sqlite_open - with wrtie permission- is it possible?) I have tried 
compiling the application with both  -DSQLITE_THREADSAFE=2 and 
-DSQLITE_THREADSAFE=1.

Any hint would be very helpful...

Thanks a lot,
  Lloyd

__
Scanned and protected by Email scanner
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] ANN: AnySQL Maestro 10.7 released

2010-07-07 Thread SQL Maestro Group
Hi!

SQL Maestro Group announces the release of AnySQL Maestro 10.7, a powerful
tool for managing any database engine accessible via ODBC driver or OLE DB
provider (SQLite, MySQL, SQL Server, Oracle, Access, etc). The new version
is immediately available at
http://www.sqlmaestro.com/products/anysql/maestro/

This version features database profile management extensions, updated Script
Runner, improved Data Analysis and Data Import tools, and some other useful
things. Full press-release (with explaining screenshots) is available at:
http://www.sqlmaestro.com/news/company/anysql_maestro_10_7_released/

AnySQL Maestro comes in two editions: Freeware and Professional. The feature
matrix can be found at
http://www.sqlmaestro.com/products/anysql/maestro/free_vs_pro/

AnySQL Maestro 10.7 has been successfully tested with the SQLite ODBC driver
by Christian Werner (http://www.ch-werner.de/sqliteodbc/) and all the latest
SQLite versions.

Background information:

SQL Maestro Group offers complete database admin and management tools for
MySQL, Oracle, MS SQL Server, DB2, PostgreSQL, SQL Anywhere, SQLite,
Firebird and MaxDB providing the highest performance, scalability and
reliability to meet the requirements of today's database applications.

Sincerely yours,
The SQL Maestro Group Team
http://www.sqlmaestro.com

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Andrew Wood
Is there not just a function which will take the index of a column and 
return its declared type?

On 07/07/10 04:41, Jay A. Kreibich wrote:
> On Tue, Jul 06, 2010 at 11:27:09PM +0100, Andrew Wood scratched on the wall:
>
>> Ive been looking at the function
>>
>> sqlite3_column_decltype
>>
>> and am a little confused as to its use.
>>
>> How can I find out the declared type of a column.
>>  
>If you just want to know the declared type of a column you already
>know about, it use "PRAGMA table_info".
>
>http://www.sqlite.org/pragma.html
>
> -j
>
>

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] EXTERNAL: compile sqlite with Visual Studio 6

2010-07-07 Thread Black, Michael (IS)
Didn't we just answer this or similar?
 
Download the amalgamation and include sqlite3.c in your project.  You can put 
whatever switches you want on it.
 
http://www.sqlite.org/download.html
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of Andrea Galeazzi
Sent: Wed 7/7/2010 3:30 AM
To: General Discussion of SQLite Database
Subject: EXTERNAL:[sqlite] compile sqlite with Visual Studio 6



How can I compile sqlite with Visual Studio 6 with an equivalent option
of /fp:precise?

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2010-07-07 Thread Black, Michael (IS)
You don't need the lib -- you just need to include sqlite3.c as another source 
file in your project.  
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of smengl90
Sent: Tue 7/6/2010 5:09 PM
To: sqlite-users@sqlite.org
Subject: EXTERNAL:Re: [sqlite] EXTERNAL: setup sqlite in vc++




I found out that including the header file alone is not enough. I need to
link the sqlite lib to my project. But how can can I get the lib?



smengl90 wrote:
>
> Thanks for prompt replies. I did as you advised, and included the .h file
> as a source file and copied your code. But when I compiled it, I got these
> linking errors:
>
> 1>Linking...
> 1>TestSqlite.obj : error LNK2019: unresolved external symbol
> _sqlite3_close referenced in function _main
> 1>TestSqlite.obj : error LNK2019: unresolved external symbol _sqlite3_free
> referenced in function _main
> 1>TestSqlite.obj : error LNK2019: unresolved external symbol _sqlite3_exec
> referenced in function _main
> 1>TestSqlite.obj : error LNK2019: unresolved external symbol _sqlite3_open
> referenced in function _main
> 1>C:\Documents and Settings\My Documents\Visual Studio
> 2008\Projects\TestSqlite\Debug\TestSqlite.exe : fatal error LNK1120: 4
> unresolved externals
>
> Any ideas what I did wrong?
>
> Thanks
>
>
> Black, Michael (IS) wrote:
>>
>> You don't need C++ wrappers...just code in C.  There's lots more C
>> examples out there than C++.
>> 
>> Easiest way for me to integrate is to download the amalgamation and
>> include it as  a source file in your project.
>> 
>> The amalgamzation is at the top of the download page:
>> 
>> http://www.sqlite.org/download.html
>> 
>> Simple program for you to compile as C++ which I wrote from a question
>> somebody had on the list here.
>> 
>> #include 
>> #include 
>> #include "sqlite3.h"
>> int main()
>> {
>> sqlite3 *db;
>> char *errmsg=NULL;
>> int rc;
>> int i;
>> sqlite3_open("test.db",);
>> rc=sqlite3_exec(db, "CREATE TABLE log (id_client varchar, utc
>> number)",NULL,NULL,);
>> if (rc != SQLITE_OK) {
>> puts(errmsg);
>> sqlite3_free(errmsg);
>> }
>> sqlite3_exec(db,"BEGIN",NULL,NULL,);
>> for(i=0;i<10;i++) {
>>  int j=i*10;
>>  char sql[4096];
>>  sprintf(sql,"INSERT INTO log VALUES ('%d',%d)",i,j);
>>  rc=sqlite3_exec(db, sql,NULL,NULL,);
>>  if (rc != SQLITE_OK) {
>>  std::cout << errmsg << std::endl;
>>  sqlite3_free(errmsg);
>>  exit(-1);
>>  }
>> }
>> sqlite3_exec(db,"COMMIT",NULL,NULL,);
>> sqlite3_close(db);
>> return 0;
>> }
>>
>> 
>> Michael D. Black
>> Senior Scientist
>> Northrop Grumman Mission Systems
>> 
>>
>> 
>>
>> From: sqlite-users-boun...@sqlite.org on behalf of smengl90
>> Sent: Tue 7/6/2010 2:33 PM
>> To: sqlite-users@sqlite.org
>> Subject: EXTERNAL:[sqlite] setup sqlite in vc++
>>
>>
>>
>>
>> Hi guys,
>>
>> I am trying to setup sqlite to be used with VC++ 2008. Can someone show
>> me
>> where I can find instructions on how to set it up? and do I need a c++
>> wrapper to code in C++? If yes, can someone also show how to setup the
>> wrapper?
>>
>> Thanks
>> --
>> View this message in context:
>> http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p29086729.html
>> Sent from the SQLite mailing list archive at Nabble.com.
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>
>

--
View this message in context: 
http://old.nabble.com/setup-sqlite-in-vc%2B%2B-tp29086729p29090562.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
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-07 Thread Pavel Ivanov
> (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?)

You mean that pager should read several pages at once even if it
doesn't need them right now but it estimates that it will need them in
near future? Pager never does that. It reads pages one-by-one only at
the time it first needs them. So probably optimization is not that
much as you think it is. Of course I'm not taking into account
OS-level caching, though I don't know if it has any impact here.


Pavel

On Wed, Jul 7, 2010 at 5:03 AM, Igor Sereda  wrote:
>> It's never time to VACUUM a database.
>
> This is an interesting statement. In our application, all tables get
> heavily fragmented with time (99% or more). I was considering VACUUM
> as a means to defragment, and, presumably, improve search performance.
> Was I misguided, and search performance does not degrade significantly
> with the increased fragmentation of the DB?
>
> (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?)
>
> It would be great to see performance comparison, if anyone has ever did it.
>
> -- Igor
>
>
>
> On Wed, Jul 7, 2010 at 1:52 AM, Simon Slavin  wrote:
>>
>> On 6 Jul 2010, at 10:45pm, Kristoffer Danielsson wrote:
>>
>>> Q: How do I programmatically (through sqlite-APIs?) determine if it's time 
>>> to VACUUM a database?
>>
>> It's never time to VACUUM a database.  The VACUUM command is useful only if 
>> you have want to recover unused space from the database file.  So if your 
>> database file once took up 5 Meg, and you deleted a lot of data from it and 
>> it now takes up only 2 Meg, you could recover 3 Megabytes of disk space.  
>> But how useful is that 3 Megabytes of space to you ?  Are you going to use 
>> it for something really valuable ?  And how long will it be before you get 3 
>> Megabytes more data which will fill it up again ?
>>
>> If you're trying to get the database in shape to make copies, e.g. to burn 
>> it on a DVD or send it to customers, or put it on a device with limited 
>> space, then there might be some reason to use VACUUM.  If not, then it's 
>> just a waste of resources.
>>
>> Simon.
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
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-07 Thread Simon Slavin

On 7 Jul 2010, at 10:03am, Igor Sereda wrote:

>> It's never time to VACUUM a database.
> 
> This is an interesting statement. In our application, all tables get
> heavily fragmented with time (99% or more). I was considering VACUUM
> as a means to defragment, and, presumably, improve search performance.
> Was I misguided, and search performance does not degrade significantly
> with the increased fragmentation of the DB?
> 
> (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?)

You are asking the correct questions, but only you can provide the answers.  It 
depends on things like what proportion of pages are taken up with indexes, how 
'clumpy' your data is, etc..  And fragmentation has large effects on disks in 
some formats (e.g. NTFS) but almost none on disks in other formats (e.g. ext3). 
 I don't think it's possible to get any sort of 'standard answer' to that 
question which would help the 'standard SQLite user' who is using a 'standard 
schema'.

> It would be great to see performance comparison, if anyone has ever did it.

This mailing list tends to gather many examples of premature optimization.  The 
sort of computing we do contains so many different operations and subsystems 
that it's easy to pick one you know some techie detail about (for example, it's 
faster to read from the same sector twice) and work out how to optimize that in 
an ingenious way.  However, it turns out that that whole operation is only a 
very minor part of the entire load on the computers, and that the entire 
project runs fast and small enough that no optimization is really needed 
anyway.  You waste more time programming and debugging the optimization than 
you save by it.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] FTS3 snippet problem: function returns full document content

2010-07-07 Thread Alexey Pechnikov
For some documents snippet function returns full document content:

sqlite> select length(snippet(file_text)) from file_text where file_text
match 'переоформление договора' and rowid=1015;
42312

sqlite> select substr(snippet(file_text),1,500) from file_text where
file_text match 'переоформление договора' and rowid=1015;
..., ЗК, АР). Информацию о
━━━
Главная\ Обучаемся!\ Бланки заявлений
━━━

Заполнение регистрационной формы клиента (РФА)

[blanki_clip_image002]

  • Цифры в скобках, например, (1) – это сноски и указывать на РФА их не
нужно.

  • Все данные вносятся разборчиво, печатными буквами.

  • РФА – это документ, дописывать и исправлять на


-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
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-07 Thread Igor Sereda
My two cents, to complement other answers: leave it to the user. In
case of a client-side GUI app, let the user run some maintenance
action, like an OS has "defragment disk" action, or Outlook has
"compact folders" action. In case of a server-side app, make a script
or admin command to do that.

Hope this helps!
-- Igor



On Wed, Jul 7, 2010 at 1:45 AM, Kristoffer Danielsson
 wrote:
>
> I've been reading the documentation. I've been googling and thinking.
>
>
>
> Still, I can't figure out the best way to determine when to run the 
> VACUUM-command. Note that I do NOT want to enable "auto vacuum".
>
> I do remember reading something about calculating empty space, used pages etc 
> etc. Still, no perfect answer.
>
>
>
> Q: How do I programmatically (through sqlite-APIs?) determine if it's time to 
> VACUUM a database? In general, what is the best method here?
>
>
>
> Thanks!
>
> /Chris
>
> _
> Håll skräpposten borta med nya Hotmail. Klicka här!
> http://explore.live.com/windows-live-hotmail
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
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-07 Thread Igor Sereda
> It's never time to VACUUM a database.

This is an interesting statement. In our application, all tables get
heavily fragmented with time (99% or more). I was considering VACUUM
as a means to defragment, and, presumably, improve search performance.
Was I misguided, and search performance does not degrade significantly
with the increased fragmentation of the DB?

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

It would be great to see performance comparison, if anyone has ever did it.

-- Igor



On Wed, Jul 7, 2010 at 1:52 AM, Simon Slavin  wrote:
>
> On 6 Jul 2010, at 10:45pm, Kristoffer Danielsson wrote:
>
>> Q: How do I programmatically (through sqlite-APIs?) determine if it's time 
>> to VACUUM a database?
>
> It's never time to VACUUM a database.  The VACUUM command is useful only if 
> you have want to recover unused space from the database file.  So if your 
> database file once took up 5 Meg, and you deleted a lot of data from it and 
> it now takes up only 2 Meg, you could recover 3 Megabytes of disk space.  But 
> how useful is that 3 Megabytes of space to you ?  Are you going to use it for 
> something really valuable ?  And how long will it be before you get 3 
> Megabytes more data which will fill it up again ?
>
> If you're trying to get the database in shape to make copies, e.g. to burn it 
> on a DVD or send it to customers, or put it on a device with limited space, 
> then there might be some reason to use VACUUM.  If not, then it's just a 
> waste of resources.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] compile sqlite with Visual Studio 6

2010-07-07 Thread Andrea Galeazzi
How can I compile sqlite with Visual Studio 6 with an equivalent option 
of /fp:precise?

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users