[sqlite] order by not working in combination with random()

2015-08-18 Thread Yuriy M. Kaminskiy
Simon Slavin wrote: > On 18 Aug 2015, at 1:32am, Simon Davies > wrote: > >> sqlite> SELECT r FROM (SELECT random() AS r FROM myTable) ORDER BY r DESC; >> -6629212185178073901 >> -5293473521544706766 >> 2649466971390864878 >> -6185422953036640443 >> 1855956853707028764 > > Eek. Sorry, I should

[sqlite] Locked database

2015-12-27 Thread Yuriy M. Kaminskiy
(I know, I'm a bit late for discussion, but...) Cecil Westerhof writes: > 2015-12-14 12:40 GMT+01:00 Clemens Ladisch : > >> Cecil Westerhof wrote: >> > I have a crontab job which uses a SQLite database. Sometimes this database >> > is locked because I used SQLite DB Browser, but did not Write

[sqlite] [PATCH] fix mksqlite3c.tcl --linemacros

2015-07-15 Thread Yuriy M. Kaminskiy
I noticed that when --linemacros option is used, line numbers are wrong, often by one line, sometimes more. This is due to bug in mksqlite3c.tcl tool, that output nothing when #include line is skipped. Trivial patch below. Index: sqlite3-3.8.10.2/tool/mksqlite3c.tcl

[sqlite] BEGINNER - Transactions in shell script

2015-09-06 Thread Yuriy M. Kaminskiy
Luuk writes: > On 05-09-15 22:27, Simon Slavin wrote: >> On 5 Sep 2015, at 9:18pm, Petr L?z?ovsk? wrote: >> >>> Have some shell scripts working with sqlite. Receiving incoming >>> payments from bank via HTTP API and pushing it into database. This >>> script will start periodically, every single

[sqlite] Sqlite do not use index collate nocase

2016-03-19 Thread Yuriy M. Kaminskiy
On 03/18/16 00:24 , Keith Medcalf wrote: > The column data is case sensitive and the comparison is case > sensitive. There is no case sensitive index. > > You either need (a) to make the column collate nocase (in which case > any index on the column is also in the same nocase collation and thus

[sqlite] Index Selection

2016-03-27 Thread Yuriy M. Kaminskiy
Igor Tandetnik writes: > On 3/26/2016 6:12 PM, Denis Burke wrote: >> CREATE INDEX [IndxT1C3] >> ON [T1]( >> [C3] COLLATE [NOCASE]); >> -- >> after doing this: >> explain query plan >> select C1 from T1 >> where C3='2016-01-02' > > You are requesting a case sensitive comparison; a

Re: [sqlite] Version 3.20.0 coming soon...

2017-07-18 Thread Yuriy M. Kaminskiy
On 07/18/17 16:37 , Stephan Buchert wrote: > The command history (Ctrl-R) of the shell is still intact with the new tab > completion, but I had experienced it often as way too short (too few > lines). So I have searched now in the source code, the line in shell.c is > > if( zHistory ){ >

[sqlite] potential memory over-read in sqlite3Utf8CharLen

2017-05-20 Thread Yuriy M. Kaminskiy
I've found a little issue in sqlite3Utf8CharLen function. If utf-8 sequence is at the end of buffer, and buffer is not it will overread by one or more bytes (within \x80-\xbf range). E.g. const int psz = getpagesize(); char *p; p =

Re: [sqlite] [Bug] Non-ASCII character is not counted in calculating column width

2017-06-02 Thread Yuriy M. Kaminskiy
Jacob Pratt writes: > Using .width x along with .mode columns, any non-ASCII character isn't > counted, causing the column to shrink by one. > > I *think* my analysis is correct, but it also might be counted multiple > times by taking a naïve approach and just counting the

Re: [sqlite] [Bug] Non-ASCII character is not counted in calculating column width

2017-06-02 Thread Yuriy M. Kaminskiy
yum...@gmail.com (Yuriy M. Kaminskiy) writes: > Jacob Pratt <jhpratt...@gmail.com> writes: > >> Using .width x along with .mode columns, any non-ASCII character isn't >> counted, causing the column to shrink by one. >> >> I *think* my analysis is correct, b

Re: [sqlite] [patch] configure.ac: wrong braces in appending OPT_FEATURE_FLAGS

2017-06-02 Thread Yuriy M. Kaminskiy
Richard Hipp <d...@sqlite.org> writes: > On 6/2/17, Yuriy M. Kaminskiy <yum...@gmail.com> wrote: >> While running configure, I noticed some noise about `OPT_FEATURE_FLAGS: >> command not found`. > > I attempted to fix this problem in check-in > https://www.sqli

[sqlite] [patch] configure.ac: wrong braces in appending OPT_FEATURE_FLAGS

2017-06-02 Thread Yuriy M. Kaminskiy
While running configure, I noticed some noise about `OPT_FEATURE_FLAGS: command not found`. And indeed, it uses wrong braces around OPT_FEATURE_FLAGS in code that converts --enable-{fts4,rtree,etc} into defines. In shell (configure.ac is shell code!), ${foo} expands variable foo, but $(foo) runs

[sqlite] [PATCH] fix (a little bit more of) `.mode column` with utf-8

2017-06-04 Thread Yuriy M. Kaminskiy
yum...@gmail.com (Yuriy M. Kaminskiy) writes: > However, not everywhere; this code auto-detects column width: > if( w==0 ){ > w = strlen30(azCol[i] ? azCol[i] : ""); > if( w<10 ) w = 10; > n = strlen30(azArg &&

Re: [sqlite] Importing from single-insert-statement SQL dump is 61 times slower than importing from SQL dump with one statement per row

2017-06-04 Thread Yuriy M. Kaminskiy
Clemens Ladisch writes: > Sarge Borsch wrote: >> time xzdec something.sql.xz | sqlite3 something.db > > This measures only xzdec; it does not catch anything that sqlite3 does > after xzdec has finished and closed the pipe. Nitpick: In bash or zsh, `time` is handled by shell,

Re: [sqlite] Questions about SQLite Encryption Extension (SEE)

2017-06-09 Thread Yuriy M. Kaminskiy
Eric Grange writes: >> Isn't it all just obfuscation? > > Not really, the encryption protects the file, wherever it is, as long as > the attacker does not have access to the application keys or application > memory. > >> If the adversary is another process on the same host,

Re: [sqlite] Questions about SQLite Encryption Extension (SEE)

2017-06-17 Thread Yuriy M. Kaminskiy
Jens Alfke writes: >> And any non-opensource crypto should be taken with triple caution. Or >> even opensource, but not widely-used or otherwise not known to be >> carefully peer-reviewed (FWIW, I looked at e.g. wxsqlite crypto code, it >> looks not exactly promising too). > >

Re: [sqlite] Questions about SQLite Encryption Extension (SEE)

2017-06-18 Thread Yuriy M. Kaminskiy
Jens Alfke <j...@mooseyard.com> writes: >> On Jun 17, 2017, at 7:02 AM, Yuriy M. Kaminskiy <yum...@gmail.com> wrote: >> >> *) don't appear to be able to keep key in system-provided secure >> device/enclave; > > In their defense, I think this is out-of-

Re: [sqlite] [PATCH] fix (a little bit more of) `.mode column` with utf-8

2017-06-06 Thread Yuriy M. Kaminskiy
Clemens Ladisch <clem...@ladisch.de> writes: > Yuriy M. Kaminskiy wrote: >> +** Compute a utf-8 string length (in characters rather than bytes) > Counting characters is an improvement. > > But the number of characters is not necessarily the same as the number > o

Re: [sqlite] memory leak

2017-11-05 Thread Yuriy M. Kaminskiy
On 11/05/17 03:28 , Lev wrote: > I'm fighting with some memory leak. From time to time the vsize of the > process goes up with 100k. I have several function like this, and I > call them in each second. My memory growth happens every 10 minutes or > so. > > int dbSqliteSelectSensorsToReport(sdmd_t

Re: [sqlite] [EXTERNAL] memory leak

2017-11-06 Thread Yuriy M. Kaminskiy
On 11/06/17 10:02 , Hick Gunter wrote: > You are preparing statements inside the loop, but only finalizing the > last one (i.e. outside the loop) This is not a real loop, it executes one time only (do {...} while(0)). > -Ursprüngliche Nachricht- > Von: sqlite-users

Re: [sqlite] random rows

2018-06-02 Thread Yuriy M. Kaminskiy
On 06/01/18 04:41 , Abroży Nieprzełoży wrote: > 2018-06-01 2:12 GMT+02:00, Torsten Curdt : >> I need to get some random rows from a large(ish) table. >> >> The following seems to be the most straight forward - but not the fastest. >> >> SELECT * FROM table ORDER BY random() limit 200 >> >> Is

Re: [sqlite] Missing/undocumented HAVE_STRERROR_R

2018-03-25 Thread Yuriy M. Kaminskiy
On 03/16/18 10:12 , Jens Alfke wrote: > I'm debugging a problem that involves some errors logged by SQLite via > unixLogErrorAtLine(). The messages contain an errno value but not the > associated message. The message is missing because the call to > strerror_r() is #ifdef'd out by this line: > >