Changeset: 98789bcfbf66 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=98789bcfbf66 Modified Files: clients/ChangeLog.Jul2012 clients/mapiclient/mclient.c monetdb5/extras/jaql/Tests/join03.stable.out monetdb5/extras/jaql/Tests/json02.stable.out monetdb5/extras/jaql/json.c Branch: default Log Message:
Merged from Jul2012 diffs (158 lines): diff --git a/clients/ChangeLog.Jul2012 b/clients/ChangeLog.Jul2012 --- a/clients/ChangeLog.Jul2012 +++ b/clients/ChangeLog.Jul2012 @@ -1,3 +1,7 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Tue Jul 17 2012 Fabian Groffen <fab...@cwi.nl> +- mclient no longer prints the SQLSTATE at the start each error returned + by the SQL-server. + diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -1448,10 +1448,11 @@ format_result(Mapi mid, MapiHdl hdl, cha if ((reply = mapi_result_error(hdl)) != NULL) { mnstr_flush(toConsole); if (formatter == TABLEformatter || formatter == CLEANformatter) { - fprintf(stderr, "%s", reply); + mapi_noexplain(mid, ""); } else { - mapi_explain_result(hdl, stderr); + mapi_noexplain(mid, NULL); } + mapi_explain_result(hdl, stderr); errseen = 1; /* don't need to print something like '0 * tuples' if we got an error */ @@ -1600,6 +1601,11 @@ doRequest(Mapi mid, const char *buf) SQLsetSpecial(buf); if ((hdl = mapi_query(mid, buf)) == NULL) { + if (formatter == TABLEformatter || formatter == CLEANformatter) { + mapi_noexplain(mid, ""); + } else { + mapi_noexplain(mid, NULL); + } mapi_explain(mid, stderr); errseen = 1; return 1; @@ -1619,6 +1625,11 @@ doRequest(Mapi mid, const char *buf) break; \ case MERROR: \ /* some error, but try to continue */ \ + if (formatter == TABLEformatter || formatter == CLEANformatter) { \ + mapi_noexplain(mid, ""); \ + } else { \ + mapi_noexplain(mid, NULL); \ + } \ if (hdl) { \ mapi_explain_query(hdl, stderr); \ mapi_close_handle(hdl); \ @@ -1629,6 +1640,11 @@ doRequest(Mapi mid, const char *buf) break_or_continue; \ case MTIMEOUT: \ /* lost contact with the server */ \ + if (formatter == TABLEformatter || formatter == CLEANformatter) { \ + mapi_noexplain(mid, ""); \ + } else { \ + mapi_noexplain(mid, NULL); \ + } \ if (hdl) { \ mapi_explain_query(hdl, stderr); \ mapi_close_handle(hdl); \ @@ -2552,6 +2568,11 @@ set_timezone(Mapi mid) "SET TIME ZONE INTERVAL '-%02ld:%02ld' HOUR TO MINUTE", tzone / 3600, (tzone % 3600) / 60); if ((hdl = mapi_query(mid, buf)) == NULL) { + if (formatter == TABLEformatter || formatter == CLEANformatter) { + mapi_noexplain(mid, ""); + } else { + mapi_noexplain(mid, NULL); + } mapi_explain(mid, stderr); errseen = 1; return; diff --git a/monetdb5/extras/jaql/Tests/join03.stable.out b/monetdb5/extras/jaql/Tests/join03.stable.out --- a/monetdb5/extras/jaql/Tests/join03.stable.out +++ b/monetdb5/extras/jaql/Tests/join03.stable.out @@ -23,10 +23,12 @@ function user.main():void; jaql.x("join preserve A, B where A == B.a into {B.*, A};"); jaql.x("join preserve A, preserve B where A == B.a into {B.*, A};"); jaql.x("join A, preserve B where A == B.a into {B.*, A};"); + jaql.x("group A by g = $ as ga, B by g = $.a as gb into { \"grp\" : g, \"cnt\": count(gb) };"); end main; [ { "a": 1, "b": 4, "A": 1 }, { "a": 1, "b": 5, "A": 1 }, { "A": 2 } ] [ { "a": 1, "b": 4, "A": 1 }, { "a": 1, "b": 5, "A": 1 }, { "A": 2 } ] [ { "a": 1, "b": 4, "A": 1 }, { "a": 1, "b": 5, "A": 1 } ] +[ { "grp": 1, "cnt": 2 }, { "grp": 2, "cnt": 0 } ] # 09:27:06 > # 09:27:06 > "Done." diff --git a/monetdb5/extras/jaql/Tests/json02.stable.out b/monetdb5/extras/jaql/Tests/json02.stable.out --- a/monetdb5/extras/jaql/Tests/json02.stable.out +++ b/monetdb5/extras/jaql/Tests/json02.stable.out @@ -49,7 +49,7 @@ end main; [ "hello" ] [ { "world": [ 0, 2, true, null ] } ] [ "hello", [ 0, 2, true, null ] ] -[ "hello", null ] +[ "hello" ] # 22:47:10 > # 22:47:10 > "Done." diff --git a/monetdb5/extras/jaql/json.c b/monetdb5/extras/jaql/json.c --- a/monetdb5/extras/jaql/json.c +++ b/monetdb5/extras/jaql/json.c @@ -1153,11 +1153,8 @@ JSONextract(int *rkind, int *rstring, in if (v != oid_nil) { z = json_copy_entry(bik, bis, bii, bid, bia, bio, bin, *startoid, v, &jb, &jbr); - } else { - BUNappend(jbr.kind, "n", FALSE); - z = BUNlast(jbr.kind) - 1 + *startoid; + BUNins(jbr.array, &w, &z, FALSE); } - BUNins(jbr.array, &w, &z, FALSE); } unloadbats(); @@ -1433,6 +1430,8 @@ JSONunwrap(Client cntxt, MalBlkPtr mb, M break; } } + if (BATcount(b) == 0) + BUNins(r, &v, str_nil, FALSE); break; case TYPE_dbl: if (r == NULL) @@ -1468,6 +1467,10 @@ JSONunwrap(Client cntxt, MalBlkPtr mb, M break; } } + if (BATcount(b) == 0) { + d = dbl_nil; + BUNins(r, &v, &d, FALSE); + } break; case TYPE_lng: if (r == NULL) @@ -1503,13 +1506,12 @@ JSONunwrap(Client cntxt, MalBlkPtr mb, M break; } } + if (BATcount(b) == 0) { + l = lng_nil; + BUNins(r, &v, &l, FALSE); + } break; } - if (BATcount(b) == 0) { - r = BATnew(TYPE_oid, TYPE_lng, 1); - l = lng_nil; - BUNins(r, &v, &l, FALSE); - } } } _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list