Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-15 Thread Clemens Ladisch
Gwendal Roué wrote: > Serialized accesses from multiple threads is OK when the connection is > in the "Multi-thread" or "Serialized" threading modes, but not in the > "Single-thread" threading mode. says: | 1. *Single-thread*. In this mode, all mutexes are d

Re: [sqlite] Is it safe to use same sqlite connection sequentially between threads ?

2017-08-15 Thread Gwendal Roué
> Le 15 août 2017 à 08:44, Clemens Ladisch a écrit : > > sanhua.zh wrote: >> All 1. 2. 3. steps are run sequentially, which means that the step 2 >> runs after step 1 finished and step 3 runs after step 2 finished >> theoretically . >> Also, I can make sure the memory order between threads. >>

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Simon Slavin
On 16 Aug 2017, at 2:25am, petern wrote: > The documentation should either say nothing or > say that the concatenation order depends on the row order of the enclosing > query. Saying group_concat is arbitrary is simply wrong. Saying that something is arbitrary is the same as saying nothing ab

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread petern
quote from https://sqlite.org/lang_aggfunc.html The group_concat() function returns a string which is the concatenation of all non-NULL values of X. If parameter Y is present then it is used as the separator between instances of X. A comma (",") is used as the separator if Y is omitted. The o

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Donald Griggs
Regarding: "The ordering is entirely deterministic" When the documentation says the order is arbitrary, it doesn't mean that it's non-deterministic in some "can never be determined by humans nor Schrödingerish cats" -- it is a well-understood and very useful shorthand meaning "the order, though a

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Keith Medcalf
On Tuesday, 15 August, 2017 13:27, Jens Alfke said: >> On Aug 15, 2017, at 12:22 PM, Keith Medcalf wrote: >> Well, the documentation is incorrect. The ordering is entirely >>deterministic. The items presented to the aggregate are concatenated >>in the order in which they are presented to the

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Jens Alfke
> On Aug 15, 2017, at 12:22 PM, Keith Medcalf wrote: > > Well, the documentation is incorrect. The ordering is entirely > deterministic. The items presented to the aggregate are concatenated in the > order in which they are presented to the aggregate function, and this > ordering is determi

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Keith Medcalf
On Tuesday, 15 August, 2017 09:52, Jens said: >> On Aug 15, 2017, at 8:12 AM, Bob Friesenhahn >> wrote: >> Notice that adding a 'where' clause has caused the order to be >>reversed from what was requested in the query. Why is this and what >>can I do to correct it? >It’s actually not reversed

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Keith Medcalf
"order by" is applied to the OUTPUT of the select and does absolutely nothing with respect of the traversal order of the underlying table when you are selecting an aggregate. So, the reason that you are seeing a different ordering is more likely connected to the use of the "where enable == 1"

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Jay Kreibich
On Aug 15, 2017, at 10:39 AM, Bob Friesenhahn wrote: > On Tue, 15 Aug 2017, Dan Kennedy wrote: > >> On 08/15/2017 10:12 PM, Bob Friesenhahn wrote: >>> select group_concat(name, ' ') AS 'names' from moca_config where enable == >>> 1 order by name; >> >> Maybe this: >> >> select group_concat

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Jens Alfke
> On Aug 15, 2017, at 8:12 AM, Bob Friesenhahn > wrote: > > Notice that adding a 'where' clause has caused the order to be reversed from > what was requested in the query. Why is this and what can I do to correct it? It’s actually not reversed; the ordering looks random. So it appears the OR

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Bob Friesenhahn
On Tue, 15 Aug 2017, Dan Kennedy wrote: On 08/15/2017 10:12 PM, Bob Friesenhahn wrote: select group_concat(name, ' ') AS 'names' from moca_config where enable == 1 order by name; Maybe this: select group_concat(name, ' ') AS 'names' from ( SELECT name FROM moca_config where enable == 1 ord

Re: [sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Dan Kennedy
On 08/15/2017 10:12 PM, Bob Friesenhahn wrote: select group_concat(name, ' ') AS 'names' from moca_config where enable == 1 order by name; Maybe this: select group_concat(name, ' ') AS 'names' from ( SELECT name FROM moca_config where enable == 1 order by name ); Dan. __

[sqlite] group_concat() reverses order given where clause?

2017-08-15 Thread Bob Friesenhahn
I am surprised by this behavior of group_concat(): sqlite> select group_concat(name, ' ') AS 'names' from moca_config order by name; names bonding cof lof_update moca_core_trace_enable preferred_nc rf_band verbose sqlite> select group_concat(name, ' ') AS 'names' from moca_config where enable =