Hello Peter,

I'm sorry, that's really my bug. I was unable to reproduce this xsd:int
range issue as it happened in your case (the script below looks OK), but
plain
select DB.DBA."http://www.w3.org/2001/XMLSchema#int";('30000');
demonstrated the error. The fix is committed into commercial version and
is on its way to Virtuoso Open Source release, the patch is in the
attachment.

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

P.S. the script:

SQL> sparql define sql:log-enable 2 INSERT  INTO GRAPH
<http://mygraph.com/Graph>  { <http://mygraph.com/statistics:12345678>
<http://mygraph.com/read>
"30000"^^<http://www.w3.org/2001/XMLSchema#int> .  } ;
callret-0
VARCHAR
_______________________________________________________________________________

Insert into <http://mygraph.com/Graph>, 1 triples -- done

1 Rows. -- 19 msec.

SQL> sparql select * from <http://mygraph.com/Graph> where { ?s ?p ?o };
s
p         o
VARCHAR
VARCHAR         VARCHAR
_______________________________________________________________________________

http://mygraph.com/statistics:12345678
http://mygraph.com/read         30000

1 Rows. -- 2 msec.
SQL> sparql select ?o (datatype(?o)) as ?ot from
<http://mygraph.com/Graph> where { ?s ?p ?o };
o
ot
VARCHAR
VARCHAR
_______________________________________________________________________________

30000
http://www.w3.org/2001/XMLSchema#int

1 Rows. -- 2 msec.




On Sun, 2009-08-09 at 16:26 -0700, Peter Ansell wrote:
> Hi all,
> 
> In order to debug my last issue I decided to log into the isql console and 
> turn trace_on
> 
> There were no messages at all that seemed to be relevant to the last error 
> but there was a strange message related to something else. The following 
> message is the bug
> 
> 08:57:27 COMP_2 SPARQL 127.0.0.1 Internal Compile text:  sparql define 
> sql:log-enable 2 INSERT  INTO GRAPH <http://mygraph.com/Graph>  { 
> ...
> <http://mygraph.com/statistics:12345678> <http://mygraph.com/read> 
> "30000"^^<http://www.w3.org/2001/XMLSchema#int> .
> ...
>  } 
> 08:57:27 ERRS_0 42001 XPQ?? Magnitude is too big (30000) to be packed into int
> 
> Maybe it is non-consequential to the functioning of the program but int is 
> supposed to be able to handle a range as follows:[1]
> 
> "int is ·derived· from long by setting the value of ·maxInclusive· to be 
> 2147483647 and ·minInclusive· to be -2147483648. The ·base type· of int is 
> long."
> 
> Having debug messages come out because someone tries to put in 30000 doesn't 
> seem to match the definition of the datatype but it might not be a real bug.
> 
> Cheers,
> 
> Peter
> 
> [1] http://www.w3.org/TR/xmlschema-2/#int

Index: libsrc/Wi/xqf.c
===================================================================
RCS file: /home/staff/us-cvs/virtuoso/libsrc/Wi/xqf.c,v
retrieving revision 1.22.2.12
diff -u -U 10 -r1.22.2.12 xqf.c
--- libsrc/Wi/xqf.c	14 Apr 2009 06:44:05 -0000	1.22.2.12
+++ libsrc/Wi/xqf.c	11 Aug 2009 10:42:38 -0000
@@ -262,21 +262,21 @@
       else
         *n = box_num (atoi (str));
       return;
     }
   if ((l = __chk_int_string (str)) < 0)
     sqlr_new_error ("42001", "XPQ??", "Incorrect argument in %.100s constructor: '%.100s'", s_int_name[do_what], str);
 
   l = (int) strlen (p);
   if (NULL == s_int [2 * do_what + s])
     sqlr_new_error ("42001", "XPQ??", "Sign of argument '%.100s' does not match expected type %s", str, s_int_name[do_what]);
-  if ((l > l_int[do_what - 1]) || ((l == l_int[do_what - 1]) && strcmp (s_int[2 * do_what + s], p) < 0))
+  if ((l > l_int[do_what]) || ((l == l_int[do_what]) && strcmp (s_int[2 * do_what + s], p) < 0))
     sqlr_new_error ("42001", "XPQ??", "Magnitude is too big (%.100s) to be packed into %s", str, s_int_name[do_what]);
   switch (do_what) {
     case XQ_INT8:
     case XQ_INT16:
     case XQ_INT32:
     case XQ_UINT8:
     case XQ_UINT16:
     case XQ_UINT32:
       *n = box_num (atoi (str));
       break;

Reply via email to