Re: [sqlite] listing registered SQL functions (aggregate or scalar)

2009-04-29 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

ddevienne wrote:
> How does one get this list? 

There is no public API.  If you use the amalgamation then you can add
code to dig it out of the SQLite internals (a hash table amongst other
things).  Look for functionSearch and sqlite3FindFunction

> Or asked differently, how would a user know
> which SQL functions she can use unless there's a way to list them in SQL?

They read this page http://sqlite.org/lang_corefunc.html

> In general, I'd also like to be able to tell the cardinality of the function
> as passed as nArg to sqlite3_create_function. Is that also possible?

Note that there can be multiple implementations of the same function
taking different numbers of arguments.  For example the builtin lower()
takes one argument, and ICU adds a variant taking two (the second
argument is the locale).

If this is still important to you, then I suggest writing the code that
returns all functions via a pragma or something similar and contribute
it back http://sqlite.org/contrib  - if your code is small enough then
you have a case to make it a standard part of SQLite.

In any event I recommend you create a bug ticket (type enhancement) so
that your issue is not forgotten.  Include your use case so others can
judge how valuable it would be if implemented.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkn5RwIACgkQmOOfHg372QTpQQCg24NkzfYHZLmFlWuUN+cWLezd
dy0AoIP9/DUBgtBTCSPE5TRe3GsTo+R7
=MKaD
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] listing registered SQL functions (aggregate or scalar)

2009-04-29 Thread Dennis Cote
ddevienne wrote:
> I can't find a way to list registered functions (the built-in ones and the
> ones added programmatically) via an API call nor via a built-in table like
> there is for tables in sqlite_master, which I could query.
>
> How does one get this list? Or asked differently, how would a user know
> which SQL functions she can use unless there's a way to list them in SQL?
>
> We have a UI which allows to aggregate rows by selecting a column and an
> aggregate function, but we must hard code the list of aggregate functions
> instead of introspecting the connection for all available aggregate
> functions.
>
> In general, I'd also like to be able to tell the cardinality of the function
> as passed as nArg to sqlite3_create_function. Is that also possible?
>
> Thanks, --DD
>   
No, I don't think there is any way to do that for functions.

You can get a list of registered collations using the "pragma 
collation_list", but there is no equivalent for functions.

SQLite seems to assume that only the application that creates a function 
will ever use the function, so there is no need for this information.

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


[sqlite] listing registered SQL functions (aggregate or scalar)

2009-04-29 Thread ddevienne

I can't find a way to list registered functions (the built-in ones and the
ones added programmatically) via an API call nor via a built-in table like
there is for tables in sqlite_master, which I could query.

How does one get this list? Or asked differently, how would a user know
which SQL functions she can use unless there's a way to list them in SQL?

We have a UI which allows to aggregate rows by selecting a column and an
aggregate function, but we must hard code the list of aggregate functions
instead of introspecting the connection for all available aggregate
functions.

In general, I'd also like to be able to tell the cardinality of the function
as passed as nArg to sqlite3_create_function. Is that also possible?

Thanks, --DD
-- 
View this message in context: 
http://www.nabble.com/listing-registered-SQL-functions-%28aggregate-or-scalar%29-tp23302390p23302390.html
Sent from the SQLite mailing list archive at Nabble.com.

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