Changeset: d5b4b07da8b6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d5b4b07da8b6
Modified Files:
        sql/server/sql_parser.y
        sql/server/sql_psm.c
Branch: sciql
Log Message:

* implemented sciql array returning functions
** introduced array as return type of sql function
** storing array-returning functions just like table-returning functions in psm


diffs (52 lines):

diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -396,6 +396,7 @@ int yydebug=1;
        index_exp /* position indices of array cells */
        index_exp_list
        array_element_def_list
+       array_function_column_list
        tiling_commalist
 
 %type <i_val>
@@ -2244,9 +2245,28 @@ table_function_column_list:
                                }
   ;
 
+array_function_column_list:
+column data_type dimension     { $$ = L();
+       append_string($$, $1);
+       append_type($$, &$2);
+       /* append_symbol($$, $3); Since the compiler can't deal with the 
dimensionality we ommit it'*/
+} | array_function_column_list ',' column data_type dimension {
+       append_string($$, $3);
+       append_type($$, &$4);
+       /* append_symbol($$, $5); Since the compiler can't deal with the 
dimensionality we ommit it*/
+} | column data_type{ $$ = L();
+       append_string($$, $1);
+       append_type($$, &$2);
+} | array_function_column_list ',' column data_type{
+       append_string($$, $3);
+       append_type($$, &$4);
+};
+
 func_data_type:
     TABLE '(' table_function_column_list ')'   
                { $$ = _symbol_create_list(SQL_TABLE, $3); }
+  | ARRAY '(' array_function_column_list ')'
+       {       $$ = _symbol_create_list(SQL_ARRAY, $3); }
  |  data_type
                { $$ = _symbol_create_list(SQL_TYPE, append_type(L(),&$1)); }
  ;
diff --git a/sql/server/sql_psm.c b/sql/server/sql_psm.c
--- a/sql/server/sql_psm.c
+++ b/sql/server/sql_psm.c
@@ -433,7 +433,7 @@ result_type(mvc *sql, sql_subfunc *f, ch
 {
        if (res->token == SQL_TYPE) {
                return &res->data.lval->h->data.typeval;
-       } else if (res->token == SQL_TABLE) {
+       } else if (res->token == SQL_TABLE || res->token == SQL_ARRAY) {
                /* here we create a new table-type */
                sql_schema *sys = find_sql_schema(sql->session->tr, "sys");
                sql_subtype *t = SA_NEW(sql->sa, sql_subtype);
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to