[sqlite] Re: Re: Re: Re: Index usage with LIKE queries

2007-09-12 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: explain query plan select * from test where rowid in (select rowid from test where name like "b%" union all select rowid from test where email like "b%"); 0|0|TABLE test USING PRIMARY KEY 0|0|TABLE test WITH INDEX test_name 0|0|TABLE test WITH INDEX test_email But why

Re[2]: [sqlite] Index usage with LIKE queries

2007-09-12 Thread ser-ega
dc> If you are building an email indexing system, you problem dc> want to use Full Text Search with fts3, not the LIKE dc> operator. See dc>http://www.sqlite.org/cvstrac/wiki?p=FullTextIndex Thanks, interesting, but seems it's not my case, cause I'm doing search by partial name/email

Re: [sqlite] Re: Re: Re: Index usage with LIKE queries

2007-09-12 Thread ser-ega
IT> Try IT> IT> select * from test where rowid in IT> (select rowid from test where name like 'value' IT> union all IT> select rowid from test where email like 'value'); That seems to work... explain query plan select * from test where rowid in (select rowid from test where name like "b%"

Re: [sqlite] Compiling/installing extension-functions on Mac OS X

2007-09-12 Thread Liam Healy
I'm not an OSX expert but I do know the flags need to be different for gcc gcc -Isqlite -Isqlite/src -dynamiclib func_ext.c map.c -o libsqlitefunctions.so might work better. Liam On 9/12/07, Jared Haworth <[EMAIL PROTECTED]> wrote: > > Hi, > > Has anyone successfully compiled and installed

Re: [sqlite] Index usage with LIKE queries

2007-09-12 Thread drh
<[EMAIL PROTECTED]> wrote: > I thought I can create two separate indexes: on name and on email, > and when I execute a query with "name LIKE 'value' OR email > LIKE 'value'" both indexes would be used. > If you are building an email indexing system, you problem want to use Full Text Search with

[sqlite] Re: Re: Re: Index usage with LIKE queries

2007-09-12 Thread Igor Tandetnik
Griggs, Donald <[EMAIL PROTECTED]> wrote: Regarding: "I thought I can create two separate indexes" I believe sqlite can use at most *one* index per table in a select. However, you can create *compound* indicies (though all the restrictions pointed to by Dr. H still apply) Compound indexes

[sqlite] Re: Re: Re: Index usage with LIKE queries

2007-09-12 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: I get the index for LIKE working by specifying COLLATE in the CREATE TABLE: CREATE TABLE test (name STRING COLLATE NOCASE), but... Besides, your statement uses OR in the WHERE clause. An index can't be used for such query even if you had plain old equality test in

RE: [sqlite] Re: Re: Index usage with LIKE queries

2007-09-12 Thread Griggs, Donald
Regarding: "I thought I can create two separate indexes" I believe sqlite can use at most *one* index per table in a select. However, you can create *compound* indicies (though all the restrictions pointed to by Dr. H still apply) http://www.sqlite.org/optoverview.html#like_opt This

Re: [sqlite] Re: Re: Index usage with LIKE queries

2007-09-12 Thread ser-ega
I get the index for LIKE working by specifying COLLATE in the CREATE TABLE: CREATE TABLE test (name STRING COLLATE NOCASE), but... IT> Besides, your statement uses OR in the WHERE clause. An index can't be IT> used for such query even if you had plain old equality test in place of IT> LIKE.

[sqlite] Compiling/installing extension-functions on Mac OS X

2007-09-12 Thread Jared Haworth
Hi, Has anyone successfully compiled and installed Liam's extension- functions (for math-based operations) in Mac OS? I'm using Tiger (10.4.10) and I can't seem to get it to work properly. I'm thrown a variety of errors relating to creating a shared library. Any tips are appreciated!

[sqlite] Re: Re: Index usage with LIKE queries

2007-09-12 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: LIKE is case-insensitive by default. To have it use your index, you need to either make the index case-insensitive: Thanks! It's clear now. What's the point of using LIKE if you don't have any wildcards in the pattern? Actually I do have wildcards, this was just a

[sqlite] Re: Index usage with LIKE queries

2007-09-12 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: <[EMAIL PROTECTED]> wrote: LIKE is case-insensitive by default. To have it use your index, you need to either make the index case-insensitive: CREATE INDEX test_name ON test (name COLLATE NOCASE); Sorry, tried to create the index this way, but it still isn't used by

Re: [sqlite] Index usage with LIKE queries

2007-09-12 Thread drh
<[EMAIL PROTECTED]> wrote: > IT> LIKE is case-insensitive by default. To have it use your index, you need > IT> to either make the index case-insensitive: > IT> > IT> CREATE INDEX test_name ON test (name COLLATE NOCASE); > > Sorry, tried to create the index this way, but it > still isn't used

Re: [sqlite] Re: Index usage with LIKE queries

2007-09-12 Thread ser-ega
IT> LIKE is case-insensitive by default. To have it use your index, you need IT> to either make the index case-insensitive: IT> IT> CREATE INDEX test_name ON test (name COLLATE NOCASE); Sorry, tried to create the index this way, but it still isn't used by the query. telega)

Re: [sqlite] Re: Index usage with LIKE queries

2007-09-12 Thread ser-ega
IT> LIKE is case-insensitive by default. To have it use your index, you need IT> to either make the index case-insensitive: Thanks! It's clear now. IT> What's the point of using LIKE if you don't have any wildcards in the IT> pattern? Actually I do have wildcards, this was just a test, my

[sqlite] Re: Index usage with LIKE queries

2007-09-12 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: I'm trying to get index used with LIKE queries: CREATE TABLE test (name STRING); CREATE INDEX test_name ON test (name); LIKE is case-insensitive by default. To have it use your index, you need to either make the index case-insensitive: CREATE INDEX test_name ON test

[sqlite] Index usage with LIKE queries

2007-09-12 Thread ser-ega
Hi I'm trying to get index used with LIKE queries: CREATE TABLE test (name STRING); CREATE INDEX test_name ON test (name); EXPLAIN QUERY PLAN SELECT * FROM test WHERE name = 'aaa'; The output is: 0|0|TABLE test WITH INDEX test_name i.e. when LIKE is not used, the index is involved, everything is

RE: [sqlite] Re: Problem flushing double

2007-09-12 Thread Griggs, Donald
Regarding: "Yes, but shouldn't I avoid the representation problem..." I can envision a sign over the entrance to floating point computer numbers saying, "ABANDON ALL HOPE OF EQUALITY TESTS, ALL YE WHO ENTER HERE." I think that even casting a value as floating point means that you're willing

Re: [sqlite] Re: Problem flushing double

2007-09-12 Thread Stéphane Thiers
Yes, but shouldn't I avoid the representation problem if the string I use to build my INSERT command is obtained through double writtendouble=atof("0.1234567890123456"); stream << "'" << writtendouble << "'" // stream is a string stream whose precision is set to 30 By doing this way,

Re: [sqlite] Re: multi column select

2007-09-12 Thread RaghavendraK 70574
Thank u. ** This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained

[sqlite] Problem flushing double

2007-09-12 Thread Stéphane Thiers
Hello, If you do: INSERT INTO myTable VALUES('0.12345678901234559') // the column is of REAL type and read back the value SELECT * FROM myTable then you get a value==0.12345678901234600 !! the 2 values are different. What's the problem?? Stéphane Thiers Data Systems, Lancelot

[sqlite] Re: multi column select

2007-09-12 Thread Igor Tandetnik
RaghavendraK 70574 <[EMAIL PROTECTED]> wrote: Can anyone explain how does the below sql statmenent work, select * from tbl1 where a=xx and b=yy; when a is indexed and b is indexed seperately? The query can only use an index on one of the fields (the optimizer will try to guess which one).

[sqlite] Converting sqlite2 to sqlite3

2007-09-12 Thread Bernie Cosell
I'm just restarting a long dormant project that uses SQLite [also converting it from being CGI-driven to being a self-contained Perl/Tk app]. I've discovered that my old database, which is likely sqlite2, won't open in the world of sqlite3 [duh!!]. I looked through the wiki and around the

[sqlite] passing variable in statement

2007-09-12 Thread nishit sharma
Hi All, i have taken a variable as int a= 2000; and i m passing this variable in statement as sqlite3_exec(database, select < some column names > from < databasename > where ( X > '" a "')" but i m getting parse error before a. is this the right sequence to follow or there is another thing

Re: [sqlite] sqlite in memory

2007-09-12 Thread Kees Nuyt
Hi Alex, On Wed, 12 Sep 2007 12:19:44 +0200, you wrote: > I have 3 questions regarding sqlite database loaded/used whilst in memory: > > 1. How can an sqlite database file (example file1.db) be >loaded in memory? > (Is this the answer?: > sqlite3.exe file1.db) sqlite3 file1.db .dump |

[sqlite] multi column select

2007-09-12 Thread RaghavendraK 70574
Hi, Can anyone explain how does the below sql statmenent work, select * from tbl1 where a=xx and b=yy; when a is indexed and b is indexed seperately? I tried explain could not make out. Does it select all records with t=111 and then do a search for b=222 with in that set or other way? >From

[sqlite] sqlite in memory

2007-09-12 Thread Alex Tabone
Hi, I have 3 questions regarding sqlite database loaded/used whilst in memory: 1. How can an sqlite database file (example file1.db) be loaded in memory? (Is this the answer?: > sqlite3.exe file1.db) 2. How can the in-memory sqlite database be accessed by multiple applications? 3. Can multiple

RE: [sqlite] Re: data base locked problem

2007-09-12 Thread McDermott, Andrew
> "Igor Tandetnik" <[EMAIL PROTECTED]> schrieb am 11.09.2007 13:40:30: > > > > Armin Steinhoff wrote: > > > if we are try to create a new data base with sqlite we see the > > > following error outputs: > > > > > > # sqlite x.db > > > OPEN3 /appl/sbin/x.db > > > OPEN-EX 4

Re: [sqlite] Error in SQLITE on applyNumericAffinity

2007-09-12 Thread Trevor Talbot
On 9/12/07, Stéphane Thiers <[EMAIL PROTECTED]> wrote: > I got this stack error in SQLITE when executing the following request: I assume there's an exception that goes with this; what is it? > "INSERT INTO _scalars_float > VALUES(237,220,'ComputedNoise','Noise','Noise > level estimated by the

[sqlite] Error in SQLITE on applyNumericAffinity

2007-09-12 Thread Stéphane Thiers
Hi, I got this stack error in SQLITE when executing the following request: "INSERT INTO _scalars_float VALUES(237,220,'ComputedNoise','Noise','Noise level estimated by the smoothing algorithm','DouglasPeuckerAlgorihtm',0,0,NULL,'-1.79769e+308','1.79769e+308','%.2f','') The stack is the