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

Modified Files:
      Tag: XQuery_0-24
        milgen.brg 
Log Message:
fix for bug 
[ 1981873 ] PF/alg: behavior of test replace05 differs from MPS

We do not support variables in replacement strings for both MPS and Algebra


U milgen.brg
Index: milgen.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milgen.brg,v
retrieving revision 1.157.2.11
retrieving revision 1.157.2.12
diff -u -d -r1.157.2.11 -r1.157.2.12
--- milgen.brg  5 Jun 2008 21:50:28 -0000       1.157.2.11
+++ milgen.brg  6 Jun 2008 10:15:54 -0000       1.157.2.12
@@ -2502,7 +2502,8 @@
                     assgn (var (try->name),
                            add (var (try->name),
                                 lit_int(1))));
-            } else {
+            }
+            else {
                 if (aat_docmgmt & type_of (L(p), pa_item))
                     create = CREATE_DOCMGM_WS;
                 else
@@ -4826,31 +4827,42 @@
                                    VAR (L(p)->env, att3, aat_str))));
                 }   break; /* fold) */
                 case alg_fun_fn_replace: /* fold( */
+                case alg_fun_fn_replace_flag:
                 {
-                    PFalg_att_t att1, att2, att3;
+                    PFalg_att_t  att1, att2, att3;
+                    PFmil_t     *flags = NULL;
+                    mvar_t      *chk   = 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_str;
 
+                    switch (p->sem.fun_1to1.kind) {
+                        case alg_fun_fn_replace:
+                            flags = lit_str("");
+                            break;
+                        case alg_fun_fn_replace_flag:
+                            flags = VAR (L(p)->env,
+                                         p->sem.fun_1to1.refs.atts[3],
+                                         aat_str);
+                            break;
+                        default:
+                            assert(!"should never reach here"); break;
+                    }
+
+                    /* check whether the replacement
+                     * string contains variables */
                     execute (
-                        assgn (var (res->name),
-                               mpcre_replace (
-                                   VAR (L(p)->env, att1, aat_str),
-                                   VAR (L(p)->env, att2, aat_str),
-                                   VAR (L(p)->env, att3, aat_str),
-                                   lit_str(""))));
-                }   break; /* fold) */
-                case alg_fun_fn_replace_flag: /* fold( */
-                {
-                    PFalg_att_t att1, att2, att3, att4;
+                        assgn (var (chk->name),
+                               mpcre_match (VAR (L(p)->env, att3, aat_str),
+                                            lit_str("[$][0-9]"))),
+                        if_ (texist (var (chk->name), lit_bit(true)),
+                             error (lit_str ("Variables in replacements are "
+                                             "not supported yet")),
+                             nop ()));
 
-                    att1 = p->sem.fun_1to1.refs.atts[0];
-                    att2 = p->sem.fun_1to1.refs.atts[1];
-                    att3 = p->sem.fun_1to1.refs.atts[2];
-                    att4 = p->sem.fun_1to1.refs.atts[3];
-                    res_type = aat_str;
+                    unpin (chk, 1);
 
                     execute (
                         assgn (var (res->name),
@@ -4858,7 +4870,7 @@
                                    VAR (L(p)->env, att1, aat_str),
                                    VAR (L(p)->env, att2, aat_str),
                                    VAR (L(p)->env, att3, aat_str),
-                                   VAR (L(p)->env, att4, aat_str))));
+                                   flags)));
                 }   break; /* fold) */
                 case alg_fun_fn_name: /* fold( */
                 {


-------------------------------------------------------------------------
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