So how does SQLite distinguish between the built-in:
{ "like", 2, SQLITE_NUMERIC, likeFunc },
and a user-defined function such as
{ "like", 2, SQLITE_NUMERIC, my_like_function },
then?
-----Original Message-----
From: Mrs. Brisby [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 27, 2004 12:27 PM
To: [EMAIL PROTECTED]
Cc: D. Richard Hipp; [EMAIL PROTECTED]
Subject: Re: [sqlite] escaping " and % in sql statements
On Mon, 2004-01-26 at 09:08, [EMAIL PROTECTED] wrote:
> "D. Richard Hipp" <[EMAIL PROTECTED]> writes:
>
> > As an interim workaround, you could defined your own
> > "like()" function using the sqlite_create_function() API
> > that implemented built-in escapes. Any user-defined
> > function named "like()" is used to implement the LIKE
> > keyword of SQL.
>
> That seems pretty dangerous, since no one would expect that function name
to
> exist as a public symbol in a library. I would suggest changing the name
of
> the internal like() function to sqlite_like() or some equivalent, to avoid
> potential problems. Being able to overload internal functions could be a
nice
> feature (which should be documented) but it seems the names should be
clearly
> associated with sqlite.
I do not think you understand.
SQLite has no "deep magic" allowing it to figure out what you call your
own symbols: The built-in like() function is a static symbol in func.c
called "likeFunc", and your code has nothing at all to do with this.
You make a call like this:
sqlite_create_function(p, "like", 2, my_like_func, 0);
after defining your own function; in this example it's called
"my_like_function" - but you can certainly call it whatever you like,
including sqlite_like, if you're so inclined.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]