Hi,

The syntax for vectors with multiple dimensions is not documented yet,
so the documentation will be updated soon.
Your example vec[x][y] where vec := vector (a,b) crashes the server,
because no check for second dimension presence. 
The attached patch prevents server to crash in similar cases.

Best Regards,
Mitko



Peter Filipov wrote:
> Hi,
> thanks for the fast reply.
>
> I think I crashed the daemon, the pl source is sent as attachment.
> By the way the doc says:
>
> vec3 := vector(vector('a', 'b'), vector(1, 2));  -- vector of vectors
>
> Second-level elements of vec3 cannot be referenced as vec3[1][1].
>
>
>
> On Tue, 13 Feb 2007 15:46:09 +0200, Mitko Iliev
> <[email protected]> wrote:
>
>> Hi,
>>
>> If you have declared the user defined type (udt) to be 'self as ref'
>> e.g.
>>
>> create type testo as (val_int int) *self as ref*;
>>
>> create type testi as (val_o testo);
>>
>> then the assignments as :
>>
>> self.val_o :=  new testo ();
>>
>> self.val_o.val_int :=  x;
>>
>> must work.
>>
>> As for array[x][y] := val; this must be working too, in which case it
>> doesn't ?
>>
>> Best Regards,
>> Mitko
>> Peter Filipov wrote:
>>> Hi,
>>>
>>>     Because it is open source and I miss a feature
>>> I thought that with certain effort I may be able to implement what I
>>> need.
>>> It turned out that the source is quite complicated and has too little
>>> documentation(comments)
>>> for me to understand what's going on.
>>>     What I am trying to implement is 'inderect' assignment to an object
>>> member /mutating the object/.
>>> here is the pl code that I would like to work:
>>>
>>> create constructor method testi(in a int) for testi {
>>> --    declare b int;
>>>     self.val_o:= new testo();
>>>     self.val_o.val_int:=33;
>>> --    self.val_int:= 33;
>>> --    self.val_int:=a;   
>>> --    b:=a;
>>> }
>>> ;
>>>
>>> It is the 'self.val_o.val_int:=33;' line that I would like to make
>>> work.
>>> I would like also tho make the assignment to multidimensional arrays
>>> working:
>>> testarr[1][2]:=3;
>>>
>>>     I think the way to fulfill this is to hack the pl
>>> compilation/execution
>>> code,
>>> but as I said it looks too complicated and too little documented to me.
>>> (The postgres pl code seems a little more comprehensible to me, but
>>> this
>>> is another matter)
>>>     So can you give me any sources of documentation?
>>>     Or can you give me any advice how to handle the problem?
>>>
>>> The multistep assignment is not an option i think cause it will come
>>> out
>>> to be too slow for execution
>>> and too tedious to write each time.
>>>
>>> I suppose that the feature may be not sql/pl(whatever) standards
>>> compliant
>>> but i think it is usable if
>>> one wishes to have more code in pl.
>>>
>>> Best Regards,
>>> samoaz
>>>
>>>
>>
>>
>
>
>
> --Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


-- 
Mitko Iliev
Developer Virtuoso Team
OpenLink Software
http://www.openlinksw.com/virtuoso
Cross Platform Web Services Middleware

Index: libsrc/Wi/sqlbif.c
===================================================================
RCS file: /opldev/opensource/virtuoso-opensource/libsrc/Wi/sqlbif.c,v
retrieving revision 1.35
diff -u -r1.35 sqlbif.c
--- libsrc/Wi/sqlbif.c	2007/02/01 11:56:01	1.35
+++ libsrc/Wi/sqlbif.c	2007/02/14 09:04:51
@@ -1774,6 +1774,8 @@
       {
 	arr = ((caddr_t *) arr)[inx];
 	idxctr ++;
+	if (!IS_BOX_POINTER (arr))
+          sqlr_new_error ("22003", "SR020", "aset() requires %d or more dimensions for input vector.", idxctr);
 	goto again; /* see above */
       }
     dk_free_tree (((caddr_t *) arr)[inx]);

Reply via email to