Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-11 Thread big stone
Hello, Thanks to Keith's help I succeeded to set up a comparison a "native" sqrt() versus a "python" mysqrt() function . The speed-up in a best case non-realistic scenario is only 40%. create_function() looks very performant. Regards, ___

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-10 Thread Keith Medcalf
I built-in an extension which defines all the standard math functions as SQL functions. >-Original Message- >From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- >boun...@sqlite.org] On Behalf Of big stone >Sent: Monday, 10 March, 2014 13:22 >To: sqlite-users@sqlite.org >Subject:

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-10 Thread big stone
Hello Keith, Thanks for the ".timer on" tip. I only succeed to get a "Error: not such function : sqrt" from default Sqlite.exe How did you get that "native" sqrt working ? regards, ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-09 Thread Simon Slavin
On 10 Mar 2014, at 1:38am, Stephen Chrzanowski wrote: > Apologies for the interruption and sort of off topic, but, is .timer part > of the CLI only or is it part of the SQL language? Can I get the result of > a timer from a call, or do I have to put a wrapper on my

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-09 Thread Keith Medcalf
On Sunday, 9 March, 2014 19:38, Stephen Chrzanowski inquired: >Apologies for the interruption and sort of off topic, but, is .timer part >of the CLI only or is it part of the SQL language? Can I get the result >of a timer from a call, or do I have to put a wrapper on my

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-09 Thread Stephen Chrzanowski
Apologies for the interruption and sort of off topic, but, is .timer part of the CLI only or is it part of the SQL language? Can I get the result of a timer from a call, or do I have to put a wrapper on my wrapper? On Sun, Mar 9, 2014 at 8:17 PM, Keith Medcalf wrote: > >

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-09 Thread Keith Medcalf
sqlite> create virtual table n using wholenumber; sqlite> .timer on sqlite> select sum(sqrt(value)) from n where value between 1 and 1000; 21097.4558874807 Run Time: real 0.001 user 0.00 sys 0.00 sqlite> select sum(sqrt(value)) from n where value between 1 and 100; 67166.458841

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-09 Thread big stone
Hello Max, Your link is pretty interesting. It looks that : - method1 should be easily implemented with SQLite "floating point" representation, - and with a very very small code size. Here is the benchmarking of the two available methods :

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-08 Thread Max Vlasov
On Sat, Mar 8, 2014 at 2:24 AM, big stone wrote: > Ooups ! > > Thanks to the awesome posts about "RPAD/LPAD", I understood that I could > already create a "sqrt()" function for SQLite3 in interpreted python. > Yes, that discussion was inspiring :) Looking at your task I

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-03-07 Thread big stone
Ooups ! Thanks to the awesome posts about "RPAD/LPAD", I understood that I could already create a "sqrt()" function for SQLite3 in interpreted python. (example) *** import sqlite3 db_filename = ':memory:' def mysqrt(s): """ returns sqrt(s)""" #must return a string, apparently

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-02-15 Thread Gabor Grothendieck
On Fri, Feb 14, 2014 at 2:33 PM, Max Vlasov wrote: > Hi, > > Some time ago when there was no "instr" functions, I looked at Mysql help > pages and implemented a user function "locate" as the one that allows > searching starting a particular position in the string. With two

Re: [sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-02-15 Thread big stone
+1 . A few more 'classic/simple' sql instructions would not be a bad thing : sqrt(), locate(substring, string, start), ... They are not in a sql official "normalisation", but : - '%' is not either, - avg() looks a little bit incomplete without sqrt().

[sqlite] Suggestion to add "locate" as a broader version of "instr"

2014-02-14 Thread Max Vlasov
Hi, Some time ago when there was no "instr" functions, I looked at Mysql help pages and implemented a user function "locate" as the one that allows searching starting a particular position in the string. With two parameters form it was just identical to "instr" only the order of parameters was