Changeset: ba8789542c26 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba8789542c26
Modified Files:
        sql/src/sql/skyserver.sql
Branch: default
Log Message:

Fix ms_stuff(expr1,start,len,expr2) function to delete <len> symbols from
<expr1> starting from <start> position and insert <expr2> in the same place.
Semantic bug causing wrong results with fDMS, fHMS and other skyserver
functions.

Should be fixed in the skyserver demo.
~


diffs (25 lines):

diff -r bfbf2f2bfbf8 -r ba8789542c26 sql/src/sql/skyserver.sql
--- a/sql/src/sql/skyserver.sql Fri Dec 17 17:06:01 2010 +0100
+++ b/sql/src/sql/skyserver.sql Fri Dec 17 18:09:55 2010 +0100
@@ -19,11 +19,16 @@
 BEGIN
        DECLARE res varchar(32), aux varchar(32);
        DECLARE ofset int;
-       SET ofset = 0;
-       SET res = SUBSTRING(s1,ofset,st-1);
-       SET res = res || s3;
-       SET ofset = LENGTH(s1)-len;
-       SET aux = SUBSTRING(s1,ofset, len);
+
+    IF ( st < 0 or st > LENGTH(s1))
+        THEN RETURN '';
+    END IF;
+
+    SET ofset = 1;
+    SET res = SUBSTRING(s1,ofset,st-1);
+    SET res = res || s3;
+    SET ofset = st + len;
+    SET aux = SUBSTRING(s1,ofset,LENGTH(s1)-ofset+1);
        SET res = res || aux;
        RETURN res;
 END;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to