Re: [sqlite] Example/recipe for truncating fp numbers

2017-07-11 Thread Jean-Marie CUAZ
To M. Slavin, Medcalf ans Hipp: Thanks for your attention. Yes, "cast(value * 1000 as integer) / 1000.0" is much better and I will switch to your formula when possible, thanks very much. Thank you for your offer of C functions : a trunc() function is certainely what is needed, but I don't

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Jens Alfke
> On Jul 11, 2017, at 12:02 PM, Richard Hipp wrote: > > Surely you should prioritize creating a loadable extension containing > your custom tokenizer, for occasions such as this, no? It’s one of those nice-to-have things that I never get around to, because any time the need

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Richard Hipp
On 7/11/17, Jens Alfke wrote: > >> On Jul 11, 2017, at 10:35 AM, Richard Hipp wrote: >> >> Generally speaking, FTS4 (and FTS3 and FTS5) requires no more than one >> MATCH operator in the WHERE clause for each FTS4 table in the FROM >> clause, and that one

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Jens Alfke
> On Jul 11, 2017, at 10:35 AM, Richard Hipp wrote: > > Generally speaking, FTS4 (and FTS3 and FTS5) requires no more than one > MATCH operator in the WHERE clause for each FTS4 table in the FROM > clause, and that one MATCH operator must be a conjunct. Sorry, another

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Richard Hipp
On 7/11/17, Jens Alfke wrote: > >> On Jul 11, 2017, at 10:35 AM, Richard Hipp wrote: >> >> Generally speaking, FTS4 (and FTS3 and FTS5) requires no more than one >> MATCH operator in the WHERE clause for each FTS4 table in the FROM >> clause, and that one

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Jens Alfke
> On Jul 11, 2017, at 10:35 AM, Richard Hipp wrote: > > Generally speaking, FTS4 (and FTS3 and FTS5) requires no more than one > MATCH operator in the WHERE clause for each FTS4 table in the FROM > clause, and that one MATCH operator must be a conjunct. By “conjunct” you mean

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Richard Hipp
On 7/11/17, Jens Alfke wrote: > > Hm. How can I find out more about what specific limitation of FTS4 I’ve run > into? Generally speaking, FTS4 (and FTS3 and FTS5) requires no more than one MATCH operator in the WHERE clause for each FTS4 table in the FROM clause, and that

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Jens Alfke
> On Jul 11, 2017, at 10:08 AM, Richard Hipp wrote: > > But in the specific query you have, FTS4 is unable to handle > the MATCH function and so it answers "no". Or, maybe due to the OR > clause, the query planner is not able to factor out the MATCH function > and so it never

Re: [sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Richard Hipp
On 7/11/17, Jens Alfke wrote: > I’m using FTS4, and queries involving a single MATCH expression work fine. > But if there are two MATCH expressions, the queries generated by my code > fail to compile, with an error "unable to use function MATCH in the > requested context”. Can

[sqlite] Error "unable to use function MATCH in the requested context"

2017-07-11 Thread Jens Alfke
I’m using FTS4, and queries involving a single MATCH expression work fine. But if there are two MATCH expressions, the queries generated by my code fail to compile, with an error "unable to use function MATCH in the requested context”. Can someone explain what’s going wrong? Example query that

[sqlite] IP address changes for www.sqlite.org

2017-07-11 Thread Richard Hipp
Due to upstream infrastructure changes, the www.sqlite.org website is getting a new IPv4 address. (The IPv6 address is the same.) I *think* have updated all of the DNS records and reconfigured the server correctly. But if you have trouble over the next couple of days, please send email directly

Re: [sqlite] Example/recipe for truncating fp numbers

2017-07-11 Thread Keith Medcalf
On Tuesday, 11 July, 2017 07:24, David Raymond said: > Not to be the new guy here, but would someone be so good as to explain why > no one else is panicking that the modulo operator is horrifically broken? > In http://www.sqlite.org/lang_expr.html it just says: > "The

Re: [sqlite] Example/recipe for truncating fp numbers

2017-07-11 Thread David Raymond
Not to be the new guy here, but would someone be so good as to explain why no one else is panicking that the modulo operator is horrifically broken? In http://www.sqlite.org/lang_expr.html it just says: "The operator % outputs the value of its left operand modulo its right operand." There's

Re: [sqlite] Example/recipe for truncating fp numbers

2017-07-11 Thread R Smith
On 2017/07/11 2:31 PM, Richard Hipp wrote: Truncation is a string operation, not a mathematical operation. So I suggest using string functions: WITH SRC(Val) AS ( VALUES (0),(1.001),(1.12345678),(1.),(1.888), (9.87654321),(1.5),(1.499),(1.49494999),

Re: [sqlite] Example/recipe for truncating fp numbers

2017-07-11 Thread Richard Hipp
Truncation is a string operation, not a mathematical operation. So I suggest using string functions: WITH SRC(Val) AS ( VALUES (0),(1.001),(1.12345678),(1.),(1.888), (9.87654321),(1.5),(1.499),(1.49494999), (12345.67890123), (1234.56) UNION ALL SELECT

Re: [sqlite] Example/recipe for truncating fp numbers

2017-07-11 Thread R Smith
In case any astute mathematicians were paying attention to this thread - the previous solution I offered would obviously fail on Negative values - which may or may not be a requirement. Either way, I've amended it to work for all values, but I think Keith's method might be better than this

Re: [sqlite] Example/recipe for truncating fp numbers

2017-07-11 Thread R Smith
On 2017/07/11 3:51 AM, Richard Hipp wrote: On 7/10/17, Jean-Marie CUAZ wrote: Hello, Below is a recipe on a "best effort" basis, to truncate fp numbers on the right side of the decimal separator with SQLite. I don't understand how this is different from "round(N,3)"? What

Re: [sqlite] Remotely use Database File

2017-07-11 Thread Clemens Ladisch
Milav Soni [Teq Diligent] wrote: > I want to connect/open/read/write the Sqlite3 Database File through > Remotely (using "ssh"). SQLite accesses database files as files. So if you want to open a database through SSH, you have to use a file system that works through SSH. (There is sshfs, which

[sqlite] Remotely use Database File

2017-07-11 Thread Milav Soni [Teq Diligent]
Hello, Everyone.. This is Milav From Teq Diligent, India. I want to connect/open/read/write the Sqlite3 Database File through Remotely (using "ssh"). is this possible in sqlite3? if yes, than Please Give me information about how to connect/open the .db file through SSH. Regards Milav.