Update of /cvsroot/monetdb/sql/src/include
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17711/include

Modified Files:
        sql_list.h sql_relation.h 
Log Message:
removed ugly e_exp and e_relation
added new flags DISTINCT, NO_NIL and ASCENDING 
add a few new list functions used by the relational version


Index: sql_list.h
===================================================================
RCS file: /cvsroot/monetdb/sql/src/include/sql_list.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sql_list.h  11 Jan 2008 10:52:10 -0000      1.13
+++ sql_list.h  27 Jan 2008 15:19:59 -0000      1.14
@@ -58,17 +58,26 @@
  * Returns 0 if data and key are equal 
  * */
 typedef int (*fcmp) (void *data, void *key);
+typedef int (*fcmp2) (void *data, void *v1, void *v2);
 typedef void *(*fdup) (void *data);
 typedef void *(*freduce) (void *v1, void *v2);
 typedef void *(*fmap) (void *data, void *clientdata);
+typedef int (*fkeyvalue) (void *data);
 
 extern node *list_find(list *l, void *key, fcmp cmp);
 extern list *list_select(list *l, void *key, fcmp cmp, fdup dup);
 extern list *list_order(list *l, fcmp cmp, fdup dup);
 extern list *list_distinct(list *l, fcmp cmp, fdup dup);
+extern list *list_distinct2(list *l, void *data, fcmp2 cmp, fdup dup);
 extern void *list_reduce(list *l, freduce red, fdup dup);
 extern list *list_map(list *l, void *data, fmap f);
 extern int list_cmp(list *l1, list *l2, fcmp cmp);
+/* cmp the lists in link order */
+extern int list_match(list *l1, list *l2, fcmp cmp);
+/* match the lists (in any order) */
+extern list *list_sort(list *l, fkeyvalue key, fdup dup);
+/* The sort function sorts the list using the key function, which 
+ * translates the list item values into integer keyvalues. */
 
 extern list *list_dup(list *l, fdup dup);
 extern list *list_merge(list *l, list *data, fdup dup);

Index: sql_relation.h
===================================================================
RCS file: /cvsroot/monetdb/sql/src/include/sql_relation.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- sql_relation.h      11 Jan 2008 10:52:10 -0000      1.15
+++ sql_relation.h      27 Jan 2008 15:19:59 -0000      1.16
@@ -25,9 +25,7 @@
 #define RELATION 1
 
 typedef enum expression_type {
-       e_exp,
        e_atom,
-       e_relation,
        e_column,
        e_cmp,
        e_func,
@@ -47,17 +45,20 @@
        void *l;
        void *r;
        void *f;        /* =,!=, but also func's and aggr's and column type */
-       int  flag;
+       int  flag;      /* DISTINCT, NO_NIL, ASCENDING */
        char card;      /* card 
                                (0 truth value!)
                                (1 atoms) 
                                (2 aggr)
                                (3 multi value)
                        */
+       void *p;        /* properties for the optimizer */
 } sql_exp;
 
 #define DISTINCT       1
 #define NO_NIL         2
+/* ASCENDING > 8 else we have problems with cmp types */
+#define ASCENDING      16
  
 #define MAXOPS 16
 
@@ -65,7 +66,7 @@
        op_basetable = 0,
        op_table,
        op_project,
-       op_select,
+       op_select,      /* includes order by */
        op_join,
        op_left,
        op_right,
@@ -74,7 +75,6 @@
        op_inter,
        op_except,
        op_groupby,     /* currently includes the projection (aggr) */
-       op_orderby,
        op_topn
 } operator_type;
 
@@ -85,13 +85,13 @@
 #define is_set(op) \
        (op == op_union || op == op_inter || op == op_except)
 #define is_project(op) \
-       (op == op_project || op == op_groupby)
+       (op == op_project || op == op_groupby || is_set(op))
 #define is_groupby(op) \
        (op == op_groupby)
-#define is_sort(op) \
-       (op == op_orderby || op == op_topn)
+#define is_sort(rel) \
+       ((rel->op == op_project && rel->r) || rel->op == op_topn)
 #define is_distinct(rel) \
-       (rel->op == op_project && rel->r != NULL)
+       ((rel->flag&DISTINCT))
 
 typedef struct relation {
        sql_ref ref;
@@ -102,6 +102,7 @@
        void *r;
        list *exps; 
        int nrcols;     /* nr of cols */        
+       char flag;      /* DISTINCT */ 
        char card;      /* 0, 1 (row), 2 aggr, 3 */
        char processed; /* fully processed or still in the process of building 
*/
        char subquery;  /* is this part a subquery, this is needed for proper 
name binding */


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to