On 2/27/19, Jean-Baptiste Gardette <jb.garde...@orens.fr> wrote:
> have you any explanation why the typof() output of
> "SELECT DerefDict_SQL('A'), typeof(DerefDict_SQL('A'))"
> gives "text" in Sequence A and "real" in Sequence B ?
>

No.

The code that determines the return type of a TCL UDF is here:
https://www.sqlite.org/src/artifact/6b19e7562195aaf8?ln=993-1018

As you can see, the interface is looking at the Tcl_Obj.typePtr value
to try to guess an appropriate return type.  This is considered bad
form in TCL since TCL makes no guarantees about the value of typePtr
for a Tcl_Obj.  But the technique has worked well for nearly two
decades.

What if we were to add a new option to the "db function" method of the
TCL interface that let you specify the return type of the
TCL-implemented UDF?  If the optional argument is omitted, then the
current behavior of trying to guess the return type based on typePtr
is used. But if the "-returntype TYPE" argument is present, it
determines which return type to use regardless of the value in the
typePtr.  Would that help your situation?

Note that my tests were run after compiling both TCL and SQLite from
sources.  There is no telling what non-standard changes may have been
added by people who assembled your pre-compiled binaries.



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

Reply via email to