db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henn...@apache.org
Subject cvs commit: db-torque/src/generator/src/java/org/apache/torque/engine/database/transform XmlToData.java
Date Mon, 28 Jul 2003 11:48:13 GMT
henning     2003/07/28 04:48:13

  Modified:    src/generator/src/java/org/apache/torque/engine/database/transform
                        XmlToData.java
  Log:
  Give the data container a method which returns the escaped value of
  a field. Make sure, that ticks inside a string are properly escaped.
  
  Revision  Changes    Path
  1.7       +12 -1     db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/XmlToData.java
  
  Index: XmlToData.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/XmlToData.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlToData.java	28 Jul 2003 11:10:10 -0000	1.6
  +++ XmlToData.java	28 Jul 2003 11:48:13 -0000	1.7
  @@ -66,6 +66,8 @@
   import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.SAXParserFactory;
   
  +import org.apache.commons.lang.StringUtils;
  +
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  @@ -272,6 +274,15 @@
           public String getValue()
           {
               return val;
  +        }
  +
  +        public String getEscapedValue()
  +        {
  +            StringBuffer sb = new StringBuffer();
  +            sb.append("'");
  +            sb.append(StringUtils.replace(val, "'", "\\'"));
  +            sb.append("'");
  +            return sb.toString();
           }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message