Re: [sqlite] Unregister UDF, created with sqlite3_create_function_v2

2016-12-18 Thread Bart Smissaert
Thanks, that was it. I had done the encoding the same (but also tried 0), but the arguments were always set at 0. Now with the arguments the same as at registration it works fine. Maybe this should be added to the documentation of create_function. RBS On Mon, Dec 19, 2016 at 7:03 AM, Dan Kennedy

Re: [sqlite] Unregister UDF, created with sqlite3_create_function_v2

2016-12-18 Thread Dan Kennedy
On 12/19/2016 03:32 AM, Bart Smissaert wrote: Using the latest SQLite from VB6 and trying to unregister a UDF, created with sqlite3_create_function_v2. This registration works fine and the UDF's work fine. Now I am trying to unregister this UDF and the only hint how to do this that I could find

Re: [sqlite] Weird chars inserted

2016-12-18 Thread Rowan Worth
On 19 December 2016 at 08:24, Kevin wrote: > Hi Martin, > > I had a go using a terminal session, with default encoding UTF-8. > > Try using the hex( ) and unicode( ) functions to check what is actually > stored in the sqlite table. > > I put a couple of rows at the end of an

Re: [sqlite] Weird chars inserted

2016-12-18 Thread Keith Medcalf
Inquiring minds want to know how a selection of 5 values resulted in a result list of 6 values ... > -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Kevin > Sent: Sunday, 18 December, 2016 17:25 > To: Ariel M. Martin > Cc:

[sqlite] Weird chars inserted

2016-12-18 Thread Kevin
Hi Martin, I had a go using a terminal session, with default encoding UTF-8. Try using the hex( ) and unicode( ) functions to check what is actually stored in the sqlite table. I put a couple of rows at the end of an existing simple table kevin@kevin-Aspire-V5-571G:~$ sqlite3

Re: [sqlite] Weird chars inserted

2016-12-18 Thread Jean-Christophe Deschamps
Igor, On 12/18/2016 7:17 AM, Jean-Christophe Deschamps wrote: Since your DB is UTF-16LE encoded, you shouldn't convert your strings to UTF8. int nRet= sqlite3_exec(m_hDB, szSQL, NULL, 0, ); alone should work fine. No it should not. The encoding of the database is irrelevant here:

[sqlite] Unregister UDF, created with sqlite3_create_function_v2

2016-12-18 Thread Bart Smissaert
Using the latest SQLite from VB6 and trying to unregister a UDF, created with sqlite3_create_function_v2. This registration works fine and the UDF's work fine. Now I am trying to unregister this UDF and the only hint how to do this that I could find was in the documentation of

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Keith Maxwell
Keith Brilliant! Thank you. > Correlated (outer) columns are not permitted in the ORDER BY clause At least I've learnt a new term [1]. Reading the documentation again [2], I think a change to the paragraph below would make this clearer: 3. Otherwise, if the ORDER BY expression is any other

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Keith Medcalf
Correlated (outer) columns are not permitted in the ORDER BY clause -- only items from the SELECT list (or from the directly selected tables). Normally in a correlated subquery the outer columns are only (designed to be) used in the WHERE clause of the correlated subquery, although they may

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Keith Maxwell
Simon, Stephen Thank again. Did you try the other queries I've included? I've tried to include two that show sub-queries using z from the main query. The simplest one (not a useful query, just illustrates a sub-query using z): sqlite> SELECT (SELECT z FROM t1 LIMIT 1) FROM t2; 4 And the

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Simon Slavin
On 18 Dec 2016, at 6:41pm, Keith Maxwell wrote: > Thanks again, maybe I didn't ask the question in the best way: why > with the query below do I get "Error: no such column: z"? > > SELECT (SELECT y FROM t1 ORDER BY abs(x - z) LIMIT 1) FROM t2; Because the inner

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Stephen Chrzanowski
As stated, the Z does not exist to the inner query. The [ SELECT y FROM t1 ORDER BY abs(x - z) LIMIT 1 ] has no reference to what Z means. T2 may have it, but the inner query has no regards for the outer query. On Sun, Dec 18, 2016 at 1:41 PM, Keith Maxwell wrote: >

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Keith Maxwell
Simon Thanks again, maybe I didn't ask the question in the best way: why with the query below do I get "Error: no such column: z"? SELECT (SELECT y FROM t1 ORDER BY abs(x - z) LIMIT 1) FROM t2; There are workarounds or similar queries that produce the answer (an example is below). I posted

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Simon Slavin
On 18 Dec 2016, at 6:13pm, Keith Maxwell wrote: > I'm afraid I don't follow Simon. z is a column in t2. The sub-select > uses z in an expression in its order by clause: abs(x - z). What do > you mean by "your sub-select only refers to table t1"? Then perhaps instead of

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Keith Maxwell
Simon, Stephen thank you for trying to help. I'm afraid I don't follow Simon. z is a column in t2. The sub-select uses z in an expression in its order by clause: abs(x - z). What do you mean by "your sub-select only refers to table t1"? > SELECT (13, 3, 94) FROM t2 `LIMIT 1` on the sub-query

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Stephen Chrzanowski
Your inner query only deals with what I've left in the quote below. Z doesn't exist to the inner query. On Sun, Dec 18, 2016 at 8:57 AM, Keith Maxwell wrote: > I've read the documentation[1] a few times and I don't understand why I > get: > CREATE TABLE t1(x

Re: [sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Simon Slavin
On 18 Dec 2016, at 1:57pm, Keith Maxwell wrote: >CREATE TABLE t1(x INTEGER, y INTEGER); >INSERT INTO t1(x, y) VALUES(2, 1), (3, 2), (6, 4); >CREATE TABLE t2(z INTEGER); >INSERT INTO t2(z) VALUES(4); >SELECT (SELECT y FROM t1 ORDER BY abs(x - z) LIMIT

[sqlite] Unexpected 'no such column' with expression in subquery ORDER BY

2016-12-18 Thread Keith Maxwell
I've read the documentation[1] a few times and I don't understand why I get: Error: no such column: z with a query like the one below: CREATE TABLE t1(x INTEGER, y INTEGER); INSERT INTO t1(x, y) VALUES(2, 1), (3, 2), (6, 4); CREATE TABLE t2(z INTEGER); INSERT INTO t2(z)

Re: [sqlite] Weird chars inserted

2016-12-18 Thread Igor Tandetnik
On 12/18/2016 7:17 AM, Jean-Christophe Deschamps wrote: Since your DB is UTF-16LE encoded, you shouldn't convert your strings to UTF8. int nRet= sqlite3_exec(m_hDB, szSQL, NULL, 0, ); alone should work fine. No it should not. The encoding of the database is irrelevant here: sqlite3_exec

Re: [sqlite] Weird chars inserted

2016-12-18 Thread Igor Tandetnik
On 12/17/2016 8:38 PM, Ariel M. Martin wrote: Note: szSQL is the wchar-string my app uses char szAux[2048]; ZeroMemory(szAux, 2048); WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, szSQL, wcslen(szSQL), szAux, 2048, NULL, 0); Replace CP_ACP with CP_UTF8. -- Igor

Re: [sqlite] Weird chars inserted

2016-12-18 Thread Jean-Christophe Deschamps
Ariel, At 02:38 18/12/2016, you wrote: Hi people. I need some help I’m lost here. I’m writing an application using SQLite and whenever I insert Spanish characters I get this kind of strings: Mart�n (where it should read ‘Martín’) Ok, so if I open my database with SQLiteManager

[sqlite] Weird chars inserted

2016-12-18 Thread Ariel M. Martin
Hi people. I need some help I’m lost here. I’m writing an application using SQLite and whenever I insert Spanish characters I get this kind of strings: Mart�n (where it should read ‘Martín’) Ok, so if I open my database with SQLiteManager (the Firefox addin) my strings look weird like that. But