Re: [sqlite] Creating operators for custom functions

2011-11-10 Thread Jay A. Kreibich
On Thu, Nov 10, 2011 at 11:59:31AM +0200, Vincas Dargis scratched on the wall:
> Hello,
> 
> It is very nice to have sqlite3_create_function() interface, so I can
> implement regexp() with Qt libraries that I use already.
> 
> Snippet from documentation says:
> 
> >The REGEXP operator is a special syntax for the regexp() user function.
> 
> So REGEXP is also an operator which works out of the box by calling
> the same regexp() implementation, but how about creating these
> 'aliases' for other custom functions? Is it possible?

  Not out of the box.  The keywords for REGEXP and MATCH are built into
  the parser.  Having them call through the SQL function table simply
  makes it easier to modify them.

> How this could be achieved? Do I have to make changes in parser for that?

  As far as I know, yes.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Creating operators for custom functions

2011-11-10 Thread Vincas Dargis
Hello,

It is very nice to have sqlite3_create_function() interface, so I can
implement regexp() with Qt libraries that I use already.

Snippet from documentation says:

>The REGEXP operator is a special syntax for the regexp() user function.

So REGEXP is also an operator which works out of the box by calling
the same regexp() implementation, but how about creating these
'aliases' for other custom functions? Is it possible?

I am interested in implementing regexp operators used in PostgreSQL
such as ~, ~*, !~ and !~* (from
http://www.postgresql.org/docs/9.1/static/functions-matching.html#FUNCTIONS-POSIX-TABLE
) for sake of SQL portability, but I don't have any success for even
creating functions with these kind of names...

How this could be achieved? Do I have to make changes in parser for that?

Thank you,

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