Re: [sqlite] Need help understanding the basic of C++/sqlite

2010-01-22 Thread Raoul
Thanks all for your input. Thanks to your feedback I have been able to advance quite a long way in my studies... And yes my big problem is in fact understanding C++ (still in learning phase). 4) I will check if this option is avaialable too on the express edition. 5) I did try to install System.

[sqlite] Problem to trigger a FAIL on DELETE

2010-01-22 Thread Tiberio, Sylvain
Hi, Here is my database: CREATE TABLE room (roomIdINTEGER PRIMARY KEY, roomName TEXT); CREATE TABLE range(level INTEGER, roomIdMin INTEGER, roomIdMax INTEGER, CHECK (roomIdMin<=roomIdMax) ); CREATE TRIGGER room_i

Re: [sqlite] Problem to trigger a FAIL on DELETE

2010-01-22 Thread Simon Davies
2010/1/22 Tiberio, Sylvain : > Hi, > > Here is my database: > . . . > CREATE TRIGGER range_del BEFORE DELETE ON range FOR EACH ROW >  BEGIN >    SELECT RAISE(FAIL,'Room exist in this range') >    WHERE (SELECT count(*) >             FROM room >             WHERE room.roomId BETWEEN OLD.roomIdMin AN

[sqlite] Variable type and/or number of data in a row?

2010-01-22 Thread newlog
Hi , I'm planning to use SQLite as a replacement of an home made data storage file format. In the current home made format, I use keywords followed by strings or floats . The issue is that number and type of data vary from one keyword to the other: Example : Keyword-01Foo 12.007 Bar 24

[sqlite] sqlite3.6.21 compile errors on solaris 8

2010-01-22 Thread yuri.voloschenko
Can you please check if the following sqlite3.6.21 compile errors on solaris 8 would critically affect sqlite functionality (pls see the attached)? 1) "conftest.c", line 15: undefined symbol: choke "conftest.c", line 15: syntax error before or at: me . "conftest.cpp", line 26: Error: ch

[sqlite] lock database

2010-01-22 Thread Qianqian Fang
hi I wanna ask a naive question: are there commands to lock/unlock a database? I only found SQL LOCK command for tables. thanks Qianqian ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[sqlite] lock database

2010-01-22 Thread Qianqian Fang
hi I wanna ask a naive question: are there commands to lock/unlock a database? I only found SQL LOCK command for tables. thanks Qianqian ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Variable type and/or number of data in a row?

2010-01-22 Thread Pavel Ivanov
> So my question is : how to create a table in which rows (keywords) > could contain variable type and number of data ? You cannot create table containing variable number of data values - it contradicts relational data model. You can either create 2 tables - one containing keywords, another all va

Re: [sqlite] lock database

2010-01-22 Thread Pavel Ivanov
SQLite cannot lock/unlock tables. But by executing "BEGIN IMMEDIATE TRANSACTION"/"BEGIN EXCLUSIVE TRANSACTION" and "COMMIT"/"ROLLBACK" you can lock/unlock the database. Pavel On Fri, Jan 22, 2010 at 12:06 AM, Qianqian Fang wrote: > hi > > I wanna ask a naive question: are there commands to > lo

[sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Michael Thomason
I am doing mobile development, and the size of my application is getting too large for comfort. I'd like to find a way to reduce the file size, but maintain the performance. I have a database that is read only. It is ordered and each row is unique. It has only one table, which is significantly

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Martin Engelschalk
Hi, perhaps you could drop the primary key. The query you mentioned, SELECT count(*) FROM table WHERE column = '%q' does not utilize it, and if you do execute queries which do, do not update the db, and have no other tables, then the primary key serves no function. Martin Michael Thomason wrot

Re: [sqlite] Variable type and/or number of data in a row?

2010-01-22 Thread Jay A. Kreibich
On Thu, Jan 21, 2010 at 07:55:14AM -0800, newlog scratched on the wall: > Keyword-01Foo 12.007 Bar 24.9682 > Keyword-0264738 65535 12.12 3.1415 2.710.007 > Keyword-03SingleString > ... > > So my question is : how to create a table in which rows (keywords) > could contain

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Michael Thomason
Thank you. I like that answer and I'll give it a try. The application is a word game, and I have a dictionary of words. The user enters a word, and the application checks against that word to see if it exist. That's the only query ever used. Would the following be any better? SELECT rowid FRO

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread ve3meo
Uhh, sounds like a search function of a text editor or a simple routine you could write (or find) in your development language. I can't see the magic of using sqlite. Tom "Michael Thomason" wrote in message news:3cbb39411001220619j1c6cc8f5x46e0aeb4d0b91...@mail.gmail.com... Thank you. I lik

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Igor Tandetnik
Martin Engelschalk wrote: > perhaps you could drop the primary key. The query you mentioned, > SELECT count(*) FROM table WHERE column = '%q' > does not utilize it Does too. Primary key provides the index for the search. Without it, SQLite would do full table scan. Use EXPLAIN QUERY PLAN to convi

Re: [sqlite] Variable type and/or number of data in a row?

2010-01-22 Thread P Kishor
On Fri, Jan 22, 2010 at 8:19 AM, Jay A. Kreibich wrote: > On Thu, Jan 21, 2010 at 07:55:14AM -0800, newlog scratched on the wall: > > >> Keyword-01    Foo  12.007   Bar  24.9682 >> Keyword-02    64738 65535 12.12   3.1415   2.71    0.007 >> Keyword-03    SingleString >> ... >> >> So my question is

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Michael Thomason
> > Primary key provides the index for the search. Without it, SQLite would do > full table scan. Use EXPLAIN QUERY PLAN to convince yourself. I could use a binary search, but I worry about having a ten MB array in memory on a mobile device, though it should work fine. >Uhh, sounds like a search

Re: [sqlite] SQL Crash with sqlite 3.6.22 commandline

2010-01-22 Thread ve3meo
I just discovered that attachments can be sent through this newsgroup so I have attached a small database with which you should be able to reproduce the problem. The one table in it has a field collated RMNOCASE. The following query produces these results in three different versions of sqlite:

Re: [sqlite] SQL Crash with sqlite 3.6.22 commandline

2010-01-22 Thread Shane Harrelson
Can you verify that changes for ticket http://www.sqlite.org/src/info/1258875e07 checked-in yesterday resolve your issue? Thanks. -Shane On Fri, Jan 22, 2010 at 9:51 AM, ve3meo wrote: > I just discovered that attachments can be sent through this newsgroup so I > have attached a small database w

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Max Vlasov
> Maybe I'll try a binary search, or something else along those lines. > You can mix binary search with sqlite as a storar. The idea is to place your words ordered by text and use rowid as indexes. So after creating a new table CREATE TABLE Table2 AS SELECT * FROM Table ORDER BY Text you now ca

Re: [sqlite] SQL Crash with sqlite 3.6.22 commandline

2010-01-22 Thread Hub Dog
I can confirm that the crash problem has been fixed by http://www.sqlite.org/src/info/1258875e07 checked-in . Now executing following sql will report no such collation sequence: RMNOCASE instead of crash. SELECT Surname || ', ' || Given COLLATE NOCASE AS Person , Adr.Name COLLATE NOCASE AS Add

[sqlite] Possible memory-leaks in shell / FTS3

2010-01-22 Thread WClark
Hi, I've spotted a very few places where the use of realloc or sqlite3_realloc *may* constitute memory leaks if the realloc fails. Hope this helps; please ignore if I've misread the code... Line numbers should correlate to version 3.6.22, but I've included the name of the function the line is

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Simon Slavin
On 22 Jan 2010, at 2:19pm, Michael Thomason wrote: > Thank you. I like that answer and I'll give it a try. > > The application is a word game, and I have a dictionary of words. The > user enters a word, and the application checks against that word to > see if it exist. That's the only query e

Re: [sqlite] Possible memory-leaks in shell / FTS3

2010-01-22 Thread Dan Kennedy
On Jan 22, 2010, at 10:21 PM, wcl...@gfs-hofheim.de wrote: > Hi, > > I've spotted a very few places where the use of realloc or > sqlite3_realloc > *may* constitute memory leaks if the realloc fails. Hope this helps; > please ignore if I've misread the code... > > Line numbers should correlate

[sqlite] grabbing row contents?

2010-01-22 Thread gary clark
Hiya, Got a quick question. I perform the following on a table: select * from table How do I know when the select has completed all its transactions? sqlite3_exec(db,query.c_str(),callback, this, &db_err); I'm using the above statement,the callback is getting called as expected. Thanks, gary

Re: [sqlite] grabbing row contents?

2010-01-22 Thread Jay A. Kreibich
On Fri, Jan 22, 2010 at 07:57:50AM -0800, gary clark scratched on the wall: > > Hiya, > > Got a quick question. I perform the following on a table: > > select * from table > > How do I know when the select has completed all its transactions? > > sqlite3_exec(db,query.c_str(),callback, this, &d

Re: [sqlite] grabbing row contents?

2010-01-22 Thread gary clark
Oh boy. Thanks. --- On Fri, 1/22/10, Jay A. Kreibich wrote: > From: Jay A. Kreibich > Subject: Re: [sqlite] grabbing row contents? > To: "General Discussion of SQLite Database" > Date: Friday, January 22, 2010, 10:01 AM > On Fri, Jan 22, 2010 at 07:57:50AM > -0800, gary clark scratched on the

[sqlite] famous "constraint failed" error

2010-01-22 Thread Jan Bilek
Hello, I've got a setup, where one process/thread writes data (multiple inserts in one transaction ) to db and other which reads data (one select) from db. These two threads use their own db connections. When "write" thread and "read" thread access the database at the same time, then processing

Re: [sqlite] famous "constraint failed" error

2010-01-22 Thread Pavel Ivanov
> Does any sqlite MVP know what could be beyond this strange > error message. Exactly what message says: you tried to insert data that is not allowed by constraints in the table. "Read"/"write" threads construct doesn't have anything to do with that - everything can be reproduced in one "write" th

Re: [sqlite] grabbing row contents?

2010-01-22 Thread Shane Harrelson
Instead of using sqlite3_exec() and a callback, use sqlite3_prepare_v2() on your statement and then run it with sqlite3_step() in a loop (there will be one iteration be row of the result set). sqlite3_step() will return something other than SQLITE_ROW when it's done. When it returns SQLITE_ROW,

Re: [sqlite] famous "constraint failed" error

2010-01-22 Thread cmartin
On Fri, 22 Jan 2010, Jan Bilek wrote: > processing > of write transaction fails with strange "constraint failed" error (no. 19). > I've tried to search the web for any solution, but i haven't found > anything. While a web search can be useful, it is often more useful to go straight to the releva

Re: [sqlite] famous "constraint failed" error

2010-01-22 Thread Jan Bilek
OK. Let's assume that my db design is buggy (messed up foreign keys or something). Could you then explain why i receive "constraint failed" error ONLY when any select query is in progress? No select in progress = no error. Thanks for reply. Jan cmar...@unc.edu wrote: > On Fri, 22 Jan 2010, J

Re: [sqlite] SQL Crash with sqlite 3.6.22 commandline

2010-01-22 Thread ve3meo
That's great! I'm an end-user and cannot compile it to check myself. Thanks to shane, drh, Hub Dog for the rapid fix. I will have to dig around to figure out how/when that shows up in a release. That leaves the question about the change of syntax between 3.5.4 and 3.6.17. In the earlier it was

Re: [sqlite] famous "constraint failed" error

2010-01-22 Thread Jan Bilek
But why it only happens when any concurrent select query is in progress? Thanks for any response. Jan Pavel Ivanov wrote: >> Does any sqlite MVP know what could be beyond this strange >> error message. >> > > Exactly what message says: you tried to insert data that is not > allowed by cons

Re: [sqlite] Sqlite3 Optimization Question

2010-01-22 Thread Michael Thomason
>> Maybe I'll try a binary search, or something else along those lines. >> > > You can mix binary search with sqlite as a storar. The idea is to place your > words ordered by text and use rowid as indexes. > I tried this, and it works surprisingly well. I'm also going to try a straight binary sea

Re: [sqlite] famous "constraint failed" error

2010-01-22 Thread Pavel Ivanov
> But why it only happens when any concurrent select query is in progress? Probably you don't tell us all necessary information about your set up (or maybe you don't know it yourself) because concurrent select cannot cause this kind of error in any way. It can cause only SQLITE_BUSY error. Are you