If  you call sqlite3_create_function_v2() with a function name that is the
name of a built-in function, then the built-in function goes away and is
replaced by your application-defined function.  The original built-in
function is no longer accessible.  *Any* built-in function can be
overloaded in this way.


On Wed, Sep 11, 2013 at 4:35 PM, Stephan Beal <sgb...@googlemail.com> wrote:

> Hi, all,
>
> i'm looking for a clarification on what is certainly a bit of pedantry on
> my part:
>
> http://www.sqlite.org/c3ref/create_function.html
>
> specifies that we can overload built-in funcs with UDFs:
>
> "Built-in functions may be overloaded by new application-defined
> functions."
>
> Does "overload" imply "override" if the name/arg count/encoding/state
> match, or is it an error to override a function? The docs don't seem to
> explicitly mention the (admittedly unusual) exact-match case, but the
> paragraph above that one seem to be intended that a name/arg-count overload
> is an error:
>
> "It is permitted to register multiple implementations of the same functions
> with the same name but with either differing numbers of arguments or
> differing preferred text encodings."
>
>
> i've been on this list long enough to know that someone out there is going
> to ask, "why would you do that?" In brief: in porting the Fossil SCM to a
> library API i need to use a different approach to how it overrides
> localtime() with its own variant (it uses a C macro to replace localtime()
> with fossil_localtime(), which uses app-global state, whereas i have a
> library API and thus local state), and currently overriding it, as opposed
> to overloading it, is what i'm aiming to do (when the time comes to port
> those bits, which isn't tonight). But... i won't if you guys can tell me in
> advance that it will fail.
>
> Happy Hacking!
>
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
> http://gplus.to/sgbeal
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to