Re: [sqlite] WAL journal size grow unlimited

2010-07-06 Thread 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)))}" ... $ 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:

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Jay A. Kreibich
On Tue, Jul 06, 2010 at 09:45:50PM -0400, Pavel Ivanov scratched on the wall: > Leading zeros in the number can never be significant, While that's true for SQL values, it isn't true in the general case. C programmers and old-school UNIX folks tend to get very nervous about leading zeros. C

Re: [sqlite] column types (was Re: Numbers as CHARs)

2010-07-06 Thread Jay A. Kreibich
On Tue, Jul 06, 2010 at 05:15:46PM -0700, Darren Duncan scratched on the wall: > Simon Slavin wrote: > > SQLite has types. It just doesn't require every value in the same > > column to be of the same type. > > Or to put it another way, every SQLite column *does* have a type, Not really. SQLit

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

2010-07-06 Thread Jay A. Kreibich
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

Re: [sqlite] Import all tables from one db file to another

2010-07-06 Thread Jay A. Kreibich
On Tue, Jul 06, 2010 at 04:42:05PM -0500, Peng Yu scratched on the wall: > I could create tables in database B to select all the data from > database A and insert them in B. I don't find any simpler way to copy > all tables from A to B. But I may miss something. > > I'm wondering if there is a ver

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

2010-07-06 Thread Jay A. Kreibich
On Tue, Jul 06, 2010 at 11:45:18PM +0200, Kristoffer Danielsson scratched on the wall: > > 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 vac

Re: [sqlite] WAL journal size grow unlimited

2010-07-06 Thread 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

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Pavel Ivanov
> So, because type VLADIVOSTOK is not recognized, sqlite tries to > convert any value entered, even if it is delimited with single quotes, > to something recognizable. I guess it starts with INT, and since it is > able to convert '043000205563' to integer, that is what it does. In > the case of 'fo

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread P Kishor
On Tue, Jul 6, 2010 at 8:45 PM, Pavel Ivanov wrote: >>> The receiving field is defined as CHAR; [snip] >> SQLite has no such type.  Define the fields as TEXT instead: > > Simon, please don't confuse poor users. SQLite will work perfectly and > indistinguishably well with both CHAR and TEXT. Please

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

2010-07-06 Thread Pavel Ivanov
> 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? Just include sqlite3.c file into your project as a source and that's it, VC++ will take care of compiling it and linking it into your binary. Pavel On

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Pavel Ivanov
>> The receiving field is defined as CHAR; [snip] > SQLite has no such type.  Define the fields as TEXT instead: Simon, please don't confuse poor users. SQLite will work perfectly and indistinguishably well with both CHAR and TEXT. Please read the link you gave more carefully (hint: bullet number

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Ted Rolle, Jr.
On Tue, 6 Jul 2010 17:13:44 -0500 P Kishor wrote: > sqlite> CREATE TABLE UPCs (UPC TEXT); > sqlite> INSERT INTO UPCs VALUES ('043000205563'); > sqlite> SELECT * FROM UPCs; > UPC > > 043000205563 > sqlite> I did as you said with sqlite and it worked perfectly. Thank you. This is pr

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

2010-07-06 Thread Mohd Radzi Ibrahim
Hi, You could also use another open source layer for SQLite3, wxSQLite3 project on sourceforge. It's uses wxWidgets cross-platform C++ toolkit. best regards, Radzi. On 7-Jul-2010, at 6:09 AM, smengl90 wrote: > > I found out that including the header file alone is not enough. I need to > link

[sqlite] column types (was Re: Numbers as CHARs)

2010-07-06 Thread Darren Duncan
Simon Slavin wrote: > SQLite has types. It just doesn't require every value in the same column to > be of the same type. Or to put it another way, every SQLite column *does* have a type, but in the general case that type is a generic or union type whose domain encompasses the domains of the nu

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

2010-07-06 Thread Igor Tandetnik
Andrew Wood wrote: > 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. > > As I understand this function, I would have to do a single col select first Not necessarily a single-column o

Re: [sqlite] WAL journal size grow unlimited

2010-07-06 Thread Richard Hipp
2010/7/6 Alexey Pechnikov > > My test script > http://mobigroup.ru/files/test.tcl > When I run this script it immediately crashes with "no such table: view_role" > > -- > Best regards, Alexey Pechnikov. > http://pechnikov.tel/ > ___ > sqlite-users

[sqlite] Getting declared datatype of a column in C

2010-07-06 Thread Andrew Wood
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. As I understand this function, I would have to do a single col select first, (select col1 from table) then pass that prepared statement to ? sqli

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

2010-07-06 Thread Gerry Snyder
On 7/6/2010 2:58 PM, Kristoffer Danielsson wrote: > What you are saying makes sense. Thanks for your advice! > > > > However, I do believe there are times when vacuuming would be beneficial. For > instance, if a database for software X is detected to have 90% unused space > for a couple of weeks,

Re: [sqlite] Import all tables from one db file to another

2010-07-06 Thread Peng Yu
On Tue, Jul 6, 2010 at 4:45 PM, Simon Slavin wrote: > > On 6 Jul 2010, at 10:42pm, Peng Yu wrote: > >> I could create tables in database B to select all the data from >> database A and insert them in B. I don't find any simpler way to copy >> all tables from A to B. But I may miss something. >> >>

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Simon Slavin
On 6 Jul 2010, at 11:10pm, Ted Rolle, Jr. wrote: > The receiving field is defined as CHAR; [snip] SQLite has no such type. Define the fields as TEXT instead: Then try 'UPDATE UPCs SET UPC=043000205563;' and see what you get. > Last question: is this an

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread P Kishor
On Tue, Jul 6, 2010 at 5:10 PM, Ted Rolle, Jr. wrote: > I, (or more to the point, SQLite) can't seem to retain leading zeros > on numbers. > > The receiving field is defined as CHAR; > I'm using the SQLite Manager in Firefox. > I've also tried sqlite3 from the command line. > Here's a typical (and

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

2010-07-06 Thread Jean-Christophe Deschamps
>I'm aware that SQLite offers the functionality of in-memory databases, >but I >don't know how to read the data and send it over the wire to the server or >how to push the data into the in-memory database of the server. The backup API included in SQLite offers the facility to backup/restore (in

[sqlite] Numbers as CHARs.

2010-07-06 Thread Ted Rolle, Jr.
I, (or more to the point, SQLite) can't seem to retain leading zeros on numbers. The receiving field is defined as CHAR; I'm using the SQLite Manager in Firefox. I've also tried sqlite3 from the command line. Here's a typical (and minimal) statement: UPDATE UPCs SET UPC=043000205563; UPDATE UPCs S

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

2010-07-06 Thread Matthew L. Creech
On Tue, Jul 6, 2010 at 5:58 PM, Kristoffer Danielsson wrote: > > However, I do believe there are times when vacuuming would be beneficial. For > instance, if a database for software X is detected to have 90% unused space > for a couple of weeks, then why bloat the harddrive? (I don't know how to

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

2010-07-06 Thread smengl90
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 compile

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

2010-07-06 Thread Kristoffer Danielsson
What you are saying makes sense. Thanks for your advice! However, I do believe there are times when vacuuming would be beneficial. For instance, if a database for software X is detected to have 90% unused space for a couple of weeks, then why bloat the harddrive? (I don't know how to do that

Re: [sqlite] WAL journal size grow unlimited

2010-07-06 Thread Alexey Pechnikov
There is only single process: $ fuser test.db test.db: 3326 $ ps aux|grep 3326|grep -v grep veter 3326 55.9 3.3 309892 278832 pts/1 Dl+ 01:19 17:11 /usr/bin/tclsh8.5 ./test.tcl And I see now: $ ls -lh итого 3,9G -rw-r--r-- 1 veter veter 3,1G Июл 7 01:50 test.db -rw-r--r-- 1

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

2010-07-06 Thread Simon Slavin
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.

Re: [sqlite] Import all tables from one db file to another

2010-07-06 Thread Simon Slavin
On 6 Jul 2010, at 10:42pm, Peng Yu wrote: > I could create tables in database B to select all the data from > database A and insert them in B. I don't find any simpler way to copy > all tables from A to B. But I may miss something. > > I'm wondering if there is a very simple single command that

[sqlite] How to determine when to VACUUM?

2010-07-06 Thread Kristoffer Danielsson
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

[sqlite] Import all tables from one db file to another

2010-07-06 Thread Peng Yu
I could create tables in database B to select all the data from database A and insert them in B. I don't find any simpler way to copy all tables from A to B. But I may miss something. I'm wondering if there is a very simple single command that can just copy all the tables from database A to databa

Re: [sqlite] WAL journal size grow unlimited

2010-07-06 Thread Richard Hipp
A busy read transaction holds the WAL open and prevent is from being reset. If you find that your WAL is growing without bound, this suggests that you have an unfinalized query hanging around someplace, perhaps in a separate hung process. 2010/7/6 Alexey Pechnikov > $ ls -lh > -rw-r--r-- 1 veter

[sqlite] How to show all the commands that are executed?

2010-07-06 Thread Peng Yu
Hi, It seems that .echo on shows certain commands but not all. For example, 'create table' command is not shown. Is there a command to show all the commands that are executed? $ cat ./main.sql #!/usr/bin/env bash rm -f main.db sqlite3 main.db

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

2010-07-06 Thread smengl90
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.o

[sqlite] WAL journal size grow unlimited

2010-07-06 Thread Alexey Pechnikov
$ ls -lh -rw-r--r-- 1 veter veter 700M Июл 7 00:55 test.db -rw-r--r-- 1 veter veter 192K Июл 7 00:55 test.db-shm -rw-r--r-- 1 veter veter 186M Июл 7 00:55 test.db-wal -rwxr-xr-x 1 veter veter 3,0K Июл 7 00:47 test.tcl $ sqlite3 test.db 'pragma page_size' 8192 $ sqlite3 test.db 'PRAGMA wal_autoc

Re: [sqlite] setup sqlite in vc++

2010-07-06 Thread Sam Carleton
On Tue, Jul 6, 2010 at 3:33 PM, smengl90 < fixed-term.seak.meng...@us.bosch.com> wrote: > > 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

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

2010-07-06 Thread Black, Michael (IS)
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/downl

[sqlite] setup sqlite in vc++

2010-07-06 Thread smengl90
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.c

Re: [sqlite] WAL - Performance/fsync

2010-07-06 Thread Martin Knafve
>> You're right - what I meant was "explicit transaction". I know that you >> can speed up things by placing everything in a large transaction, but in >> my software these kinds of bulk INSERT operations are very rare. (In my >> case, they would only be made during a BACKUP/RESTORE process). > > I

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

2010-07-06 Thread Black, Michael (IS)
When you say "send it" do you mean you can mount the server file system? If so, just attach a database table on the server and copy your database over to it. The server can then copy it into memory. You just need some sort of notification method (like a table with a boolean) to show who has c

[sqlite] Reg: In Memory Database Using SQLite

2010-07-06 Thread Subhadeep Ghosh
Hello People, I was creating a server and a corresponding client application, in which the I'm using SQLite for both the client and the server. The tricky part in this setup is that the client is not required to store the database file with itself, but it fetches it from the server, does whatever

Re: [sqlite] WAL - Performance/fsync

2010-07-06 Thread Simon Slavin
On 6 Jul 2010, at 6:46pm, Martin Knafve wrote: > You're right - what I meant was "explicit transaction". I know that you > can speed up things by placing everything in a large transaction, but in > my software these kinds of bulk INSERT operations are very rare. (In my > case, they would only be

Re: [sqlite] WAL - Performance/fsync

2010-07-06 Thread Martin Knafve
> > On 6 Jul 2010, at 6:05pm, Martin Knafve wrote: > >> On my PC, INSERT's with fsync disabled >> is ~50 times faster than when fsync is used, so I would expect enabling >> WAL to give me at least a 500% speedup. Of course, my assumptions are >> very >> rough and I understand that I'm likely far of

Re: [sqlite] WAL - Performance/fsync

2010-07-06 Thread Martin Knafve
> On Tue, Jul 6, 2010 at 1:05 PM, Martin Knafve > wrote: > >> Hi, >> >> I'm considering using SQLite as backend for my software. What's stopping >> me is the low insert-performance. If I disable fsync/FlushFileBuffers, >> performance is good but I can't do with the risk of database corruption. >> >

Re: [sqlite] WAL - Performance/fsync

2010-07-06 Thread Richard Hipp
On Tue, Jul 6, 2010 at 1:05 PM, Martin Knafve wrote: > Hi, > > I'm considering using SQLite as backend for my software. What's stopping > me is the low insert-performance. If I disable fsync/FlushFileBuffers, > performance is good but I can't do with the risk of database corruption. > > I don't kn

Re: [sqlite] WAL - Performance/fsync

2010-07-06 Thread Simon Slavin
On 6 Jul 2010, at 6:05pm, Martin Knafve wrote: > On my PC, INSERT's with fsync disabled > is ~50 times faster than when fsync is used, so I would expect enabling > WAL to give me at least a 500% speedup. Of course, my assumptions are very > rough and I understand that I'm likely far off. > > Am

Re: [sqlite] EXTERNAL: WAL - Performance/fsync

2010-07-06 Thread Black, Michael (IS)
You'll find a LARGE performance improvement if you wrap your inserts inside a BEGIN/COMMIT and only commit every 1000 or so inserts or such. BEGIN for all records INSERT count++ if ((count % 1000)==0) COMMIT;BEGIN // commit and begin again end COMMIT Michael D. Black Senior Scient

[sqlite] WAL - Performance/fsync

2010-07-06 Thread Martin Knafve
Hi, I'm considering using SQLite as backend for my software. What's stopping me is the low insert-performance. If I disable fsync/FlushFileBuffers, performance is good but I can't do with the risk of database corruption. I don't know the details of the WAL-implementation in 3.7, but if fsync/Flus

[sqlite] Slow FTS3 query for time strings (like to "19:10:59")

2010-07-06 Thread Alexey Pechnikov
sqlite> .schema role CREATE VIRTUAL TABLE role USING fts3(uuid TEXT, uid INTEGER, dt TEXT, ts INTEGER, fields, tasks, TOKENIZE icu ru_RU); Fast queries: sqlite> select count(*) from role where role match '1278429059'; count(*) 471 CPU Time: user 0.00 sys 0.00 sqlite> select count(*) from

Re: [sqlite] "use database" in sqlite3?

2010-07-06 Thread Pavel Ivanov
> Is there a command > similar to 'use database' (mysql) in sqlite3 so that I can make a > particular database as default? (I don't find such command, but please > let me know in case if I miss anything.) Yes. It is sqlite3_open() in C API. And if you use command line utility then you should pass

Re: [sqlite] Use of sqlite3_step()

2010-07-06 Thread Andrew Wood
Whoops thats what comes of writing code when you're feeling under weather :) Thanks On 06/07/10 16:43, Mike Shal wrote: > > I haven't tried it, but I suspect this is your problem. It looks like > you're declaring a new 'queryreturn' int, but the while loop is > checking against the one from the t

Re: [sqlite] "use database" in sqlite3?

2010-07-06 Thread P Kishor
On Tue, Jul 6, 2010 at 11:00 AM, Peng Yu wrote: > Hi, > > I can attach a database to the current session. But I have to > explicitly specify the table name to refer to any tables in it (such > 'create_index' in 'create_index.sqlite_master'). Is there a command > similar to 'use database' (mysql) i

[sqlite] "use database" in sqlite3?

2010-07-06 Thread Peng Yu
Hi, I can attach a database to the current session. But I have to explicitly specify the table name to refer to any tables in it (such 'create_index' in 'create_index.sqlite_master'). Is there a command similar to 'use database' (mysql) in sqlite3 so that I can make a particular database as defaul

Re: [sqlite] Use of sqlite3_step()

2010-07-06 Thread Sam Carleton
I use a bit simpler approach, don't know if it is correct or not, but it seems to work: int rc = sqlite3_step(stmt); while(rc == SQLITE_ROW) { /* read the row info */ rc = sqlite3_step(stmt); } if( rc != SQLITE_DONE) { /* handle error */ } ___

Re: [sqlite] Use of sqlite3_step()

2010-07-06 Thread Mike Shal
On 7/6/10, Andrew Wood wrote: > Whats the procedure for using sqlite3_step? > > I thought it would be along the lines of the following, but the while > loop executes infinately. I would have expected the while loop to run > once for each row found? > > Code is as follows: > > int queryreturn

[sqlite] Use of sqlite3_step()

2010-07-06 Thread Andrew Wood
Whats the procedure for using sqlite3_step? I thought it would be along the lines of the following, but the while loop executes infinately. I would have expected the while loop to run once for each row found? Code is as follows: int queryreturn = sqlite3_step(preparedstatement); if (queryretu

[sqlite] Bug: #if SQLITE_HAS_CODEC warning

2010-07-06 Thread Dair Grant
Hi, 3.6.23.1's amalgamated sqlite.h include a prototype for sqlite3_key() if SQLITE_HAS_CODEC is defined. This test is currently done with "#if SQLITE_HAS_CODEC", which triggers a warning from gcc -Wundef if this macro isn't declared via a precompiled header/command line flag/etc. Most of the o

[sqlite] Please beta-test SQLite 3.7.0

2010-07-06 Thread D. Richard Hipp
We have scheduled the release of SQLite version 3.7.0 for Thursday, 2010-07-15. That date could yet change, but 2010-07-15 is our target. SQLite version 3.7.0 will feature the addition of a write-ahead log (WAL) capability for transaction control. See http://www.sqlite.org/draft/wal.html

Re: [sqlite] problem with auto boot

2010-07-06 Thread Simon Slavin
On 6 Jul 2010, at 1:06pm, Daniel wrote: > Am 06.07.2010 13:28, schrieb Simon Slavin: >> >> >> It is probably trying to access a file in a folder it has no rights to. >> Perhaps the root folder of the boot drive. > > That was also my intention, so I copied the whole folder to my data > parti

Re: [sqlite] problem with auto boot

2010-07-06 Thread Daniel
Am 06.07.2010 13:28, schrieb Simon Slavin: > On 6 Jul 2010, at 10:36am, Daniel wrote: > > >> so now I used the full path to my database and it works fine. Thanks >> everyone for your help. >> To run on auto boot the program needed to have the full reference to the >> database otherwise it will

Re: [sqlite] problem with auto boot

2010-07-06 Thread Simon Slavin
On 6 Jul 2010, at 10:36am, Daniel wrote: > so now I used the full path to my database and it works fine. Thanks > everyone for your help. > To run on auto boot the program needed to have the full reference to the > database otherwise it will return an exception. It is probably trying to access

Re: [sqlite] problem with auto boot

2010-07-06 Thread Daniel
Hi, so now I used the full path to my database and it works fine. Thanks everyone for your help. To run on auto boot the program needed to have the full reference to the database otherwise it will return an exception. best regards Daniel ___ sqlite-us

Re: [sqlite] problem with auto boot

2010-07-06 Thread Daniel
Hi All, I tried a lot but no success. The Error message said following: /System.TypeInitializationException: Der Typeninitialisierer für "Sunbird_info.Event" hat eine Ausnahme verursacht. ---> System.Data.SQLite.SQLiteException: Unable to open the database file bei System.Data.SQLite.SQLite