Re: [sqlite] Can you use random(*) to retrieve a pseudo random r owfrom 3.2.3?

2005-08-23 Thread Jakob Hirsch
Brandon, Nicholas wrote:

> CREATE TABLE MyTable(start_col int,end_col int);
> INSERT INTO "MyTable" VALUES(-2, 2);
...
> sqlite> select * from MyTable join (select random(*) as number) as rand
> where start_col >= rand.number and end_col < rand.number;

Your logic is broken. As every of your row's start_col is less than
end_row, the result set will be empty for every possible value of
rand.number.
Don't even know what you expected to get with this query.


Re: [sqlite] Incomplete SQL on SELECT

2005-08-04 Thread Jakob Hirsch
Boris Herbinière-Sève wrote:

> Incomplete SQL: SELECT r.Id, r.IdParams, r.SagN2, r.SagL2, r.SagN3,

how do you tell sqlite the request? Maybe it's just the terminating
semicolon that's missing:

> $ echo "select * from t1 as tab where tab.domain='dom1'" | sqlite3 test.db
> Incomplete SQL: select * from t1 as tab where tab.domain='dom1'
> $ echo "select * from t1 as tab where tab.domain='dom1';" | sqlite3 test.db
> dom1|jakob
> $ sqlite3 test.db "select * from t1 as tab where tab.domain='dom1'"
> dom1|jakob



Re: [sqlite] quoting

2005-07-31 Thread Jakob Hirsch
Cory Nelson wrote:

> strings should be surrounded by single quotes, so only single quotes
> and null bytes need to be quoted. 

How do I quote a null byte? I found nothing regarding this and the Perl
Module's quote function leaves null bytes unchanged (the query fails then).

> but, it would be faster to use
> binding and not have to deal with quoting.

Sure, but Exim's query functions does not support that.


[sqlite] quoting

2005-07-31 Thread Jakob Hirsch
Hi,

SQLite happens to be a nice piece of software, so it is about to be
integrated into the Exim MTA.
Exim provides a quoting function for every database it supports, so will
be for SQLite.
Is it correct that the only character that needs to be encoded is the
single quote (')?

While testing I saw the double quote is somewhat equivalent to the
single quote, which gives a little trouble. Exim's quoting function
cannot know, which type of quotes surround, so it will possibly fail if
someone uses double quotes. Is there probably a better way to do that?
(like escaping with \ all possible quoting chars, i.e.)