[sqlite] User function calculates for every row before applying any where condition

2011-04-11 Thread Maxim V. Shiyanovsky
Does SQlite (3.6.23.1 to be precise) perform any optimization when user function appears in the statement? I defined custom function MY_FUNC(a TEXT, b TEXT) and bound it with sqlite3_create_function. Suppose, we have 2 tables: Tbl1(id1 INTEGER, id2 INTEGER, str TEXT) with 2 records Tbl2(id

RE: [sqlite] how to cast utf16 text to int?

2007-12-11 Thread Maxim V. Shiyanovsky
Sorry again. The problem is solved. I had to read FM :) and use sqlite3_open16 instead of sqlite3_open. -Original Message- From: Maxim V. Shiyanovsky [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 11, 2007 2:34 PM To: sqlite-users@sqlite.org Subject: RE: [sqlite] how to cast utf16

RE: [sqlite] how to cast utf16 text to int?

2007-12-11 Thread Maxim V. Shiyanovsky
Sorry, I forgot initial problem. As I wrote in the first letter I need cast from utf-16 text to int. In other words I need select like this: Select * from t, d where cast(t.value as int) = d.id Assuming t.value is utf-16 presentation of numeric. This select works fine for one-digit value. It

RE: [sqlite] how to cast utf16 text to int?

2007-12-11 Thread Maxim V. Shiyanovsky
, 2007 10:42 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] how to cast utf16 text to int? On 12/5/07, Maxim V. Shiyanovsky <[EMAIL PROTECTED]> wrote: > I have table that holds values of different types in utf16. > I also know value type for the current row. > How should I cast v

[sqlite] how to cast utf16 text to int?

2007-12-05 Thread Maxim V. Shiyanovsky
I have table that holds values of different types in utf16. I also know value type for the current row. How should I cast value to compare it with integer? This test shows 1 instead of 17 that I expected. sqlite> create table t (value text, field_type int); sqlite> insert into t values

RE: [sqlite] sqlite lock error

2007-11-09 Thread Maxim V. Shiyanovsky
Richard, thanks a lot! I was completely sure I use the same connection, but indeed ... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 6:06 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] sqlite lock error "Maxim V. Shiyan

[sqlite] sqlite lock error

2007-11-09 Thread Maxim V. Shiyanovsky
Does anybody here knows sqlite internals (especially database file locking algorithm)? Or am I only one who meet this bug? May be someone could persuade me that it's not a bug? Concerning the problem - I have some table (not so big at my point of view but with 6 records). I start

[sqlite] why select distinct does not use index?

2007-11-08 Thread Maxim V. Shiyanovsky
Suppose I have simple table: CREATE TABLE [profile_data] (   [profile_id] INTEGER,   [version] INTEGER); CREATE INDEX [by_id] ON [profile_data] ([id]); Why sqlite> explain query plan    ...> select distinct(profile_id) from profile_data; 0|0|TABLE profile_data Does not use index?

[sqlite] database lock error

2007-10-30 Thread Maxim V. Shiyanovsky
I've already posted here question about getting SQLITE_BUSY when calling sqlite3_prepare in single thread application dependent on database size. Now I get more detailed diagnostic. I have simple database but with considerable amount of records in some tables. Sql commands looks like: Begin