[sqlite] WHERE clause not working in combination with random()

2015-08-28 Thread Simon Slavin
On 28 Aug 2015, at 10:20am, Domingo Alvarez Duarte wrote: > Please remember that the "random" function here is only a detail the real > problem is the "column expression" been reevaluated more than once. Yes. When considering fixes for this problem one needs to also consider

[sqlite] WHERE clause not working in combination with random()

2015-08-28 Thread Domingo Alvarez Duarte
Now that we have solved the expression column reevaluation problem on the "ORDER BY" clause what about the same problem on the "WHERE" clause ? CREATE TABLE myTable (a INTEGER); INSERT INTO myTable VALUES (1),(2),(3),(4),(5); CREATE VIEW myView AS SELECT a,random()%100 AS rr FROM myTable;

[sqlite] WHERE clause not working in combination with random()

2015-08-28 Thread John McKown
OK, I am truly grateful for what I have learned in this thread! And I have composed an new, personal, rule: don't use a function in _anything_ other than in the column list portion of a SELECT statement. If necessary, this means I will be using a CREATE TEMPORARY TABLE results type construct when

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Ward Willats
> On Nov 10, 2014, at 9:31 AM, Richard Hipp wrote: > > On Mon, Nov 10, 2014 at 12:28 PM, Ward Willats > wrote: > >> >>> On Nov 10, 2014, at 3:11 AM, Richard Hipp wrote: >>> >>> If you recompile the SQLite command-line shell

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Richard Hipp
On Mon, Nov 10, 2014 at 12:28 PM, Ward Willats wrote: > > > On Nov 10, 2014, at 3:11 AM, Richard Hipp wrote: > > > > If you recompile the SQLite command-line shell (sqlite3.exe) using the > > -DSQLITE_ENABLE_SELECTTRACE option, then you can enter: > > >

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Ward Willats
> On Nov 10, 2014, at 3:11 AM, Richard Hipp wrote: > > If you recompile the SQLite command-line shell (sqlite3.exe) using the > -DSQLITE_ENABLE_SELECTTRACE option, then you can enter: > If I do that, gcc -D SQLITE_ENABLE_SELECTTRACE -D HAVE_READLINE -l readline -o

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Igor Tandetnik
On 11/10/2014 4:40 AM, Prakash Premkumar wrote: = /\ salary+ / \ 3 3 / * /

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Richard Hipp
On Mon, Nov 10, 2014 at 4:40 AM, Prakash Premkumar wrote: > The where clause in sqlite is encoded as a tree > > Let's say I have select statement like : > > SELECT * from employee where salary = 3+5*4+3; > > The tree which takes care of operator precedence is : > >

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Simon Slavin
On 10 Nov 2014, at 9:40am, Prakash Premkumar wrote: > If I am constructing this tree for where clause by myself, should i take > the operator precedence in to account while constructing it or will sqlite > take care of precedence,given any tree (i.e constructing it with

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Stephen Chrzanowski
h.p...@gmail.com] > Gesendet: Montag, 10. November 2014 10:40 > An: General Discussion of SQLite Database > Betreff: [sqlite] SQLite where clause tree > > The where clause in sqlite is encoded as a tree > > Let's say I have select statement like : > > SELECT * from e

Re: [sqlite] SQLite where clause tree

2014-11-10 Thread Hick Gunter
2014 10:40 An: General Discussion of SQLite Database Betreff: [sqlite] SQLite where clause tree The where clause in sqlite is encoded as a tree Let's say I have select statement like : SELECT * from employee where salary = 3+5*4+3; The tree which takes care of operator precedence

[sqlite] SQLite where clause tree

2014-11-10 Thread Prakash Premkumar
The where clause in sqlite is encoded as a tree Let's say I have select statement like : SELECT * from employee where salary = 3+5*4+3; The tree which takes care of operator precedence is : = /\ salary+

Re: [sqlite] How to use my own python function in a SQLite WHERE clause?

2013-10-06 Thread Ryan Johnson
On 05/10/2013 6:01 AM, Clemens Ladisch wrote: Bao Niu wrote: SELECT * FROM myTable WHERE MyDate > MyModule.ChineseDate("兔年八月十五") You cannot use Python function directly in SQL. ... but you can register it with sqlite3 easily enough and use it from SQL afterward:

Re: [sqlite] How to use my own python function in a SQLite WHERE clause?

2013-10-05 Thread Clemens Ladisch
Bao Niu wrote: > SELECT * FROM myTable WHERE MyDate > MyModule.ChineseDate("兔年八月十五") You cannot use Python function directly in SQL. You have to convert from the Python type to the corresponding SQL type. I don't know how the type mapping works exactl, but it should probably look like this:

[sqlite] How to use my own python function in a SQLite WHERE clause?

2013-10-02 Thread Bao Niu
I coded a module that has a ChineseDate class, which automatically parse Chinese dates characters into a python-dateutil object(which actually is a datetime.datetime object as well). I used detect_types=sqlite3.PARSE_DECLTYPES to tell the connection object to store this ChineseDate type directly

Re: [sqlite] Where Clause

2013-08-09 Thread Hick Gunter
]); } } -Ursprüngliche Nachricht- Von: techi eth [mailto:techi...@gmail.com] Gesendet: Freitag, 09. August 2013 07:24 An: General Discussion of SQLite Database Betreff: Re: [sqlite] Where Clause > BEGIN; > SELECT COUNT() FROM WHERE ; > if count == 0 > rai

Re: [sqlite] Where Clause

2013-08-08 Thread techi eth
t; -Ursprüngliche Nachricht- > Von: techi eth [mailto:techi...@gmail.com] > Gesendet: Freitag, 02. August 2013 13:13 > An: General Discussion of SQLite Database > Betreff: Re: [sqlite] Where Clause > > I was checking for Update only if condition will match. > > I

Re: [sqlite] Where Clause

2013-08-02 Thread Eduardo Morras
On Fri, 2 Aug 2013 14:04:40 +0530 techi eth wrote: > At the end of execution I am expecting SET will change the value but it > actually doesn't SET the value due to wrong condition. > > I will check return from sqlite3 & due to success return I am in wrong > assumption.

Re: [sqlite] Where Clause

2013-08-02 Thread ibrahim
On 02.08.2013 10:14, techi eth wrote: Come across one issue with conditional query execution. Query: UPDATE COMPANY SET Name= 'test' WHERE ID = 2; According to my understanding if no ID = 2 is present in table then error should return but it return with SQLITE_OK however Name value is not

Re: [sqlite] Where Clause

2013-08-02 Thread Hick Gunter
Discussion of SQLite Database Betreff: Re: [sqlite] Where Clause I was checking for Update only if condition will match. In fact it can be any operation like SELECT,INSERT,UPDATE or DELETE I think hint given by you using count() function will do the required. So here If condition matches then count

Re: [sqlite] Where Clause

2013-08-02 Thread techi eth
; COMMIT > > -Ursprüngliche Nachricht- > Von: techi eth [mailto:techi...@gmail.com] > Gesendet: Freitag, 02. August 2013 12:36 > An: General Discussion of SQLite Database > Betreff: Re: [sqlite] Where Clause > > Is their any Query format which can change the valu

Re: [sqlite] Where Clause

2013-08-02 Thread Hick Gunter
: [sqlite] Where Clause Is their any Query format which can change the value based on conditional expression is TRUE!!! Thanks.. Techi - On Fri, Aug 2, 2013 at 2:11 PM, Hick Gunter <h...@scigames.at> wrote: > The SQL you gave translates to > > "Change the 'Name' field to

Re: [sqlite] Where Clause

2013-08-02 Thread techi eth
ion; > } else { > error = unlock( file ); > if (error) raise exception; > } > } > > HTH > Gunter > > -Ursprüngliche Nachricht- > Von: techi eth [mailto:techi...@gmail.com] > Gesendet: Freitag, 02. August 2013 1

Re: [sqlite] Where Clause

2013-08-02 Thread Roland Wilczek
Hi, You expected the database to perform the assignment on each row WHERE ID = 2. It did exactly this. -- kind regards - Roland Wilczek Am Freitag, 2. August 2013, 14:04:40 schrieb techi eth: > At the end of execution I am expecting SET will change the value but it > actually doesn't SET the

Re: [sqlite] Where Clause

2013-08-02 Thread Hick Gunter
if (error) raise exception; } } HTH Gunter -Ursprüngliche Nachricht- Von: techi eth [mailto:techi...@gmail.com] Gesendet: Freitag, 02. August 2013 10:15 An: General Discussion of SQLite Database Betreff: [sqlite] Where Clause Come across one issue with conditional query execu

Re: [sqlite] Where Clause

2013-08-02 Thread techi eth
At the end of execution I am expecting SET will change the value but it actually doesn't SET the value due to wrong condition. I will check return from sqlite3 & due to success return I am in wrong assumption. On Fri, Aug 2, 2013 at 1:57 PM, Igor Korot wrote: > Hi > Why do

Re: [sqlite] Where Clause

2013-08-02 Thread Igor Korot
Hi Why do you think it should return error? On Aug 2, 2013 1:15 AM, "techi eth" wrote: > Come across one issue with conditional query execution. > > Query: UPDATE COMPANY SET Name= 'test' WHERE ID = 2; > According to my understanding if no ID = 2 is present in table then

[sqlite] Where Clause

2013-08-02 Thread techi eth
Come across one issue with conditional query execution. Query: UPDATE COMPANY SET Name= 'test' WHERE ID = 2; According to my understanding if no ID = 2 is present in table then error should return but it return with SQLITE_OK however Name value is not changed. Cheers - Techi

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Simon Slavin
On 1 Jul 2011, at 12:06am, Simon Gornall wrote: > On 30 Jun 2011, at 14:13, Simon Slavin wrote: > >> On 30 Jun 2011, at 8:06pm, Simon Gornall wrote: >> >>> So, the goal is to maximise the number of times the 3rd-pass style can be >>> what is actually being used. At the moment, if an entity

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Simon Gornall
On 30 Jun 2011, at 14:13, Simon Slavin wrote: > > On 30 Jun 2011, at 8:06pm, Simon Gornall wrote: > >> So, the goal is to maximise the number of times the 3rd-pass style can be >> what is actually being used. At the moment, if an entity gets *any* write >> operation, I discard *all* entries

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Simon Slavin
On 30 Jun 2011, at 8:06pm, Simon Gornall wrote: > So, the goal is to maximise the number of times the 3rd-pass style can be > what is actually being used. At the moment, if an entity gets *any* write > operation, I discard *all* entries in the result-cache for that object. I think you're

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Simon Gornall
On 30 Jun 2011, at 11:42, Simon Slavin wrote: > > On 30 Jun 2011, at 7:28pm, Simon Gornall wrote: > >> I don't care if an update is made to the *value* of 'otherColumnName'. I >> only care if the set-of-objects-that-would-be-returned could differ, not the >> properties of those objects. > >

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Simon Slavin
On 30 Jun 2011, at 7:28pm, Simon Gornall wrote: > I don't care if an update is made to the *value* of 'otherColumnName'. I only > care if the set-of-objects-that-would-be-returned could differ, not the > properties of those objects. Do a SELECT group_concat(rowid) WHERE … when you do your

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Simon Gornall
On 30 Jun 2011, at 11:06, Igor Tandetnik wrote: > On 6/30/2011 1:43 PM, Simon Gornall wrote: >> Well, perhaps I'm missing something, but if the statement for which I'm >> caching results was something like >> >> SELECT * FROM tableName WHERE columnName = zzz; >> >> I'd only want to clear

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Igor Tandetnik
On 6/30/2011 1:43 PM, Simon Gornall wrote: > Well, perhaps I'm missing something, but if the statement for which I'm > caching results was something like > > SELECT * FROM tableName WHERE columnName = zzz; > > I'd only want to clear the results cache when statements like: > > UPDATE

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Simon Gornall
On 30 Jun 2011, at 10:28, Igor Tandetnik wrote: > On 6/30/2011 1:15 PM, Simon Gornall wrote: >> Is it possible to get the columns operated on by a WHERE clause from the >> sqlite3_stmt once it's been prepared ? >> >> I looked at the sqlite3_set_authorizer, but it doesn't seem to have >> an

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Igor Tandetnik
On 6/30/2011 1:15 PM, Simon Gornall wrote: > Is it possible to get the columns operated on by a WHERE clause from the > sqlite3_stmt once it's been prepared ? > > I looked at the sqlite3_set_authorizer, but it doesn't seem to have > an action code for examining WHERE - the only codes that use >

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Richard Hipp
On Thu, Jun 30, 2011 at 1:15 PM, Simon Gornall wrote: > > I'm trying to intelligently invalidate cached results after a database > UPDATE, where the results are cached by query. Would the update_hook be helpful here? http://www.sqlite.org/c3ref/update_hook.html --

[sqlite] WHERE clause inspection

2011-06-30 Thread Simon Gornall
Hi there, Is it possible to get the columns operated on by a WHERE clause from the sqlite3_stmt once it's been prepared ? I'm trying to intelligently invalidate cached results after a database UPDATE, where the results are cached by query. One of the ways the query can be instantiated is

Re: [sqlite] WHERE Clause Not Working On Database

2010-09-14 Thread Simon Slavin
On 14 Sep 2010, at 2:57pm, Jay A. Kreibich wrote: > On Tue, Sep 14, 2010 at 06:52:02AM -0700, Rich Shepard scratched on the wall: >> sqlite> select distinct state from Companies; >> 'ID' >> 'NV' >> 'OR' >> 'UT' >> 'WA' > > If that's a copy-paste from a default sqlite3 session, the single >

Re: [sqlite] WHERE Clause Not Working On Database

2010-09-14 Thread Paul Corke
On 14 September 2010 14:52, Rich Shepard wrote: > sqlite> select distinct state from Companies; > 'ID' > 'NV' > 'OR' > 'UT' > 'WA' It looks like the values in your db have quotes in them. sqlite> create table companies(state char(2), name char(10)); sqlite> insert into companies

Re: [sqlite] WHERE Clause Not Working On Database

2010-09-14 Thread Jay A. Kreibich
On Tue, Sep 14, 2010 at 06:52:02AM -0700, Rich Shepard scratched on the wall: > On Tue, 14 Sep 2010, Paul Corke wrote: > > > What do you get from: > > > > select distinct state from companies; > > Paul, > > sqlite> select distinct state from Companies; > 'ID' > 'NV' > 'OR' > 'UT' > 'WA' If

Re: [sqlite] WHERE Clause Not Working On Database

2010-09-14 Thread Jay A. Kreibich
On Tue, Sep 14, 2010 at 06:45:24AM -0700, Rich Shepard scratched on the wall: >I cannot select rows from a table using the WHERE clause and cannot find > my error. Perhaps others will see what I miss. > >The table, Companies, has 1500+ rows. One column is defined as >state

Re: [sqlite] WHERE Clause Not Working On Database

2010-09-14 Thread Paul Corke
On 14 September 2010 14:45, Rich Shepard wrote: > sqlite> select * from Companies where state = 'OR'; What do you get from: select distinct state from companies; Paul. ___ sqlite-users mailing list sqlite-users@sqlite.org

[sqlite] WHERE Clause Not Working On Database

2010-09-14 Thread Rich Shepard
I cannot select rows from a table using the WHERE clause and cannot find my error. Perhaps others will see what I miss. The table, Companies, has 1500+ rows. One column is defined as state CHAR(2), but the select statement seeking all rows where state = 'OR' for example returns

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Tim Romano
Aha. Got it. After PRAGMA case_sensitive_like =1 the optimizer might use the index with BINARY collation. I was under the mistaken impression that LIKE() adapted itself to the column's collation. But I see that it is not possible to define one column to use BINARY collation and another

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Jay A. Kreibich
On Mon, Nov 30, 2009 at 08:28:12PM -0500, Tim Romano scratched on the wall: > On my system, an index is used with the query above only when collation > is "collation nocase". In other words, when LIKE and collation agree on what "equal" is. > I /believe/ case_sensitive_like is OFF. I've

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Igor Tandetnik
Tim Romano wrote: > A revised question (sorry for leaving out an important fact on the > first go): > > When the default binary collation is being used, why does the > optimizer not attempt to use an index when the WHERE > clause uses the LIKE operator with a text column,

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Tim Romano
A revised question (sorry for leaving out an important fact on the first go): When the default binary collation is being used, why does the optimizer not attempt to use an index when the WHERE clause uses the LIKE operator with a text column, as in: ... where myTextColumn like 'M%' On my

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Nicolas Williams
On Mon, Nov 30, 2009 at 08:56:48PM +, Simon Slavin wrote: > On 30 Nov 2009, at 6:49pm, Nicolas Williams wrote: > > See my previous message: it would make no sense to have a column with > > data-dependent collations. But perhaps I'm missing something. Can you > > describe the semantics of

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Igor Tandetnik
Tim Romano wrote: > Why does the optimizer not attempt to use an index when the WHERE > clause uses the LIKE operator with a text column, as in: > > ... where myTextColumn like 'M%' It does, when certain conditions are met. See http://sqlite.org/optoverview.html ,

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Tim Romano
Why does the optimizer not attempt to use an index when the WHERE clause uses the LIKE operator with a text column, as in: ... where myTextColumn like 'M%' My question ultimately concerns Unicode and indexing, and since these subjects are being discussed *passim* in this thread, I hope you

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Simon Slavin
On 30 Nov 2009, at 6:49pm, Nicolas Williams wrote: > On Mon, Nov 30, 2009 at 06:37:11PM +, Simon Slavin wrote: >> > >> The column 'language' >> could perhaps be absolute, or perhaps be used as a default if the >> individual values did not declare a language. On the other hand, it >> might

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Jay A. Kreibich
On Mon, Nov 30, 2009 at 06:37:11PM +, Simon Slavin scratched on the wall: > > On 30 Nov 2009, at 5:51pm, Nicolas Williams wrote: > > > Consider a column that contains a person's last name. Q: do proper > > names have a language? A: No, since people can be from all over and > > even within

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Nuno Lucas
Simon Slavin wrote: > But what is the purpose of collating a column ? Why, to allow it to be > indexed, of course. And for it to be indexed every value in the column must > be comparable to every other value. So it might be sufficient to simply > declare the column as having a language: > >

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Nicolas Williams
On Mon, Nov 30, 2009 at 06:37:11PM +, Simon Slavin wrote: > > On 30 Nov 2009, at 5:51pm, Nicolas Williams wrote: > > > Consider a column that contains a person's last name. Q: do proper > > names have a language? A: No, since people can be from all over and > > even within a single country

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Nicolas Williams
On Mon, Nov 30, 2009 at 01:21:08PM -0500, Igor Tandetnik wrote: > Nicolas Williams wrote: > > IMO you'll have two types of text to sort: a) generic text (e.g., > > proper names), b) localized text (e.g., message catalogs). For (a) > > you'll want > > to pick a

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Simon Slavin
On 30 Nov 2009, at 5:51pm, Nicolas Williams wrote: > Consider a column that contains a person's last name. Q: do proper > names have a language? A: No, since people can be from all over and > even within a single country may have last names of various radically > different origins. But what

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Igor Tandetnik
Nicolas Williams wrote: > IMO you'll have two types of text to sort: a) generic text (e.g., > proper names), b) localized text (e.g., message catalogs). For (a) > you'll want > to pick a collation, _any_ collation. Actually, you may want to choose a collation familiar

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Nicolas Williams
On Mon, Nov 30, 2009 at 08:15:58AM +, Simon Slavin wrote: > On 30 Nov 2009, at 1:58am, Igor Tandetnik wrote: > > Note that Unicode collation is not as simple as you might think. Did > > you know that in Estonian, 'y' sorts between 'i' and 'j'? Or that in > > German phonebook sort, 'oe' sorts

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-30 Thread Simon Slavin
On 30 Nov 2009, at 1:58am, Igor Tandetnik wrote: > Note that Unicode collation is not as simple as you might think. Did you know > that in Estonian, 'y' sorts between 'i' and 'j'? Or that in German phonebook > sort, 'oe' sorts as if it were a single letter between 'o' and 'p'? > Basically,

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-29 Thread Igor Tandetnik
Irshad Alam wrote: > I want to use WHERE Clause for unicode search in database. Let me clear more > about my requirement. Suppose I've a database whose table name is employee > having name, age and salary as three columns. > > Now I want to make query on employee table which gives the result

Re: [sqlite] WHERE CLAUSE in UNICODE

2009-11-29 Thread Jean-Christophe Deschamps
>Now I want to make query on employee table which gives the result having >names start between 'D' and 'M', so probable I'll do something " SELECT * >FROM employee WHERE name BETWEEN 'd%' AND 'n%' ". But this is very >specific >if I know the characters. I want to avoid using the character and

[sqlite] WHERE CLAUSE in UNICODE

2009-11-29 Thread Irshad Alam
I want to use WHERE Clause for unicode search in database. Let me clear more about my requirement. Suppose I've a database whose table name is employee having name, age and salary as three columns. Now I want to make query on employee table which gives the result having names start between 'D'

Re: [sqlite] WHERE clause doesn't seem to work right

2009-03-13 Thread Dan
On Mar 13, 2009, at 10:10 PM, Fitter Man wrote: > > @John: Is that documented anywhere? I ask because there are some > cases I'd > like to understand better without going through a lot of testing to > determine how it works. I'm inferring from your example the rule is > all > numerics come

Re: [sqlite] WHERE clause doesn't seem to work right

2009-03-13 Thread Wilson, Ron P
To: sqlite-users@sqlite.org Subject: Re: [sqlite] WHERE clause doesn't seem to work right @John: Is that documented anywhere? I ask because there are some cases I'd like to understand better without going through a lot of testing to determine how it works. I'm inferring from your example the rule

Re: [sqlite] WHERE clause doesn't seem to work right

2009-03-13 Thread Fitter Man
@John: Is that documented anywhere? I ask because there are some cases I'd like to understand better without going through a lot of testing to determine how it works. I'm inferring from your example the rule is all numerics come first, with integer and floats interleaved according to their

Re: [sqlite] WHERE clause doesn't seem to work right

2009-03-13 Thread John Elrick
Fitter Man wrote: > I tried something for kicks and it worked. I flipped all the column > definitions from VARCHAR(255) to INTEGER and my query, above, works > properly. I did a little reading and found this described my problem: > http://www.sqlite.org/datatypes.html . > > > Q: Is their some

Re: [sqlite] WHERE clause doesn't seem to work right

2009-03-13 Thread Fitter Man
I tried something for kicks and it worked. I flipped all the column definitions from VARCHAR(255) to INTEGER and my query, above, works properly. I did a little reading and found this described my problem: http://www.sqlite.org/datatypes.html . Q: Is their some inverse problem now that all the

Re: [sqlite] WHERE clause doesn't seem to work right

2009-03-13 Thread John Elrick
Fitter Man wrote: > I've just started using Sqlite and something seems wrong. I'm sure I'm making > a mistake, but can't spot it. > > I have a process that loads data from an RSS feed into a database. All the > columns are defined as VARCHAR(255) but I figure that's irrelevant here > based on

[sqlite] WHERE clause analysis - find referenced columns

2009-03-04 Thread Alex Ousherovitch
Hello list, I need to implement a security model where certain columns (e.g. named super_secret_key) will be hidden. This needs to be enforced not only for the requested result columns but also for the columns referenced in the WHERE clause. Is there a relatively simple way to either get

Re: [sqlite] WHERE clause analysis - find referenced columns

2009-03-03 Thread Alex Ousherovitch
Unfortunately, for the SQLITE_SELECT action code (http://www.sqlite.org/c3ref/c_alter_table.html) the registered auth callback will not get the column information. It is only available for SQLITE_READ, which, I guess, is not what I need - I would like prepare statement to fail if there are "hidden

Re: [sqlite] WHERE clause analysis - find referenced columns

2009-03-03 Thread D. Richard Hipp
On Mar 3, 2009, at 8:18 PM, Alex Ousherovitch wrote: > Hello list, > > > > I need to implement a security model where certain columns (e.g. named > super_secret_key) will be hidden. > > This needs to be enforced not only for the requested result columns > but > also for the columns referenced

[sqlite] WHERE clause analysis - find referenced columns

2009-03-03 Thread Alex Ousherovitch
Hello list, I need to implement a security model where certain columns (e.g. named super_secret_key) will be hidden. This needs to be enforced not only for the requested result columns but also for the columns referenced in the WHERE clause. Is there a relatively simple way to either get

Re: [sqlite] WHERE clause syntax error

2006-06-17 Thread Gerry Snyder
James W. Walker wrote: Let's say I have two tables A and B, each of which has an integer ID column. I want to find ID values that occur in A but not B. The first query I came up with was: SELECT ID FROM A WHERE NOT EXISTS (SELECT * FROM B WHERE B.ID = A.ID); but I get a syntax error. My

Re: Re: [sqlite] WHERE clause syntax error

2006-06-17 Thread Miha Vrhovnik
>Something like: > >SELECT A.ID >FROM A >LEFT JOIN B >ON A.ID = B.ID >WHERE B.ID IS NULL > >Might be more efficient? Nope. I rewrote such query to SELECT ID FROM A WHERE ID NOT IN (SELECT ID FROM B); SELECT COUNT(*) AS unread FROM mboxes WHERE idMbox = %d AND idMsg IN (SELECT idMsg FROM

Re: [sqlite] where clause and index question

2005-12-22 Thread Martin Engelschalk
Hello Stanislaw, i think you may be mistaken. Indices in sqlite are implemented as trees. If the where clause does not include column c, there is no way to use the tree beyond the column b. The program has to look at every row that meets the clauses involving a and b. Also, in my

[sqlite] where clause and index question

2005-12-22 Thread Stanislaw Stepien
Hi I have found following in 'The SQLite Query Optimizer Overview': It is not necessary for every column of an index to appear in a WHERE clause term in order for that index to be used. But there can not be gaps in the columns of the index that are used. Thus for the example index above, if

Re: [sqlite] SQLite where clause parsing?

2005-09-06 Thread D. Richard Hipp
On Tue, 2005-09-06 at 13:07 -0700, R S wrote: > Hi, > I have a million records in my DB. I tried using .explain on and ran the > query below which took a long time although I just want the last 100,000 > records...(It ran much faster when my table had a 100,000 records) so I > assume it is

[sqlite] SQLite where clause parsing?

2005-09-06 Thread R S
Hi, I have a million records in my DB. I tried using .explain on and ran the query below which took a long time although I just want the last 100,000 records...(It ran much faster when my table had a 100,000 records) so I assume it is related to how I constructed the statement. select columns