Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25425/mil

Modified Files:
      Tag: XQuery_0-24
        milgen.brg 
Log Message:
Test the flags passed to pcre_match function, and catch any error if exists.

This is a bug-fix for [ 1981735 ] PF/alg: some error messages differ from PF/mps
(test/Xquery matches01 and matches02)


U milgen.brg
Index: milgen.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milgen.brg,v
retrieving revision 1.157.2.13
retrieving revision 1.157.2.14
diff -u -d -r1.157.2.13 -r1.157.2.14
--- milgen.brg  7 Jun 2008 08:17:46 -0000       1.157.2.13
+++ milgen.brg  9 Jun 2008 12:00:30 -0000       1.157.2.14
@@ -4813,18 +4813,44 @@
                 case alg_fun_fn_matches_flag: /* fold( */
                 {
                     PFalg_att_t att1, att2, att3;
+                    mvar_t *chk = new_var(1),
+                           *err = new_var(1);
 
                     att1 = p->sem.fun_1to1.refs.atts[0];
                     att2 = p->sem.fun_1to1.refs.atts[1];
                     att3 = p->sem.fun_1to1.refs.atts[2];
                     res_type = aat_bln;
 
+                    /* check flags for validity */
+                    execute (
+                        catch_ (var (err->name),
+                                seq ( assgn (var (chk->name),
+                                             mpcre_match (
+                                                 VAR (L(p)->env,
+                                                      att3,
+                                                      aat_str),
+                                                 lit_str("[^imsx]"))))),
+                        if_ (not (isnil (var (err->name))),
+                             error (
+                                 arg (lit_str ("Should not happen: "
+                                      "error occurred while checking flags: "),
+                                      var (err->name))),
+                             nop ()),
+                        if_ (texist (var (chk->name), lit_bit(true)),
+                             error (lit_str ("err:FORX0001: flags of "
+                                             "fn:matches containing "
+                                             "undefined character(s)")),
+                             nop ()));
+
                     execute (
                         assgn (var (res->name),
                                mpcre_match_flag (
                                    VAR (L(p)->env, att1, aat_str),
                                    VAR (L(p)->env, att2, aat_str),
                                    VAR (L(p)->env, att3, aat_str))));
+
+                    unpin (chk, 1);
+                    unpin (err, 1);
                 }   break; /* fold) */
                 case alg_fun_fn_replace: /* fold( */
                 case alg_fun_fn_replace_flag:


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to