Subject | Re: [Firebird-Architect] Sets of fields |
---|---|
Author | unordained |
Post date | 2006-03-21T21:28:02Z |
Thanks, you've provided me with a good example of something we could use user-defined types for (in
this case, a "tuple" type with a N-field constructor.)
On the other hand, it would also imply the need for va_arg-like arguments, which ... isn't really
compatible with the way Firebird stores the descriptions of parameters to known functions. (As I
see no way for it to know about functions that can take, and use, any number of parameters.)
But I still think it's a good idea, if unlikely to happen in any sort of 'clean' way.
Note that your last query can also be done as a join (as that's really what it is anyway) --
matching on several fields at once, but with hardcoded data for the join-to table. You could do
that (assuming it worked, which maybe it will in FB2?) as
select a, b, c from table inner join
select 1 bob, 2 larry from rdb$database
union
select 2 bob, 1 larry from rdb$database
union
select 4 bob, 6 larry from rdb$database
on d = bob and e = larry;
-Philip
this case, a "tuple" type with a N-field constructor.)
On the other hand, it would also imply the need for va_arg-like arguments, which ... isn't really
compatible with the way Firebird stores the descriptions of parameters to known functions. (As I
see no way for it to know about functions that can take, and use, any number of parameters.)
But I still think it's a good idea, if unlikely to happen in any sort of 'clean' way.
Note that your last query can also be done as a join (as that's really what it is anyway) --
matching on several fields at once, but with hardcoded data for the join-to table. You could do
that (assuming it worked, which maybe it will in FB2?) as
select a, b, c from table inner join
select 1 bob, 2 larry from rdb$database
union
select 2 bob, 1 larry from rdb$database
union
select 4 bob, 6 larry from rdb$database
on d = bob and e = larry;
-Philip