Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-04-07 12:22:45 +0000
committerEike Stepper2008-04-07 12:22:45 +0000
commit102e6770982f5374b1099d2a76fc814163de8917 (patch)
tree6292ea681628fdc2d568a12d93f8e0c93b6ae6db /plugins/org.eclipse.net4j.db
parentdf04525b9d0b58c0e82f59ee6a6749646bf16dd0 (diff)
downloadcdo-102e6770982f5374b1099d2a76fc814163de8917.tar.gz
cdo-102e6770982f5374b1099d2a76fc814163de8917.tar.xz
cdo-102e6770982f5374b1099d2a76fc814163de8917.zip
[214487] Use prepared statements if appropriate
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214487
Diffstat (limited to 'plugins/org.eclipse.net4j.db')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
index 686db7f100..81f1d9c953 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
@@ -114,14 +114,35 @@ public enum DBType
{
if (value instanceof String || value instanceof Character)
{
+ builder.append("'");
if (value instanceof String)
{
- value = ((String)value).replaceAll("'", "\\'");
+ /*
+ * Stefan Winkler <stefan.winkler-et@fernuni-hagen.de> 2008-04-01 (no April's joke!) changed \\' to \\\\'
+ * because at least with MySQL \\' is not enough for some reason - the \\ get eaten up somewhere on the way
+ * :-(
+ */
+
+ String str = (String)value;
+ for (int i = 0; i < str.length(); i++)
+ {
+ char c = str.charAt(i);
+ if (c == '\'')
+ {
+ builder.append("\\\'");
+ }
+ else
+ {
+ builder.append(c);
+ }
+ }
+ }
+ else
+ {
+ builder.append(value);
}
builder.append("'");
- builder.append(value);
- builder.append("'");
}
else
{

Back to the top