On Wed, 22 May 2019 21:16:04 -0600
"Keith Medcalf" <[email protected]> wrote:
> Basically, when you declared something as a UDT you were giving a
> "blob" a type-domain. Whenever you tried to do something with a UDT
> a "mangled function name" was generated that took that blob as the
> first argument and you merely implemented a bunch of functions with
> the appropriate names that DB2 would use whenever you referred to
> that UDT type, rather than using the builtin functions (this is
> similar to the way languages like Python implement classes).
I see. First, declare a type U. Then define a function, say,
U max( U, U ) .
Now, if we have a table
T( U u )
we can
SELECT max(u) from T
to invoke our function instead of the built-in max().
What about operators, then, as long as we're talking C++?
U operator<(U u) ?
If you could define equivalence and less-than, you can join on, sort
by, or get the maximium. In fact (speaking of Python), you get those
for free if there's an implicit conversion to string.
--jkl
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users