[sqlite] Error message from sqlite3_tokenizer_module.xCreate?

2009-11-30 Thread Ralf Junker
I am passing various arguments to sqlite3_tokenizer_module.xCreate. In case 
they are invalid, I would like to return an explaining error message in 
addition to SQLITE_ERROR. I did not find a way to do this. Is it at all 
possible?

Thanks, Ralf

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Error message from sqlite3_tokenizer_module.xCreate?

2009-11-30 Thread Ralf Junker
I am passing various arguments to sqlite3_tokenizer_module.xCreate. In case 
they are invalid, I would like to return an explaining error message in 
addition to SQLITE_ERROR. I did not find a way to do this. Is it at all 
possible?

Thanks, Ralf

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error message from sqlite3_tokenizer_module.xCreate?

2009-11-30 Thread Grzegorz Wierzchowski
Monday 30 of November 2009 12:29:10 Ralf Junker napisał(a):
> I am passing various arguments to sqlite3_tokenizer_module.xCreate. In case
> they are invalid, I would like to return an explaining error message in
> addition to SQLITE_ERROR. I did not find a way to do this. Is it at all
> possible?
>
> Thanks, Ralf

The last argument of xCreate() is  char **pzErr.
It is exactly designed for the purpose you describe.
See also description in doc-zip: sqlite-3_6_18-docs/vtab.html, or 
http://www.sqlite.org/vtab.html

Thanks,
Grzegorz W.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error message from sqlite3_tokenizer_module.xCreate?

2009-11-30 Thread Ralf Junker
On 30.11.2009 20:33, Grzegorz Wierzchowski wrote:
> Monday 30 of November 2009 12:29:10 Ralf Junker napisał(a):
>> I am passing various arguments to sqlite3_tokenizer_module.xCreate. In case
>> they are invalid, I would like to return an explaining error message in
>> addition to SQLITE_ERROR. I did not find a way to do this. Is it at all
>> possible?
>>
>> Thanks, Ralf
>
> The last argument of xCreate() is  char **pzErr.
> It is exactly designed for the purpose you describe.
> See also description in doc-zip: sqlite-3_6_18-docs/vtab.html, or
> http://www.sqlite.org/vtab.html

Thank you for your answer! I believe you are mixing up the virtual table 
sqlite3_module.xCreate() in sqlite3.h and 
sqlite3_tokenizer_module.xCreate() in fts3_tokenizer.h.

The latter does not have the pzErr argument:

struct sqlite3_tokenizer_module {



int (*xCreate)(
 int argc,   /* Size of argv array */
 const char *const*argv, /* Tokenizer argument strings */
 sqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */
   );

So I believe my question remains unanswered. Any suggestion, anyone?

Ralf
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error message from sqlite3_tokenizer_module.xCreate?

2009-12-01 Thread Dan Kennedy

On Dec 1, 2009, at 2:17 PM, Ralf Junker wrote:

> On 30.11.2009 20:33, Grzegorz Wierzchowski wrote:
>> Monday 30 of November 2009 12:29:10 Ralf Junker napisał(a):
>>> I am passing various arguments to  
>>> sqlite3_tokenizer_module.xCreate. In case
>>> they are invalid, I would like to return an explaining error  
>>> message in
>>> addition to SQLITE_ERROR. I did not find a way to do this. Is it  
>>> at all
>>> possible?
>>>
>>> Thanks, Ralf
>>
>> The last argument of xCreate() is  char **pzErr.
>> It is exactly designed for the purpose you describe.
>> See also description in doc-zip: sqlite-3_6_18-docs/vtab.html, or
>> http://www.sqlite.org/vtab.html
>
> Thank you for your answer! I believe you are mixing up the virtual  
> table
> sqlite3_module.xCreate() in sqlite3.h and
> sqlite3_tokenizer_module.xCreate() in fts3_tokenizer.h.
>
> The latter does not have the pzErr argument:
>
> struct sqlite3_tokenizer_module {
>
> 
>
> int (*xCreate)(
> int argc,   /* Size of argv array */
> const char *const*argv, /* Tokenizer argument  
> strings */
> sqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */
>   );
>
> So I believe my question remains unanswered. Any suggestion, anyone?

I don't think it is possible at the moment. Unfortunately.

Dan.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error message from sqlite3_tokenizer_module.xCreate?

2009-12-01 Thread Ralf Junker
On 01.12.2009 09:01, Dan Kennedy wrote:

> I don't think it is possible at the moment. Unfortunately.

Thanks for the clarification, Dan!

I observe that you are currently writing the "official" FTS3
documentation in preparation for the next release of SQLite.

Maybe you want to make tokenizer error messages possible before the docs
are finished and the "unfortunate" xCreate API is carved in stone?

;-)

Ralf
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Error message from sqlite3_tokenizer_module.xCreate?

2009-12-03 Thread Ralf Junker
On 01.12.2009 09:01, Dan Kennedy wrote:

>> Monday 30 of November 2009 12:29:10 Ralf Junker napisał(a):

>> I am passing various arguments to sqlite3_tokenizer_module.xCreate.
>> In case they are invalid, I would like to return an explaining
>> error message in addition to SQLITE_ERROR. I did not find a way to
>> do this. Is it at all possible?

> I don't think it is possible at the moment. Unfortunately.

Dan, thanks for the confirmation.

Related to this, I noticed check-in [620a8a2b38] which avoids using an
uninitialized variable for the error message issued when
sqlite3_tokenizer_module.xCreate returns an error. The error message is now:

   pzErr = sqlite3_mprintf("unknown tokenizer");

I believe that the message is misleading because the tokenizer is not
unknown. The error is that a registered tokenizer can not be created.

Personally, I would like to see an error message giving the proper
reason and the name of the tokenizer:

   pzErr = sqlite3_mprintf(
 "cannot create tokenizer %s");

Also giving the tokenizer arguments is naturally helpful for
debugging and end-user support:

   pzErr = sqlite3_mprintf(
 "cannot create tokenizer %s with arguments %s");

Ralf
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users