Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3119/src/backends/monet5
Modified Files:
Tag: Nov2008
sql.mx sql_result.mx
Log Message:
added missing function for writing resultsets to file for single rows.
U sql_result.mx
Index: sql_result.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_result.mx,v
retrieving revision 1.98
retrieving revision 1.98.2.1
diff -u -d -r1.98 -r1.98.2.1
--- sql_result.mx 4 Nov 2008 15:42:13 -0000 1.98
+++ sql_result.mx 6 Jan 2009 09:07:49 -0000 1.98.2.1
@@ -978,6 +978,9 @@
BBPunfix(order->batCacheid);
m->results = res_tables_remove(m->results, t);
}
+ if (res == 0 && m->scanner.ws == s)
+ /* need to flush */
+ stream_flush(s);
return res;
}
U sql.mx
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.295
retrieving revision 1.295.2.1
diff -u -d -r1.295 -r1.295.2.1
--- sql.mx 4 Nov 2008 11:38:16 -0000 1.295
+++ sql.mx 6 Jan 2009 09:07:49 -0000 1.295.2.1
@@ -166,6 +166,10 @@
The Monet 5 code generator uses several SQL specific wrapper functions.
They are not present in V4
@mal
+pattern resultSet{unsafe}( nr_cols:int, sep:str, rsep:str, ssep:str, ns:str,
order:any_1 ) :int
+address mvc_result_file_wrap
+comment "Prepare a file result set";
+
pattern resultSet{unsafe}( nr_cols:int, sep:str, rsep:str, ssep:str, ns:str,
order:bat[:oid,:any_1] ) :int
address mvc_result_file_wrap
comment "Prepare a file result set";
@@ -1716,7 +1720,7 @@
mvc_result_file_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
str res = MAL_SUCCEED;
- BAT *order;
+ BAT *order = NULL;
mvc *m = NULL;
str msg = getContext(cntxt,mb, &m, NULL);
res_table *t = NULL;
@@ -1728,16 +1732,18 @@
unsigned char **R = (unsigned char **)getArgReference(stk, pci, 3);
unsigned char **S = (unsigned char **)getArgReference(stk, pci, 4);
unsigned char **N = (unsigned char **)getArgReference(stk, pci, 5);
- bat *order_bid = (bat *)getArgReference(stk, pci, 6);
+ int mtype = getArgType(mb, pci, 6);
(void) cntxt;
if (msg)
return msg;
- if ((order = BATdescriptor(*order_bid)) == NULL ) {
- throw(SQL, "sql.resultSet", "Cannot access descriptor");
- }
- t = res_table_create(m->session->tr, m->result_id++, *nr_cols, Q_TABLE,
m->results, order);
- m->results = t;
+ if (mtype == TYPE_bat) {
+ bat *order_bid = (bat *)getArgReference(stk, pci, 6);
+ if ((order = BATdescriptor(*order_bid)) == NULL ) {
+ throw(SQL, "sql.resultSet", "Cannot access
descriptor");
+ }
+ }
+ m->results = t = res_table_create(m->session->tr, m->result_id++,
*nr_cols, Q_TABLE, m->results, order);
len = strlen((char*)(*T));
GDKstrFromStr(tsep=GDKmalloc(len+1), *T, len); len = 0;
len = strlen((char*)(*R));
@@ -1753,7 +1759,8 @@
*res_id = t->id;
if (*res_id < 0)
res = createException(SQL, "sql.resultSet", "failed");
- BBPunfix(order->batCacheid);
+ if (order)
+ BBPunfix(order->batCacheid);
return res;
}
------------------------------------------------------------------------------
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins