[sqlite] Sharing data between desktop and Android

2017-09-05 Thread Cecil Westerhof
I am thinking about writing some Android applications. I would like to share data between the phone (or tablet) and de desktop. What is the best way to do this? In a way that would also be convenient for other people. -- Cecil Westerhof ___ sqlite-users

[sqlite] Better way to use a large constant

2017-09-05 Thread Cecil Westerhof
I have the following query: SELECT * ,abs(random()) / (250 * 1000 * 1000 * 1000 * 1000 * 1000) + 1 AS randomiser FROM stock ORDER BY randomiser + julianday("Last Used") LIMIT I prefer to use something I never used or long ago. That is why I use the random. Randomiser gives a valu

Re: [sqlite] [EXTERNAL] Better way to use a large constant

2017-09-05 Thread Hick Gunter
Try 250E15. Just 1 constant instead of 6 constants and 5 multiplication operations (for each and every row). -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Cecil Westerhof Gesendet: Dienstag, 05. September 2017 13:49 An: S

[sqlite] Problem on Windows 10 machines

2017-09-05 Thread Bart Smissaert
Have a std_call compiled dll (sqlite3 3.20.1) that works perfectly fine on a Win 7 machine. On 2 different Win 10 machines I get a crash though when using the dll. This happens already when I run sqlite3_initialize. When I omit that step it will crash on the next first call to the dll, which is sql

Re: [sqlite] [EXTERNAL] Better way to use a large constant

2017-09-05 Thread Cecil Westerhof
2017-09-05 13:55 GMT+02:00 Hick Gunter : > Try 250E15. Just 1 constant instead of 6 constants and 5 multiplication > operations (for each and every row). > ​Strange: I thought I did something like that, but maybe I did something wrong. Is quit a while back, so I do not know what I did exactly. I

Re: [sqlite] [EXTERNAL] Better way to use a large constant

2017-09-05 Thread Hick Gunter
From https://sqlite.org/lang_expr.html " If a numeric literal has a decimal point or an exponentiation clause or if its magnitude is less than -9223372036854775808 or greater than 9223372036854775807, then it is a floating point literal." -Ursprüngliche Nachricht- Von: sqlite-users [mai

[sqlite] Doc (comment) bug in 3.18.0

2017-09-05 Thread Howard Kapustein
** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. */ SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){ The comment should be ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL, RESTART or TRUNCATE. __

[sqlite] PRAGMA journal_size_limit prevents -wal growth or only size outside a transaction?

2017-09-05 Thread Howard Kapustein
The docs are a little unclear => https://sqlite.org/pragma.html#pragma_journal_size_limit I need to disable autocheckpoint@close (for other reasons) so I'm looking for ways to fence the -wal file. If I want to bound a database's -wal file to <=1MB when I'm not in a transaction is it just PRAGMA

[sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
It is not very important, but I am just curious. I need to know how many records are not yet used. I do that with: SELECT COUNT(*) - COUNT("Last Used") AS "Not Used" FROM teaInStock Is that the correct way, or is there a better way? -- Cecil Westerhof __

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Stephen Chrzanowski
Untested (Obviously as I don't have your schema) select max(WheverYourIDFieldIs)-count(WhateverYourIDFieldIs) as "Not Used" from teaInStock group by WhateverYouIDFieldIs On Tue, Sep 5, 2017 at 3:45 PM, Cecil Westerhof wrote: > It is not very important, but I am just curious. I need to know how

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Igor Tandetnik
On 9/5/2017 3:45 PM, Cecil Westerhof wrote: It is not very important, but I am just curious. I need to know how many records are not yet used. I do that with: SELECT COUNT(*) - COUNT("Last Used") AS "Not Used" FROM teaInStock Is that the correct way, or is there a better way? Why not be expl

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Stephen Chrzanowski
On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either return 1, or, 0. On Tue, Sep 5, 2017 at 3:55 PM, Igor Tandetnik wrote: > On 9/5/2017 3:45 PM, Cecil Westerhof wrote: > >> It is

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Igor Tandetnik
On 9/5/2017 4:00 PM, Stephen Chrzanowski wrote: select count(*) from teaInStock where "Last Used" IS NULL; On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either return 1, or, 0. Wh

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
2017-09-05 21:55 GMT+02:00 Igor Tandetnik : > On 9/5/2017 3:45 PM, Cecil Westerhof wrote: > >> It is not very important, but I am just curious. I need to know how many >> records are not yet used. I do that with: >> SELECT COUNT(*) - COUNT("Last Used") AS "Not Used" >> FROM teaInStock >> >> Is t

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Stephen Chrzanowski
As I understand the requirements, he wants to find out how many entries (Not which entries) don't exist between the first ID (Assumed 1) and max ID value. So if he's got 3 rows, but max ID is 5, the result should be 2. But I also suspect you're better in tune with the requirements, since I suspec

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread R Smith
On 2017/09/05 10:00 PM, Stephen Chrzanowski wrote: On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either return 1, or, 0. Perhaps this is the opportune moment to learn. Test the theo

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread John McKown
On Tue, Sep 5, 2017 at 3:00 PM, Stephen Chrzanowski wrote: > On behalf of Cecil, the fault in that logic is that count(*) returns the > number of rows in that table, not whether there is a hole "somewhere: Your > query will either return 1, or, 0. > > ​I either don't understand you, or I am doin

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Igor Tandetnik
On 9/5/2017 4:05 PM, Igor Tandetnik wrote: On 9/5/2017 4:00 PM, Stephen Chrzanowski wrote: select count(*) from teaInStock where "Last Used" IS NULL; On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: 

[sqlite] Is there a performance difference between COUNT(*) and COUNT(name)

2017-09-05 Thread Cecil Westerhof
I want to know the number of teas I have in stock. For this I use: SELECT COUNT(Tea) FROM teaInStock Tea cannot be NULL, so this is the same as: SELECT COUNT(*) FROM teaInStock ​But I find the first more clear. I almost always see the second variant. Is this because it is more efficient, or a

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
2017-09-05 22:09 GMT+02:00 Igor Tandetnik : > It's possible I misunderstand what it is the OP is trying to do. But in > any case, the query I show is equivalent to the query the OP has shown > (which, apparently, does what they want), except formulated in a less > roundabout way. ​Yes, your quer

Re: [sqlite] Is there a performance difference between COUNT(*) and COUNT(name)

2017-09-05 Thread R Smith
On 2017/09/05 10:21 PM, Cecil Westerhof wrote: I want to know the number of teas I have in stock. For this I use: SELECT COUNT(Tea) FROM teaInStock Tea cannot be NULL, so this is the same as: SELECT COUNT(*) FROM teaInStock ​But I find the first more clear. I almost always see the second va

Re: [sqlite] Is there a performance difference between COUNT(*) and COUNT(name)

2017-09-05 Thread John McKown
On Tue, Sep 5, 2017 at 3:21 PM, Cecil Westerhof wrote: > I want to know the number of teas I have in stock. For this I use: > SELECT COUNT(Tea) > FROM teaInStock > > Tea cannot be NULL, so this is the same as: > SELECT COUNT(*) > FROM teaInStock > > ​But I find the first more clear. > I almos

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread R Smith
On 2017/09/05 10:13 PM, John McKown wrote: On Tue, Sep 5, 2017 at 3:00 PM, Stephen Chrzanowski wrote: On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either return 1, or, 0. ​I

Re: [sqlite] Is there a performance difference between COUNT(*) and COUNT(name)

2017-09-05 Thread Simon Slavin
On 5 Sep 2017, at 9:21pm, Cecil Westerhof wrote: > I want to know the number of teas I have in stock. For this I use: > SELECT COUNT(Tea) > FROM teaInStock > > Tea cannot be NULL, so this is the same as: > SELECT COUNT(*) > FROM teaInStock > > ​But I find the first more clear. > I almost

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
2017-09-05 22:46 GMT+02:00 R Smith : > > > On 2017/09/05 10:13 PM, John McKown wrote: > >> On Tue, Sep 5, 2017 at 3:00 PM, Stephen Chrzanowski >> wrote: >> >> On behalf of Cecil, the fault in that logic is that count(*) returns the >>> number of rows in that table, not whether there is a hole "so

Re: [sqlite] Is there a performance difference between COUNT(*) and COUNT(name)

2017-09-05 Thread Cecil Westerhof
2017-09-05 23:11 GMT+02:00 Simon Slavin : > > > On 5 Sep 2017, at 9:21pm, Cecil Westerhof wrote: > > > I want to know the number of teas I have in stock. For this I use: > > SELECT COUNT(Tea) > > FROM teaInStock > > > > Tea cannot be NULL, so this is the same as: > > SELECT COUNT(*) > > FROM

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread José Isaías Cabrera
I agarre. 😁 Mensaje original De: R Smith Fecha: 5/9/17 4:11 PM (GMT-05:00) A: sqlite-users@mailinglists.sqlite.org Asunto: Re: [sqlite] Getting number of rows with NULL On 2017/09/05 10:00 PM, Stephen Chrzanowski wrote: > On behalf of Cecil, the fault in that logic is that c

Re: [sqlite] [EXTERNAL] Is there a performance difference between COUNT(*) and COUNT(name)

2017-09-05 Thread Hick Gunter
Count() needs to extract the field from the record, tallying only those that are NOT NULL. Count(*) returns the total number of records in the table, with no need to extract a specific field. When looking into efficiency, try using the .explain/explain feature. asql> explain select count(a) f

Re: [sqlite] Sharing data between desktop and Android

2017-09-05 Thread Clemens Ladisch
Cecil Westerhof wrote: > I am thinking about writing some Android applications. I would like to > share data between the phone (or tablet) and de desktop. What is the best > way to do this? In a way that would also be convenient for other people. There is no good way to go over the USB connection

Re: [sqlite] [EXTERNAL] Is there a performance difference between COUNT(*) and COUNT(name)

2017-09-05 Thread Dominique Devienne
On Wed, Sep 6, 2017 at 7:56 AM, Hick Gunter wrote: > Count() needs to extract the field from the record, tallying > only those that are NOT NULL. > Technically it would not need to "extract" the field, only lookup the row header and see whether that field/column is NULL or not (since NULL is a