Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16:/tmp/cvs-serv2951
Modified Files:
xrpc_client.mx xrpc_server.mx
Log Message:
- Implementation of the extended XRPC message format: the "request"
element gets three new attributes
* "arity" (arity of the called function),
* "iter-count" (number of iterations included in this request) and
* "updCall" (is the called function an updating function or read-only
function).
- Hand propogated two fixes from the Stable branch:
============================================
Subject: [Monetdb-pf-checkins] pathfinder/runtime xrpc_client.mx,
1.6.2.12, 1.6.2.13
From: Ying Zhang <[EMAIL PROTECTED]>
Date: Wed, 25 Apr 2007 18:26:43 +0000
To: [email protected]
Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16:/tmp/cvs-serv29521
Modified Files:
Tag: XQuery_0-16
xrpc_client.mx
Log Message:
Made get_rpc_res() better resistent to white-spaces between nodes that
should just be discarded.
============================================
and
============================================
Subject: [Monetdb-pf-checkins] pathfinder/runtime xrpc_server.mx,
1.7.2.17, 1.7.2.18
From: Ying Zhang <[EMAIL PROTECTED]>
Date: Wed, 25 Apr 2007 21:07:21 +0000
To: [email protected]
Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16:/tmp/cvs-serv436
Modified Files:
Tag: XQuery_0-16
xrpc_server.mx
Log Message:
bug discovered when implementing the extended XRPC message format: wrong PRE
value was used for an attribute node.
============================================
Index: xrpc_client.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_client.mx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- xrpc_client.mx 18 Apr 2007 19:50:26 -0000 1.30
+++ xrpc_client.mx 25 Apr 2007 21:21:07 -0000 1.31
@@ -162,7 +162,9 @@
# value can appear more than once in the "pre_prop" bat.
seq_prop := pre_prop.ord_select(seq_prop).reverse().fetch(0);
- var tpe_node_level := pre_level.find(seq_prop).int() + 1;
+ var seq_node_level := pre_level.find(seq_prop).int();
+ var tpe_node_level := seq_node_level + 1;
+ var val_node_level := tpe_node_level + 1;
var itercnt := 0;
var tpe := "";
var subtpe := "";
@@ -181,18 +183,19 @@
var kind := pre_kind.fetch(pre);
var prop := pre_prop.fetch(pre);
- if (level = (tpe_node_level - 1)) {
+ if ( and(level=seq_node_level, kind='\000') ) {
var loc := qn_loc.fetch(prop);
var uri := qn_uri.fetch(prop);
if (and((loc = "sequence"), (uri = xrpc_ns))) {
itercnt :+= 1; # A new iteration starts
}
- } else if (level = tpe_node_level) {
+ } else if ( and(level = tpe_node_level, kind = '\000') ) {
var tpe_node_ns := qn_uri.fetch(prop);
if (tpe_node_ns != xrpc_ns) {
- ERROR("get_rpc_res (pre %d): invalid " +
- "namespace of a type node. Expected " +
- "\"%s\", got \"%s\".\n",
+ ERROR("[get_rpc_res]: (pre=%d): " +
+ "invalid namespace of a type node.\n" +
+ "[get_rpc_res]: expected \"%s\", " +
+ "got \"%s\".\n",
pre, xrpc_ns, tpe_node_ns);
}
tpe := qn_loc.fetch(prop);
@@ -232,14 +235,15 @@
var k :=
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL
PROTECTED]), ATTR);
res_kind.append(k);
}
- } else if (level = (tpe_node_level + 1)) {
- # 'tpe' was set during the previous iteration of 'batloop'
- if (tpe = "element"){
+ } else if (level = val_node_level) {
+ # 'tpe' was set during the previous iteration
+ if ( and(tpe="element", kind='\000') ){
res_iter.append(oid(itercnt));
res_item.append(pre);
var k :=
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL
PROTECTED]), ELEM);
res_kind.append(k);
inc := pre_size.fetch(i);
+ tpe := ""; # clean up type info
} else if (tpe = "text") { # text value of a text node
if (kind != '\001'){
ERROR("get_rpc_res (batloop %d): a text node " +
@@ -250,6 +254,7 @@
res_item.append(pre);
var k :=
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL
PROTECTED]), ELEM);
res_kind.append(k);
+ tpe := ""; # clean up type info
} else if (tpe = "atomic-value") { # string value of an
atomic-value
var val := prop_text.fetch(prop); # value in str
if (subtpe = "boolean"){
@@ -285,18 +290,20 @@
"value with unsupported type \"%s\" " +
"ignored.\n", subtpe);
}
+ tpe := ""; # clean up type info
} else if (tpe = "comment") { # text value of a comment node
res_iter.append(oid(itercnt));
res_item.append(pre);
var k :=
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL
PROTECTED]), ELEM);
res_kind.append(k);
+ tpe := ""; # clean up type info
} else if (tpe = "processing-instruction") { # text value of a
PI node
res_iter.append(oid(itercnt));
res_item.append(pre);
var k :=
set_kind(local_name.leftjoin(reverse(ws.fetch(CONT_NAME))).tmark([EMAIL
PROTECTED]), ELEM);
res_kind.append(k);
+ tpe := ""; # clean up type info
}
- tpe := ""; # clean up type info
} # END 'if (level = ...)'
} # END 'if (not(isnil(pre_size.fetch(i))))'
i := i + inc;
@@ -788,8 +795,7 @@
errno = 0;
if( !(ret = stream_readline(in, b->buf, 1024)) ){
GDKerror("response2bat: failed to receive response from %s", dst);
- if(errno) GDKerror(": %s", strerror(errno));
- GDKerror(".\n");
+ if(errno) GDKerror("response2bat: %s", strerror(errno));
stream_close(in); stream_destroy(in);
return NULL;
}
@@ -814,8 +820,7 @@
if (ret < 0) {
GDKerror("response2bat: failed to receive response from %s",
dst);
- if(errno) GDKerror(": %s", strerror(errno));
- GDKerror(".\n");
+ if(errno) GDKerror("response2bat: %s", strerror(errno));
return NULL;
}
b->buf[b->pos] = 0;
@@ -834,8 +839,7 @@
if (ret < 0) {
GDKerror("response2bat: failed to receive response from %s",
dst);
- if(errno) GDKerror(": %s", strerror(errno));
- GDKerror(".\n");
+ if(errno) GDKerror("response2bat: %s", strerror(errno));
stream_close(in); stream_destroy(in);
return NULL;
}
@@ -940,7 +944,8 @@
b->pos = snprintf(b->buf, b->len, XRPC_HEADER,
SOAP_NS, XRPC_NS, XS_NS, XSI_NS, XRPC_NS, XRPC_LOC,
- rpc_module, rpc_uri, rpc_method);
+ rpc_module, rpc_uri, rpc_method, argc, iterc,
+ updCall?"true":"false");
if (!(argcnt = GDKmalloc(iterc * sizeof(lng*)))) {
GDKerror("CMDhttp_post: failed to malloc argcnt\n");
Index: xrpc_server.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- xrpc_server.mx 18 Apr 2007 19:50:26 -0000 1.37
+++ xrpc_server.mx 25 Apr 2007 21:21:08 -0000 1.38
@@ -193,7 +193,10 @@
"<env:Body>" \
"<xrpc:request xrpc:module=\"%s\"" \
" xrpc:location=\"%s\"" \
- " xrpc:method=\"%s\">"
+ " xrpc:method=\"%s\"" \
+ " xrpc:arity=\"%lld\"" \
+ " xrpc:iter-count=\"%lld\"" \
+ " xrpc:updCall=\"%s\">"
#define XRPC_HTTP_CALL "<xrpc:call>" \
"<xrpc:sequence>" \
@@ -361,7 +364,7 @@
*
* @return the number of nodes found
*/
-static int
+static lng
count_node(char *node_name,
char *ns,
oid start_pre,
@@ -374,7 +377,7 @@
* namespace 'ns' */
(void)ns;
- int nr = 0;
+ lng nr = 0;
oid i;
for (i = start_pre; i <= end_pre; i++) {
@@ -601,6 +604,33 @@
return GDK_SUCCEED;
}
+static lng
+my_strtoll(stream *out, char *val_ptr, char *attr_name)
+{
+ char err[2048];
+
+ errno = 0;
+ lng ret = strtoll(val_ptr, NULL, 10);
+
+ if(errno){
+ snprintf(err, 2048,
+ "Invalid value (\"%s\") of attribute \"%s\": %s",
+ val_ptr, attr_name, strerror(errno));
+ send_err(out, 1, ERR404, "env:Sender", err);
+ return -1;
+ }
+
+ if(ret < 0){
+ snprintf(err, 2048,
+ "Invalid value (\"%s\") of attribute \"%s\": "
+ "should not be negative",
+ val_ptr, attr_name);
+ send_err(out, 1, ERR404, "env:Sender", err);
+ return -1;
+ }
+ return ret;
+}
+
/**
* @return GDK_SUCCEED, or
* GDK_FAIL if an error has occurred.
@@ -703,15 +733,42 @@
(!isAdmin && !isTrusted(out, *location)) )
return GDK_FAIL;
- if (!(iterc = count_node("call", XRPC_NS, pre+1, last_pre,
- pre_propT, pre_kindT, qn_loc))) {
- send_err(out, 1, ERR404, "env:Sender",
- "\"call\" node not found");
+ char *val_ptr = NULL;
+ val_ptr = get_attr_val(out, "iter-count", XRPC_NS, pre, nattrs,
+ attr_ownT, attr_qnT, attr_propT, qn_loc, qn_uri, prop_val);
+ if(!val_ptr)
+ return GDK_FAIL;
+ iterc = my_strtoll(out, val_ptr, "iter-count");
+ if(iterc < 0 )
+ return GDK_FAIL;
+ i = count_node("call", XRPC_NS, pre+1, last_pre, pre_propT,
+ pre_kindT, qn_loc);
+ if (iterc != i) {
+ snprintf(errstr, 1024, "The value (%lld) of the attribute "
+ "\"iter-count\" does not match the number of \"call\" "
+ "nodes (%lld) in the request message", iterc, i);
+ send_err(out, 1, ERR404, "env:Sender", errstr);
return GDK_FAIL;
}
- argc = count_node("sequence", XRPC_NS, pre+2, last_pre,
- pre_propT, pre_kindT, qn_loc) / iterc;
+ val_ptr = get_attr_val(out, "arity", XRPC_NS, pre, nattrs,
+ attr_ownT, attr_qnT, attr_propT, qn_loc, qn_uri,
+ prop_val);
+ if(!val_ptr)
+ return GDK_FAIL;
+ argc = my_strtoll(out, val_ptr, "arity");
+ if(argc < 0 )
+ return GDK_FAIL;
+ i = count_node("sequence", XRPC_NS, pre+2, last_pre, pre_propT,
+ pre_kindT, qn_loc) / iterc;
+ if(argc != i){
+ snprintf(errstr, 1024, "The value (%lld) of the attribute "
+ "\"arity\" does not match the number of \"sequence\" "
+ "nodes (%lld) in each \"call\" node in the request "
+ "message", argc, i);
+ send_err(out, 1, ERR404, "env:Sender", errstr);
+ return GDK_FAIL;
+ }
if (!(argcnt = GDKmalloc(iterc * sizeof(lng*)))) {
send_err(out, 1, ERR500, "env:Receiver", OUT_OF_MEM);
@@ -827,7 +884,7 @@
int off;
for (off = 0; off < nattrs; off++) {
if (attr_ownT[off] == tpe_node_pre) {
- val_node_pre = attr_propT[off];
+ val_node_pre = off;
break;
}
}
@@ -975,8 +1032,7 @@
argval, shredBAT);
if (err) {
if(err == ((char*)-1)) {
- err = strstr(errbuf, "first error was:"); assert(err);
- err = strstr(err, "!ERROR"); assert(err);
+ err = errbuf;
}
send_err(mc->c->fdout, 0, "", "env:Sender", err);
return GDK_FAIL;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins