Re: [sqlite] unrecognized parameter: content=""

2012-07-21 Thread AJ ONeal
I'm on OS X brew install sqlite3 sqlite3 --version 3.7.13 2012-06-11 02:05:22 f5b5a13f7394dc143aa136f1d4faba6839eaa6dc Interestingly when I do it like this it works: sqlite3 ':memory:' 'CREATE VIRTUAL TABLE t1 USING fts4(content="", a, b, c);' But when I do it like this sqlite3 -init

Re: [sqlite] unrecognized parameter: content=""

2012-07-21 Thread AJ ONeal
Weird: now that I've reproduced the error (using the script), I can no longer reproduce the successful execution: sqlite3 ':memory:' 'CREATE VIRTUAL TABLE t1 USING fts4(content="", a, b, c);' Hmm... yet when I open another terminal window it begins to work again. And when I go back to the

Re: [sqlite] unrecognized parameter: content=""

2012-07-21 Thread Dan Kennedy
On 07/21/2012 02:03 PM, AJ ONeal wrote: Weird: now that I've reproduced the error (using the script), I can no longer reproduce the successful execution: sqlite3 ':memory:' 'CREATE VIRTUAL TABLE t1 USING fts4(content="", a, b, c);' Hmm... yet when I open another terminal window it begins to

Re: [sqlite] unrecognized parameter: content=""

2012-07-21 Thread AJ ONeal
Very interesting indeed! ls ~/Library/Caches/Homebrew/sqlite-* sqlite-3.7.10.tar.gz sqlite-3.7.13.tar.gz # # in original (failing) terminal # sqlite3 --version 3.7.7 2011-06-25 16:35:41 8f8b373eed7052e6e93c1805fc1effcf1db09366 which sqlite3 /usr/bin/sqlite3 # # in new (succeeding) terminal #

[sqlite] How to compile and load the example fts4 rank function?

2012-07-21 Thread AJ ONeal
I naively tried wget https://raw.github.com/gist/3154964/d570955d45580c095c99de6eb0c378395d4b076d/sqlite3-fts4-rank.c gcc -c sqlite3-fts4-rank.c -o sqlite3-fts4-rank.o sqlite3 .load sqlite3-fts4-rank.o But that didn't work. Can I get a link to the docs on this? I don't think I was using the

Re: [sqlite] How to compile and load the example fts4 rank function?

2012-07-21 Thread Richard Hipp
On Sat, Jul 21, 2012 at 3:36 AM, AJ ONeal wrote: > I naively tried > > wget > > https://raw.github.com/gist/3154964/d570955d45580c095c99de6eb0c378395d4b076d/sqlite3-fts4-rank.c > gcc -c sqlite3-fts4-rank.c -o sqlite3-fts4-rank.o > > sqlite3 > .load sqlite3-fts4-rank.o > > But

Re: [sqlite] How to compile and load the example fts4 rank function?

2012-07-21 Thread AJ ONeal
That example isn't from a 3rd party. It's the rank function listed here: http://www.sqlite.org/fts3.html#appendix_a Can you give me a link to documentation for what options to pass to gcc and what functions to call to activate such an extension? I've never done this before. AJ ONeal On Sat,

Re: [sqlite] How to compile and load the example fts4 rank function?

2012-07-21 Thread Pavel Ivanov
On Sat, Jul 21, 2012 at 3:36 AM, AJ ONeal wrote: > I naively tried > > wget > https://raw.github.com/gist/3154964/d570955d45580c095c99de6eb0c378395d4b076d/sqlite3-fts4-rank.c > gcc -c sqlite3-fts4-rank.c -o sqlite3-fts4-rank.o > > sqlite3 > .load sqlite3-fts4-rank.o > > But

Re: [sqlite] How to compile and load the example fts4 rank function?

2012-07-21 Thread Tim Streater
On 21 Jul 2012 at 17:51, Pavel Ivanov wrote: > On Sat, Jul 21, 2012 at 3:36 AM, AJ ONeal wrote: >> I naively tried >> >> wget >> https://raw.github.com/gist/3154964/d570955d45580c095c99de6eb0c378395d4b076d/ >> sqlite3-fts4-rank.c >> gcc -c

Re: [sqlite] How to compile and load the example fts4 rank function?

2012-07-21 Thread Keith Medcalf
You need to wrap the rankfunc code with code to link back into the engine. You then need to define DLL_EXPORT to whatever (if anything) your platform compiler needs to generate an external shared library symbol, and then compile as a shared library. The code basically sets up the linkage

Re: [sqlite] How to compile and load the example fts4 rank function?

2012-07-21 Thread AJ ONeal
I have now built the example rank function and it loads without error. However, due to the matchinfo problem I discovered (and started a new thread about) I have yet to get the example to work correctly. Instead it always prints out Error: near line 19: wrong number of arguments to function

[sqlite] matchinfo example does not work as documented

2012-07-21 Thread AJ ONeal
According do http://www.sqlite.org/fts3.html#matchinfo sqlite3 test.sqlite3 CREATE VIRTUAL TABLE t1 USING fts4(a, b); INSERT INTO t1 VALUES('transaction default models default', 'Non transaction reads'); INSERT INTO t1 VALUES('the default transaction', 'these semantics present'); INSERT INTO t1

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread Richard Hipp
On Sat, Jul 21, 2012 at 2:05 PM, AJ ONeal wrote: > According do > http://www.sqlite.org/fts3.html#matchinfo > > sqlite3 test.sqlite3 > > CREATE VIRTUAL TABLE t1 USING fts4(a, b); > INSERT INTO t1 VALUES('transaction default models default', 'Non > transaction reads'); >

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread Richard Hipp
On Sat, Jul 21, 2012 at 3:39 PM, AJ ONeal wrote: > > > > matchinfo returns a blob. Try running "hex(matchinfo(t1))" so that you > can > > see the blob content. > > > Now I see a number which matches my expectations: > SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread AJ ONeal
> > > Now I see a number which matches my expectations: > > SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default transaction > > "these semantics"'; > > > > >

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread AJ ONeal
Specifically: -- The next set of three integers (0 1 1) pertain to the hits for "default" -- in column 1 of the table (0 in this row, 1 in all rows, spread across -- 1 rows). -- SELECT matchinfo(t1) FROM t1 WHERE t1 MATCH 'default transaction "these semantics"'; -- the blob appears as an empty

[sqlite] No documentation for xFunc?

2012-07-21 Thread AJ ONeal
According to http://www.sqlite.org/c3ref/create_function.html `sqlite3_create_function` accepts a callback parameter `void (*xFunc)(sqlite_func*,int,const char**)` However, I can't find the documentation which explains what the parameters to `xFunc` mean. http://www.sqlite.org/search?q=xfunc

Re: [sqlite] No documentation for xFunc?

2012-07-21 Thread AJ ONeal
Through experimentation it appears that the signature should be documented as void (*xFunc)(sqlite3_context* pCtx, int nArgs, sqlite3_value** apArgs) Where sqlite3_context* could be expressed as pCtx (the database connection) int could be expressed as nArgs (analogous to argc)

[sqlite] error in example rank function

2012-07-21 Thread AJ ONeal
Back to looking at http://www.sqlite.org/fts3.html#appendix_a Notice the line: if( nVal!=(1+nCol) ) goto wrong_number_args; nVal will always be 2 with the given use case: rank(matchinfo(documents), documents_data.weight) or in the previous use case it will be 1

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread Pavel Ivanov
On Sat, Jul 21, 2012 at 4:06 PM, AJ ONeal wrote: >> >> > Now I see a number which matches my expectations: >> > SELECT hex(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'default transaction >> > "these semantics"'; >> > >> > >>

Re: [sqlite] error in example rank function

2012-07-21 Thread AJ ONeal
I also found an error in the signedness of ints (using -Wall -Werror). The corrected code here functions as described in the documentation's example: https://github.com/coolaj86/sqlite3-fts4-rank/blob/master/fts4-rank.c#L59 AJ ONeal On Sat, Jul 21, 2012 at 4:39 PM, AJ ONeal

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread AJ ONeal
> > Read the documentation carefully: > http://www.sqlite.org/fts3.html#matchinfo. Right the first paragraph: > > The matchinfo function returns a blob value. If it is used within a > query that does not use the full-text index (a "query by rowid" or > "linear scan"), then the blob is zero bytes

[sqlite] Compiler Warning with sqlite 3.7.13

2012-07-21 Thread Sean Wilcox
When attempting to build sqlite3 on Solaris 11 with the following compile line : /opt/SUNWspro/sunstudio12.1/bin/cc -O -xspace -Xa -xildoff -errtags=yes -errwarn=%all -erroff=E_STATEMENT_NOT_REACHED -c -o objs/sqlite3.o ../src/sqlite3.c I get the following warning : "../src/sqlite3.c", line

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread Pavel Ivanov
On Sat, Jul 21, 2012 at 7:35 PM, AJ ONeal wrote: >> >> Read the documentation carefully: >> http://www.sqlite.org/fts3.html#matchinfo. Right the first paragraph: >> >> The matchinfo function returns a blob value. If it is used within a >> query that does not use the full-text

Re: [sqlite] matchinfo example does not work as documented

2012-07-21 Thread AJ ONeal
Not everyone who uses the sqlite docs is a 1337 c guru. Most of them are probably rubyists, pythonistas, some php script kiddies, and, as of late, android and ios devs (some of which are a bit more leet). Monkey see, monkey do. If I see output in comments, I expect the same output when I run the

Re: [sqlite] error in example rank function

2012-07-21 Thread AJ ONeal
Correction: my code functions as described in the documentation, but not as it is described in the comments of the example code. The example code comments state that the weight is determined by every column whereas the example given above the code states that the weight as determined by the row.

Re: [sqlite] Compiler Warning with sqlite 3.7.13

2012-07-21 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/07/12 14:42, Sean Wilcox wrote: > I agree this is simply a warning but, I'm concerned if there could be a > potential problem due to this warning. http://www.sqlite.org/faq.html#q17 Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11

Re: [sqlite] error in example rank function

2012-07-21 Thread Dan Kennedy
On 07/22/2012 05:39 AM, AJ ONeal wrote: Back to looking at http://www.sqlite.org/fts3.html#appendix_a Notice the line: if( nVal!=(1+nCol) ) goto wrong_number_args; nVal will always be 2 with the given use case: rank(matchinfo(documents), documents_data.weight) or in the previous