Re: How do I browse a database ?
Date: Sun, 11 Aug 2019 21:04:18 +0200
Message-ID: <qiport$1ugi$1_at_gioia.aioe.org>
Jerry,
> You don't use a temporary database. Just use the existing database. I
> hope you have a primary key on the table.
[Quoted] :-) Thats part of the problem: my program is ment to be a generic viewer, which should be able to handle /any/ sqlite database. And currently I'm not even sure if a sqlite database must actually have a primary key.
> You simply add the primary key as the last sort parameter and search for
> the next row based on the previous one.
Yep, that should work.
Than again, I just ran into this:
SELECT * FROM foo ORDER BY LOWER(id) LIMIT 7;
"id" is the primary key column, an 8 byte integer.
Resulting "id"s: 1, 10, 100, 1000, 100000, 10001, 10002
I'm rather sure that all the other key values between 1 and 100002 are in the table too.
And when doing this:
SELECT * FROM foo WHERE id<='100032' ORDER BY LOWER(id) DESC LIMIT 7; (with or without the quotes around 100032)
it thinks that the first number is 99999 (not even 100032 itself!) ...
Yep, a string comparision where there should be an integer one. :-(
[Quoted] At this moment I really could use a sqlite specific newgroup ...
> Now the next SELECT gets a little more complicated, but:
> WHERE (col1>val1) OR (col1= val1 AND col2>VAL2) OR
Whut ? I thought the WHERE comparisions could be seperated by commas, and that the DB software would be smart enough to do the sorting that way by default.
[Quoted] [Quoted] Looking .... Yup, it looks that I'm right about the expression: https://www.sqlite.org/syntaxdiagrams.html#expr , seventh branch, starting with "(".
[Quoted] [Quoted] The only thing I have to find out is if the DB software is "smart" enough.
... but first the non-numeric sorting of a numeric column.
Regards,
Rudy Wieser
Received on Sun Aug 11 2019 - 21:04:18 CEST