Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16:/tmp/cvs-serv32148
Modified Files:
Tag: XQuery_0-16
serialize_dflt.mx
Log Message:
-- Added two additional handlers for the "seq" mode consumed by JDBC.
The handler functions now additionally escape the characters \t, \\, \', and
\".
This should fix bug 1670732.
Index: serialize_dflt.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize_dflt.mx,v
retrieving revision 1.23.2.6
retrieving revision 1.23.2.7
diff -u -d -r1.23.2.6 -r1.23.2.7
--- serialize_dflt.mx 16 Mar 2007 20:31:09 -0000 1.23.2.6
+++ serialize_dflt.mx 11 Apr 2007 10:03:41 -0000 1.23.2.7
@@ -199,7 +199,7 @@
*
* Emit a string with all special character escaped.
*/
-@:emit_escaped(,)@
+@:emit_escaped(_all,)@
/*
* This function is responsible for the presentation of special characters
* and XML entity characters in the result.
@@ -391,6 +391,17 @@
/**
* Output generation handler. Handles equivalent of * SAX ignorableWhitespace()
+ * Output generation handler. Handles equivalent of * SAX characters() event.
+ */
+static bool
+seq_handle_characters (XqueryCtx* ctx, str chars)
+{
+ emit_escaped_all (ctx, chars);
+
+ return SUCCESS;
+}
+
+/**
* event. I see no reason why it should be used here but I include it for
* completeness.
*/
@@ -481,7 +492,7 @@
}
stream_write (ctx->out, &e_, 1, 1); /* = */
stream_write (ctx->out, dflt_ws->esc_quote, dflt_ws->esq_sz, 1);
- emit_escaped (ctx, value);
+ emit_escaped_all (ctx, value);
stream_write (ctx->out, dflt_ws->esc_quote, dflt_ws->esq_sz, 1);
return SUCCESS;
@@ -529,7 +540,7 @@
static bool
dflt_seqEmitStr (XqueryCtx* ctx, str sv)
{
- emit_escaped (ctx, sv);
+ emit_escaped_all (ctx, sv);
return SUCCESS;
}
@@ -541,7 +552,7 @@
esc_seqEmitStr (XqueryCtx* ctx, str sv)
{
stream_write (ctx->out, dflt_ws->esc_quote, dflt_ws->esq_sz, 1);
- emit_escaped (ctx, sv);
+ emit_escaped_all (ctx, sv);
stream_write (ctx->out, dflt_ws->esc_quote, dflt_ws->esq_sz, 1);
return SUCCESS;
@@ -589,6 +600,23 @@
return SUCCESS;
}
+/**
+ * Output generation handler. Handles top-level textnodes.
+ */
+static bool
+seq_seqEmitTextnode (XqueryCtx* ctx, str chars)
+{
+ stream_write (ctx->out, textnodeStart, tnS_sz, 1);
+ stream_write (ctx->out, dflt_ws->esc_quote, dflt_ws->esq_sz, 1);
+
+ emit_escaped_all (ctx, chars);
+
+ stream_write (ctx->out, dflt_ws->esc_quote, dflt_ws->esq_sz, 1);
+ stream_write (ctx->out, textnodeEnd, tnE_sz, 1);
+
+ return SUCCESS;
+}
+
/**
@@ -1289,8 +1317,8 @@
dflt_handle_endDocument,
dflt_handle_startElement,
dflt_handle_endElement,
- dflt_handle_characters,
- dflt_handle_ignorableWhitespace,
+ seq_handle_characters,
+ seq_handle_characters,
dflt_handle_comment,
dflt_handle_processingInstruction,
@@ -1303,7 +1331,7 @@
dflt_seqEmitDbl,
esc_seqEmitStr,
dflt_seqEmitAttribute,
- dflt_seqEmitTextnode,
+ seq_seqEmitTextnode,
seq_seqStart,
null_complete_seqStart,
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins