Changeset: dd8afc47979a for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dd8afc47979a Modified Files: MonetDB.spec java/example/XMLDBtest.java monetdb5/mal/mal_interpreter.mx Branch: default Log Message:
Merge with Dec2011 branch. diffs (truncated from 1321 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -229,6 +229,7 @@ Group: Applications/Databases Requires: %{name}-client = %{version}-%{release} Requires: perl Requires: perl(DBI) +Requires: perl(Digest::SHA) %description client-perl MonetDB is a database management system that is developed from a diff --git a/java/example/XMLDBtest.java b/java/example/XMLDBtest.java deleted file mode 100644 --- a/java/example/XMLDBtest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The contents of this file are subject to the MonetDB Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.monetdb.org/Legal/MonetDBLicense - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * The Original Code is the MonetDB Database System. - * - * The Initial Developer of the Original Code is CWI. - * Portions created by CWI are Copyright (C) 1997-July 2008 CWI. - * Copyright August 2008-2012 MonetDB B.V. - * All Rights Reserved. - */ - -import org.xmldb.api.*; -import org.xmldb.api.base.*; -import org.xmldb.api.modules.*; - -/** - * Quick example demonstrating the XML:DB driver. - * - * To compile and run this example, MonetDB_XMLDB.jar, MonetDB_JDBC.jar - * and xmldb.jar (from the lib dir) should be in the classpath. - * - * @author Fabian Groffen <fabian.grof...@cwi.nl> - */ -public class XMLDBtest { - public static void main(String[] args) throws Exception { - Class.forName("nl.cwi.monetdb.xmldb.base.MonetDBDatabase"); - try { - Collection col = DatabaseManager.getCollection("xmldb:monetdb://localhost/demo", "monetdb", "monetdb"); - - XQueryService xqs = (XQueryService)col.getService("XQueryService", "1"); - ResourceSet set = xqs.query("(<foo>1</foo>,<bar />)"); - ResourceIterator it = set.getIterator(); - while(it.hasMoreResources()) { - Resource r = it.nextResource(); - System.out.println(r.getContent()); - } - - } catch (XMLDBException e) { - e.printStackTrace(); - } - } -} diff --git a/java/src/nl/cwi/monetdb/merovingian/MerovingianException.java b/java/src/nl/cwi/monetdb/merovingian/MerovingianException.java --- a/java/src/nl/cwi/monetdb/merovingian/MerovingianException.java +++ b/java/src/nl/cwi/monetdb/merovingian/MerovingianException.java @@ -20,11 +20,11 @@ package nl.cwi.monetdb.merovingian; /** - * An Exception raised when merovingian specific problems occur. + * An Exception raised when monetdbd specific problems occur. * <br /><br /> - * XXXX - * <br /> - * XXX + * This class is a shallow wrapper around Exception to identify an + * exception as one originating from the monetdbd instance being + * communicated with, instead of a locally generated one. * * @author Fabian Groffen <fabian.grof...@cwi.nl> * @version 1.0 diff --git a/java/src/nl/cwi/monetdb/merovingian/SabaothDB.java b/java/src/nl/cwi/monetdb/merovingian/SabaothDB.java --- a/java/src/nl/cwi/monetdb/merovingian/SabaothDB.java +++ b/java/src/nl/cwi/monetdb/merovingian/SabaothDB.java @@ -24,9 +24,10 @@ import java.util.*; /** * Implementation of the Sabaoth C-struct as Java object. * <br /><br /> - * XXXX + * This Class implements a parser for the string representation of a + * sabaoth information struct as returned by monetdbd. * <br /> - * XXX + * Currently this class implements version 1 of the sabdb serialisation. * * @author Fabian Groffen <fabian.grof...@cwi.nl> * @version 1.0 diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx --- a/monetdb5/mal/mal_interpreter.mx +++ b/monetdb5/mal/mal_interpreter.mx @@ -548,12 +548,11 @@ workslow: } } if (exceptionVar >= 0) { + str oldret = ret; if (ret) { - str oldret = ret; ret = createScriptException(mb, mb->stop - 1, getExceptionType(getVarName(mb, exceptionVar)), ret, "Exception not caught"); - FREE_EXCEPTION(oldret); } else { if (stk->stk[exceptionVar].vtype == TYPE_str) { ret = createScriptException(mb, mb->stop - 1, MAL, @@ -564,6 +563,7 @@ workslow: NULL, "Exception not caught"); } } + FREE_EXCEPTION(oldret); } GDKfree(backup); GDKfree(garbage); @@ -1002,6 +1002,7 @@ DFLOWstep(FlowTask *t, FlowStatus fs) } @:beginProfile(t,0)@ + FREE_EXCEPTION(ret); ret = MAL_SUCCEED; @:MALrecycleStart(t)@ { @:beginProfile(t,1)@ @@ -1569,6 +1570,7 @@ safeguardStack(Client cntxt, MalBlkPtr m * @+ The major switch */ @= MALinterpret + FREE_EXCEPTION(ret); ret = 0; switch (pci->token) { case ASSIGNsymbol: @@ -1709,6 +1711,7 @@ safeguardStack(Client cntxt, MalBlkPtr m break; case RAISEsymbol: exceptionVar = getDestVar(pci); + FREE_EXCEPTION(ret); ret = NULL; if (getVarType(mb, getDestVar(pci)) == TYPE_str) { ret = createScriptException(mb, stkpc, MAL, NULL, @@ -1784,6 +1787,7 @@ safeguardStack(Client cntxt, MalBlkPtr m BBPincref(lhs->val.bval, TRUE); } @:restoreTarget(@1, @3)@ + FREE_EXCEPTION(ret); ret = 0; @:exceptionHndlr(@1, @2, @3)@ @:timingHndlr(@1)@ @@ -2466,7 +2470,8 @@ void garbageElement(Client cntxt, ValPtr if (cntxt && cntxt->flags & bigfootFlag) updateBigFoot(cntxt, bid, FALSE); BBPdecref(bid, TRUE); - } else if (BATatoms[v->vtype].atomDestroy) { + } else if (0 < v->vtype && v->vtype < TYPE_any && + BATatoms[v->vtype].atomDestroy) { (*BATatoms[v->vtype].atomDestroy)(v->val.pval); v->val.pval = 0; } diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c --- a/monetdb5/modules/mal/tablet.c +++ b/monetdb5/modules/mal/tablet.c @@ -328,12 +328,31 @@ TABprelude(int *ret) static void +clearColumn(Column *c) +{ + int i; + CLEAR(c->batname); + CLEAR(c->name); + CLEAR(c->type); + CLEAR(c->sep); + c->width = 0; + c->tabs = 0; + for (i = 0; i < SLICES; i++) + c->c[i] = NULL; + for (i = 0; i < BINS; i++) + c->bin[i] = NULL; + c->p = 0; + /* keep nullstr and brackets */ +} + +static str TABformatPrepare(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int rnr = (int) (cntxt - mal_clients); Tablet *t; - int anr = 0, i, tpe, k = 0; + int anr, i, tpe, k = 0; ptr val; + str e; makeTableSpace(rnr, pci->argc - pci->retc); t = tableReports[rnr]; @@ -345,32 +364,43 @@ TABformatPrepare(Client cntxt, MalBlkPtr t->sep = GDKstrdup("\t"); t->rowwidth = (int) (strlen(t->rlbrk) + strlen(t->rrbrk) - 2); - for (i = pci->retc; i < pci->argc; anr++, i++) { + for (anr = 0, i = pci->retc; i < pci->argc; anr++, i++) { char *name = getArgName(mb, pci, i); /* The type should be taken from the stack ! */ tpe = stk->stk[pci->argv[i]].vtype; val = (ptr) getArgReference(stk, pci, i); - bindVariable(t, anr, name, tpe, val, &k); + e = bindVariable(t, anr, name, tpe, val, &k); + if (e != MAL_SUCCEED) + return e; + } + for (i = anr; (BUN) i < t->nr_attrs; i++) { + clearColumn(t->columns + i); + CLEAR(t->columns[i].lbrk); + CLEAR(t->columns[i].rbrk); + CLEAR(t->columns[i].nullstr); } t->nr_attrs = anr; t->fd = cntxt->fdout; t->pivot = 0; + return MAL_SUCCEED; } str TABsetFormat(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { (void) cntxt; - TABformatPrepare(cntxt, mb, stk, pci); - return MAL_SUCCEED; + return TABformatPrepare(cntxt, mb, stk, pci); } str TABheader(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int rnr = (int) (cntxt - mal_clients); + str e; - TABformatPrepare(cntxt, mb, stk, pci); + e = TABformatPrepare(cntxt, mb, stk, pci); + if (e != MAL_SUCCEED) + return e; TABshowHeader(tableReports[rnr]); return MAL_SUCCEED; } @@ -417,8 +447,11 @@ TABpage(Client cntxt, MalBlkPtr mb, MalS { int rnr = (int) (cntxt - mal_clients); Tablet *t; + str e; - TABformatPrepare(cntxt, mb, stk, pci); + e = TABformatPrepare(cntxt, mb, stk, pci); + if (e != MAL_SUCCEED) + return e; t = tableReports[rnr]; if (t->ttopbrk == 0) { LINE(t->fd, t->rowwidth); @@ -2128,24 +2161,6 @@ CMDtablet_output(int *ret, int *nameid, * The routines to manage the table descriptor */ static void -clearColumn(Column *c) -{ - int i; - CLEAR(c->batname); - CLEAR(c->name); - CLEAR(c->type); - CLEAR(c->sep); - c->width = 0; - c->tabs = 0; - for (i = 0; i < SLICES; i++) - c->c[i] = NULL; - for (i = 0; i < BINS; i++) - c->bin[i] = NULL; - c->p = 0; - /* keep nullstr and brackets */ -} - -static void clearTable(Tablet *t) { unsigned int i; @@ -2235,13 +2250,16 @@ static str bindVariable(Tablet *t, unsigned int anr, str nme, int tpe, ptr val, int *k) { Column *c; - char *buf; int tpeStore; c = t->columns + anr; tpeStore = ATOMstorage(tpe); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list