opaque type casting ?????
Posted in 2000
Topics: Stored Procedures & SPL, Data Types & Schema Design
I want to cast an sp2box (rectangle or bounding box object) directly to 4 integers (being x1,y1,x2,y2), is this possible and/or how can I do this ??? I know I can insert and retrieve data into the opaque type by using an LVARCHAR = '('||x1||','||y1||','||x2||','||y2||')'; but this is not interesting if you have to perform calculations on bounding boxes. It would require to use 'SUBSTR' functions to split up the string into 4 numbers .... this does not seem interesting. Regards, David.
David Van Huffel wrote:
> I want to cast an sp2box (rectangle or bounding box object) directly to
> 4 integers (being x1,y1,x2,y2), is this possible and/or how can I do
> this ???
> I know I can insert and retrieve data into the opaque type by using an
> LVARCHAR = '('||x1||','||y1||','||x2||','||y2||')'; but this is not
> interesting if you have to perform calculations on bounding boxes.
Well first, where did you get the 2D spatial blade? ;-) I'm not sure that
it's still supported. I mean, it will work.
There is no way to 'cast' an instance of one type into four seperate
instances of another. You might do it using a UDF that has OUT PARAMATERs,
but I'm not sure that will get you were you want to go any quicker.
The Blade comes with a huge array of methods to work with boxes. I am
prepared to bet that whatever you want to do, there is already a UDF in the
system. Or of there isn't, then there is a way to combine what's in there
to do what you want.
The following system catalog query extracts a full list of them.
Unfortunately, the Blade itself does not provide much in the way of
documentation explaining precisely how these various things work.
SELECT P.procname,
P.paramtypes,
ifx_ret_types(P.procid) AS Return_Types,
P.numargs,
P.owner
FROM SYSPROCEDURES P
WHERE ( ifx_ret_types(P.procid)::lvarchar LIKE '%sp2box%'
OR P.paramtypes::lvarchar LIKE '%sp2box%' )
AND P.numargs = 1
ORDER BY 1;
Hope this helps!
KR
Pb
I simply want to retrieve x1,y1,x2,y2 and add a certain value to them, so that
the bounding box becomes bigger.
Paul Brown wrote:
> David Van Huffel wrote:
>
> > I want to cast an sp2box (rectangle or bounding box object) directly to
> > 4 integers (being x1,y1,x2,y2), is this possible and/or how can I do
> > this ???
> > I know I can insert and retrieve data into the opaque type by using an
> > LVARCHAR = '('||x1||','||y1||','||x2||','||y2||')'; but this is not
> > interesting if you have to perform calculations on bounding boxes.
>
> Well first, where did you get the 2D spatial blade? ;-) I'm not sure that
> it's still supported. I mean, it will work.
>
> There is no way to 'cast' an instance of one type into four seperate
> instances of another. You might do it using a UDF that has OUT PARAMATERs,
> but I'm not sure that will get you were you want to go any quicker.
>
> The Blade comes with a huge array of methods to work with boxes. I am
> prepared to bet that whatever you want to do, there is already a UDF in the
> system. Or of there isn't, then there is a way to combine what's in there
> to do what you want.
>
> The following system catalog query extracts a full list of them.
> Unfortunately, the Blade itself does not provide much in the way of
> documentation explaining precisely how these various things work.
>
> SELECT P.procname,
> P.paramtypes,
> ifx_ret_types(P.procid) AS Return_Types,
> P.numargs,
> P.owner
> FROM SYSPROCEDURES P
> WHERE ( ifx_ret_types(P.procid)::lvarchar LIKE '%sp2box%'
> OR P.paramtypes::lvarchar LIKE '%sp2box%' )
> AND P.numargs = 1
> ORDER BY 1;>
> Hope this helps!
>
> KR
>
> Pb