Update of /cvsroot/monetdb/sql/src/server
In directory 
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16576/sql/src/server

Modified Files:
        rel_bin.mx rel_select.mx sql_parser.mx sql_symbol.mx 
Log Message:

triggered by type mismatches detected by the Microsoft compiler on Windows:

finished fixed revised limit & offset implementation
by consistently parsing, storing and handling them as wrd
wherever they occur (hopefully, I did not miss anything...)


Index: rel_select.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/rel_select.mx,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- rel_select.mx       15 Mar 2010 10:41:13 -0000      1.171
+++ rel_select.mx       23 Mar 2010 19:17:22 -0000      1.172
@@ -4553,9 +4553,9 @@
        if (sn->limit > 0 || sn->offset > 0) {
                list *exps = new_exp_list();
 
-               append(exps, exp_atom_lng(sn->limit));
+               append(exps, exp_atom_wrd(sn->limit));
                if (sn->offset > 0)
-                       append(exps, exp_atom_lng(sn->offset));
+                       append(exps, exp_atom_wrd(sn->offset));
                rel = rel_topn(rel, exps);
        }
        return rel;

Index: sql_symbol.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_symbol.mx,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- sql_symbol.mx       7 Jan 2010 15:24:32 -0000       1.38
+++ sql_symbol.mx       23 Mar 2010 19:17:22 -0000      1.39
@@ -37,6 +37,7 @@
 
 typedef union symbdata {
        int i_val;
+       wrd w_val;
        lng l_val;
        char *sval;
        struct dlist *lval;
@@ -75,8 +76,8 @@
 typedef struct SelectNode {
        symbol s;
 
-       int limit;
-       int offset;
+       wrd limit;
+       wrd offset;
        int distinct;
        struct dlist *selection;
        struct dlist *into;     /* ?? */
@@ -101,7 +102,7 @@
 
 extern int symbol_cmp(symbol *s1, symbol *s2);
 
-extern symbol *newSelectNode(sql_allocator *sa, int distinct, struct dlist 
*selection, struct dlist *into, symbol *from, symbol *where, symbol *groupby, 
symbol *having, symbol *orderby, symbol *name, int limit, int offset);
+extern symbol *newSelectNode(sql_allocator *sa, int distinct, struct dlist 
*selection, struct dlist *into, symbol *from, symbol *where, symbol *groupby, 
symbol *having, symbol *orderby, symbol *name, wrd limit, wrd offset);
 
 extern symbol *newAtomNode(sql_allocator *sa, atom *a);
 
@@ -366,7 +367,7 @@
 }
 
 symbol *
-newSelectNode(sql_allocator *sa, int distinct, struct dlist *selection, struct 
dlist *into, symbol *from, symbol *where, symbol *groupby, symbol *having, 
symbol *orderby, symbol *name, int limit, int offset)
+newSelectNode(sql_allocator *sa, int distinct, struct dlist *selection, struct 
dlist *into, symbol *from, symbol *where, symbol *groupby, symbol *having, 
symbol *orderby, symbol *name, wrd limit, wrd offset)
 {
        SelectNode *sn = SA_NEW(sa, SelectNode);
        symbol *s = (symbol *) sn;

Index: sql_parser.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_parser.mx,v
retrieving revision 1.332
retrieving revision 1.333
diff -u -d -r1.332 -r1.333
--- sql_parser.mx       27 Feb 2010 19:28:07 -0000      1.332
+++ sql_parser.mx       23 Mar 2010 19:17:22 -0000      1.333
@@ -259,6 +259,7 @@
 %pure_parser
 %union {
        int             i_val,bval;
+       wrd             w_val;
        lng             l_val,operation;
        double          fval;
        char *          sval;
@@ -596,13 +597,18 @@
        XML_content_option
        XML_whitespace_option
 
+%type <w_val>
+       wrdval
+       poswrd
+       nonzerowrd
+       opt_limit
+       opt_offset
+
 %type <l_val>
        opt_start
        lngval
        poslng
        nonzerolng
-       opt_limit
-       opt_offset
        opt_increment
        opt_min
        opt_max
@@ -3134,12 +3140,12 @@
 
 opt_limit:
     /* empty */                        { $$ = -1; }
- |  LIMIT nonzerolng                   { $$ = $2; }
+ |  LIMIT nonzerowrd                   { $$ = $2; }
  ;
 
 opt_offset:
        /* empty */                     { $$ = -1; }
- |  OFFSET poslng                      { $$ = $2; }
+ |  OFFSET poswrd                      { $$ = $2; }
  ;
 
 sort_specification_list:
@@ -4291,6 +4297,17 @@
                }
        ;
 
+nonzerowrd:
+       wrdval
+               { $$ = $1;
+                 if ($$ <= 0) {
+                       $$ = -1;
+                       yyerror("Positive value greater than 0 expected");
+                       YYABORT;
+                 }
+               }
+       ;
+
 poslng:
        lngval  { $$ = $1;
                  if ($$ < 0) {
@@ -4301,6 +4318,16 @@
                }
        ;
 
+poswrd:
+       wrdval  { $$ = $1;
+                 if ($$ < 0) {
+                       $$ = -1;
+                       yyerror("Positive value expected");
+                       YYABORT;
+                 }
+               }
+       ;
+
 posint:
        intval  { $$ = $1;
                  if ($$ < 0) {
@@ -4584,6 +4611,16 @@
        sqlINT  { $$ = strtoll($1,NULL,10); }
 ;
 
+wrdval:
+       sqlINT  {
+#if SIZEOF_WRD == SIZEOF_INT
+                 $$ = strtol($1,NULL,10);
+#else /* SIZEOF_WRD == SIZEOF_LNG a*/
+                 $$ = strtoll($1,NULL,10);
+#endif
+               }
+;
+
 intval:
        sqlINT  { $$ = strtol($1,NULL,10); }
  |     IDENT   { mvc *m = (mvc*)parm;

Index: rel_bin.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/rel_bin.mx,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- rel_bin.mx  27 Feb 2010 19:27:54 -0000      1.111
+++ rel_bin.mx  23 Mar 2010 19:17:21 -0000      1.112
@@ -1483,7 +1483,7 @@
                sql_exp *limit = rel->exps->h->data;
                atom *a = limit->l;
 
-               return a->data.val.lval;
+               return a->data.val.wval;
        }
        return -1;
 }
@@ -1497,7 +1497,7 @@
                sql_exp *offset = rel->exps->h->next->data;
                atom *a = offset->l;
 
-               o = a->data.val.lval;
+               o = a->data.val.wval;
                if (o <= 0)
                        o = 0;
        }
@@ -1525,7 +1525,7 @@
        wrd l = -1;
 
        if (topn) {
-               int o = topn_offset(topn);
+               wrd o = topn_offset(topn);
                l = topn_limit(topn);
                if (l < 0) /* for now only handle topn 
                                including limit, ie not just offset */
@@ -1930,7 +1930,7 @@
 
        if (n) {
                stmt *limit = NULL, *p, *j;
-               int lmt = l;
+               wrd lmt = l;
 
                if (l < 0) {
                        l = o;


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to