Changeset: 5deea889fbb0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5deea889fbb0
Modified Files:
sql/src/server/rel_select.mx
Branch: Jun2010
Log Message:
English and whitespace fixes.
diffs (truncated from 1964 to 300 lines):
diff -r aca1e704de9c -r 5deea889fbb0 sql/src/server/rel_select.mx
--- a/sql/src/server/rel_select.mx Tue Jul 20 13:49:26 2010 +0200
+++ b/sql/src/server/rel_select.mx Tue Jul 20 14:03:28 2010 +0200
@@ -19,7 +19,7 @@
@f rel_select
@a N.J. Nes
-...@*
+...@*
@h
#ifndef _REL_SELECT_H_
@@ -84,8 +84,8 @@
#include "sql_config.h"
#include "rel_select.h"
-#include "sql_semantic.h" /* TODO this dependency should be removed, move
- the dependend code into sql_mvc */
+#include "sql_semantic.h" /* TODO this dependency should be removed, move
+ the dependent code into sql_mvc */
#include "sql_privileges.h"
#include "sql_env.h"
#include "rel_exp.h"
@@ -99,23 +99,23 @@
#define ERR_AMBIGUOUS 050000
sql_rel *
-rel_dup(sql_rel *r)
+rel_dup(sql_rel *r)
{
sql_ref_inc(&r->ref);
return r;
}
-static void
+static void
rel_destroy_(sql_rel *rel)
{
- if (!rel)
+ if (!rel)
return;
if (rel->exps)
list_destroy(rel->exps);
- if (is_join(rel->op) ||
- is_semi(rel->op) ||
- is_select(rel->op) ||
- is_set(rel->op) ||
+ if (is_join(rel->op) ||
+ is_semi(rel->op) ||
+ is_select(rel->op) ||
+ is_set(rel->op) ||
rel->op == op_topn) {
if (rel->l)
rel_destroy(rel->l);
@@ -140,10 +140,10 @@
}
}
-void
+void
rel_destroy(sql_rel *rel)
{
- if (!rel)
+ if (!rel)
return;
if (sql_ref_dec(&rel->ref) > 0)
return;
@@ -169,16 +169,16 @@
}
static void
-rel_setsubquery(sql_rel*r)
+rel_setsubquery(sql_rel*r)
{
if (r->l && !is_base(r->op))
rel_setsubquery(r->l);
- if (r->r && is_join(r->op))
+ if (r->r && is_join(r->op))
rel_setsubquery(r->r);
set_subquery(r);
}
-/* we don't name relations directly, but sometimes we need the relation
+/* we don't name relations directly, but sometimes we need the relation
name. So we look it up in the first expression
*/
char *
@@ -210,7 +210,7 @@
if (is_project(r->op) && r->exps) {
node *ne = r->exps->h;
- for (; ne; ne = ne->next)
+ for (; ne; ne = ne->next)
exp_setname( ne->data, nme, NULL );
}
/* op_projects can have a order by list */
@@ -218,14 +218,14 @@
list *exps = r->r;
node *ne = exps->h;
- for (; ne; ne = ne->next)
+ for (; ne; ne = ne->next)
exp_setname( ne->data, nme, NULL );
}
return r;
}
-static sql_exp *
-exp_alias_or_copy( mvc *sql, char *tname, char *cname, sql_rel *orel, sql_exp
*old, int settname)
+static sql_exp *
+exp_alias_or_copy( mvc *sql, char *tname, char *cname, sql_rel *orel, sql_exp
*old, int settname)
{
if (settname && !tname)
tname = old->rname;
@@ -247,7 +247,7 @@
/* return all expressions, with table name == tname */
static list *
-rel_table_projections( mvc *sql, sql_rel *rel, char *tname )
+rel_table_projections( mvc *sql, sql_rel *rel, char *tname )
{
list *exps;
@@ -267,7 +267,7 @@
case op_right:
case op_full:
exps = rel_table_projections( sql, rel->l, tname);
- if (exps)
+ if (exps)
return exps;
return rel_table_projections( sql, rel->r, tname);
case op_semi:
@@ -292,9 +292,9 @@
for (en = rel->exps->h; en; en = en->next) {
sql_exp *e = en->data;
/* first check alias */
- if (!is_intern(e) && e->rname &&
strcmp(e->rname, tname) == 0)
+ if (!is_intern(e) && e->rname &&
strcmp(e->rname, tname) == 0)
append(exps, exp_alias_or_copy(sql,
tname, exp_name(e), rel, e, 1));
- if (!is_intern(e) && !e->rname && e->l &&
strcmp(e->l, tname) == 0)
+ if (!is_intern(e) && !e->rname && e->l &&
strcmp(e->l, tname) == 0)
append(exps, exp_alias_or_copy(sql,
tname, exp_name(e), rel, e, 1));
}
if (exps && list_length(exps))
@@ -305,9 +305,9 @@
}
}
-/* find the path to the relation containing the base of the expression
- (e_column), in most cases this means go down the join tree and
- find the base column.
+/* find the path to the relation containing the base of the expression
+ (e_column), in most cases this means go down the join tree and
+ find the base column.
*/
static int
rel_bind_path_(sql_rel *rel, sql_exp *e, list *path )
@@ -318,10 +318,10 @@
case op_join:
case op_left:
case op_right:
- case op_full:
+ case op_full:
/* first right (possible subquery) */
found = rel_bind_path_(rel->r, e, path);
- if (!found)
+ if (!found)
found = rel_bind_path_(rel->l, e, path);
break;
case op_semi:
@@ -340,15 +340,15 @@
assert(0);
break;
}
- case op_groupby:
+ case op_groupby:
case op_project:
case op_table:
- case op_basetable:
+ case op_basetable:
if (!rel->exps)
break;
- if (!found && e->l && exps_bind_column2(rel->exps, e->l, e->r))
+ if (!found && e->l && exps_bind_column2(rel->exps, e->l, e->r))
found = 1;
- if (!found && !e->l && exps_bind_column(rel->exps, e->r, NULL))
+ if (!found && !e->l && exps_bind_column(rel->exps, e->r, NULL))
found = 1;
break;
case op_insert:
@@ -366,22 +366,22 @@
static list *
rel_bind_path(sql_rel *rel, sql_exp *e )
{
- list *path = new_rel_list();
-
- if (e->type == e_convert)
+ list *path = new_rel_list();
+
+ if (e->type == e_convert)
e = e->l;
if (e->type == e_column) {
if (rel) {
if (!rel_bind_path_(rel, e, path)) {
/* something is wrong */
- list_destroy(path);
+ list_destroy(path);
return NULL;
}
}
return path;
}
/* default the top relation */
- append(path, rel);
+ append(path, rel);
return path;
}
@@ -407,7 +407,7 @@
case op_groupby:
case op_project:
case op_table:
- case op_basetable:
+ case op_basetable:
case op_union:
case op_except:
@@ -418,7 +418,7 @@
exps = new_exp_list();
for (en = rel->exps->h; en; en = en->next) {
sql_exp *e = en->data;
- if (intern || !is_intern(e))
+ if (intern || !is_intern(e))
append(exps, exp_alias_or_copy(sql,
tname, exp_name(e), rel, e, settname));
}
return exps;
@@ -445,7 +445,7 @@
}
sql_rel *
-rel_copy( sql_rel *i )
+rel_copy( sql_rel *i )
{
sql_rel *rel = rel_create();
@@ -458,7 +458,7 @@
rel->l = i->l;
break;
case op_table:
- rel->l = exp_dup(i->l);
+ rel->l = exp_dup(i->l);
break;
case op_groupby:
rel->l = rel_copy(i->l);
@@ -486,7 +486,7 @@
}
sql_rel *
-rel_basetable(sql_table *t, char *atname)
+rel_basetable(sql_table *t, char *atname)
{
node *cn;
sql_rel *rel = rel_create();
@@ -511,7 +511,7 @@
}
sql_rel *
-rel_table_func(sql_exp *f, list *exps)
+rel_table_func(sql_exp *f, list *exps)
{
sql_rel *rel = rel_create();
@@ -525,7 +525,7 @@
}
sql_rel *
-rel_recursive_func(list *exps)
+rel_recursive_func(list *exps)
{
sql_rel *rel = rel_create();
@@ -549,7 +549,7 @@
rel->op = setop;
rel->exps = NULL;
rel->card = CARD_MULTI;
- if (l && r)
+ if (l && r)
rel->nrcols = l->nrcols + r->nrcols;
return rel;
}
@@ -568,7 +568,7 @@
return rel;
}
-void
+void
rel_join_add_exp( sql_rel *rel, sql_exp *e)
{
assert(is_join(rel->op));
@@ -580,7 +580,7 @@
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list