On Sep 5, 2008, at 9:03 AM, paul schindler wrote: > > Hello, > > I have a virtual table and some (by me) declared datatypes are > "TEXT10" or > "INTEGER" or "DATE"... > > When I am using the function sqlite3_column_decltype() then I get > those > types back, that's great. But I have a problem with aggregate > functions. > E.g. the field "amount" with the datatype "INTEGER": > > sqlite3_column_decltype("select amount from myvirtualtable", 0) > returns > "INTEGER" -> good! > > BUT: > > sqlite3_column_decltype("select sum(amount) from myvirtualtable", 0) > returns > NULL -> very bad! > > Is there a possibility to get the declared datatype of an aggregate > function? > > Because the function sqlite3_column_type() always returns > SQLITE_NULL for my > virtual tables...
Aggregate functions do not have a declared datatype. Look at the interface definition for sqlite3_create_function(). We get to define the name of the function, the number of parameters, and the preferred text encoding. But there is no place to specify the return datatype. Indeed, many aggregate functions (ex: max()) return different datatypes depending on the datatypes of their inputs. In your example, the sum() function might return either real or integer - it returns integer if all arguments are integers and it returns real if any input value is a real. D. Richard Hipp [EMAIL PROTECTED] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users