You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by cm...@apache.org on 2002/08/23 14:17:06 UTC
cvs commit: jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms JDBCUtils.java
cmlenz 2002/08/23 05:17:06
Modified: src/stores/org/apache/slide/store/impl/rdbms JDBCUtils.java
Log:
- Added JavaDoc class comment
- Added escaping of \ characters
Revision Changes Path
1.2 +7 -7 jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/JDBCUtils.java
Index: JDBCUtils.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/JDBCUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JDBCUtils.java 23 Aug 2002 11:21:40 -0000 1.1
+++ JDBCUtils.java 23 Aug 2002 12:17:06 -0000 1.2
@@ -64,7 +64,7 @@
package org.apache.slide.store.impl.rdbms;
/**
- *
+ * A collection of utility functions for database interaction with JDBC.
*
* @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
* @version $Revision$
@@ -89,7 +89,7 @@
/**
* Encodes a String that will be included in an SQL statement as literal
* String delimited by ' characters. Specifically this routine escapes any
- * occurrences of the ' character inside the string.
+ * occurrences of the ' or \ characters inside the string.
*
* @param string the string to encode
* @return the encoded string
@@ -107,7 +107,7 @@
StringBuffer buf = new StringBuffer(length * 2);
for (int i = 0; i < length; i++) {
char ch = string.charAt(i);
- if (ch == '\'') {
+ if ((ch == '\'') || (ch == '\\')) {
buf.append('\\');
}
buf.append(ch);
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>