summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-04-07 08:36:30 (EDT)
committerEike Stepper2008-04-07 08:36:30 (EDT)
commit1291bf4e3c6c1ba54e066925929e2929479e92dc (patch)
treee57f1530e208314d96a57bc833fd060a213a3eab
parentaf9d4176b9185a76d36154ad1829c8092929f0f3 (diff)
downloadcdo-1291bf4e3c6c1ba54e066925929e2929479e92dc.zip
cdo-1291bf4e3c6c1ba54e066925929e2929479e92dc.tar.gz
cdo-1291bf4e3c6c1ba54e066925929e2929479e92dc.tar.bz2
[214487] Use prepared statements if appropriate
https://bugs.eclipse.org/bugs/show_bug.cgi?id=214487
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java13
2 files changed, 16 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java
index eb9f802..7cfde93 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.server.db;
import org.eclipse.emf.cdo.server.IStoreAccessor;
import java.sql.Connection;
+import java.sql.PreparedStatement;
import java.sql.Statement;
/**
@@ -25,4 +26,6 @@ public interface IDBStoreAccessor extends IStoreAccessor
public Connection getConnection();
public Statement getStatement();
+
+ public PreparedStatement prepareStatement(String sql);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index 6ec6e29..e99a08a 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -24,6 +24,7 @@ import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.ddl.IDBTable;
import java.sql.Connection;
+import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashSet;
@@ -98,6 +99,18 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
return statement;
}
+ public PreparedStatement prepareStatement(String sql)
+ {
+ try
+ {
+ return getConnection().prepareStatement(sql);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
/**
* TODO Move this somehow to DBAdapter
*/