Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Panchenko2013-10-19 06:47:53 +0000
committerAlex Panchenko2013-10-19 06:47:53 +0000
commitb4a6600676ea6d59f177c4d1aab6a55790deb277 (patch)
treede83ebf831b03f844a3f66920c513ebd8c29363d
parentf72af29b6021a71342a659ba7cc0b22cf6fb5171 (diff)
downloadorg.eclipse.dltk.core-b4a6600676ea6d59f177c4d1aab6a55790deb277.tar.gz
org.eclipse.dltk.core-b4a6600676ea6d59f177c4d1aab6a55790deb277.tar.xz
org.eclipse.dltk.core-b4a6600676ea6d59f177c4d1aab6a55790deb277.zip
H2*Dao cleanup - pass RETURN_GENERATED_KEYS only when applicable
-rw-r--r--core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java24
-rw-r--r--core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java24
2 files changed, 23 insertions, 25 deletions
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java
index f8838dd7c..57089c2f0 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java
@@ -71,16 +71,16 @@ public class H2ContainerDao implements IContainerDao {
return container;
}
- PreparedStatement statement = connection.prepareStatement(
- Q_SELECT_BY_PATH, Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection
+ .prepareStatement(Q_SELECT_BY_PATH);
try {
int param = 0;
statement.setString(++param, path);
ResultSet result = statement.executeQuery();
try {
if (result.next()) {
- container = new Container(result.getInt(1), result
- .getString(2));
+ container = new Container(result.getInt(1),
+ result.getString(2));
H2Cache.addContainer(container);
}
@@ -101,16 +101,16 @@ public class H2ContainerDao implements IContainerDao {
return container;
}
- PreparedStatement statement = connection.prepareStatement(
- Q_SELECT_BY_ID, Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection
+ .prepareStatement(Q_SELECT_BY_ID);
try {
int param = 0;
statement.setInt(++param, id);
ResultSet result = statement.executeQuery();
try {
if (result.next()) {
- container = new Container(result.getInt(1), result
- .getString(2));
+ container = new Container(result.getInt(1),
+ result.getString(2));
H2Cache.addContainer(container);
}
@@ -124,8 +124,8 @@ public class H2ContainerDao implements IContainerDao {
}
public void deleteById(Connection connection, int id) throws SQLException {
- PreparedStatement statement = connection.prepareStatement(
- Q_DELETE_BY_ID, Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection
+ .prepareStatement(Q_DELETE_BY_ID);
try {
int param = 0;
statement.setInt(++param, id);
@@ -139,8 +139,8 @@ public class H2ContainerDao implements IContainerDao {
public void deleteByPath(Connection connection, String path)
throws SQLException {
- PreparedStatement statement = connection.prepareStatement(
- Q_DELETE_BY_PATH, Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection
+ .prepareStatement(Q_DELETE_BY_PATH);
try {
int param = 0;
statement.setString(++param, path);
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java
index 7734f9dda..3f1e0090e 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java
@@ -69,8 +69,7 @@ public class H2FileDao implements IFileDao {
File file = H2Cache.selectFileByContainerIdAndPath(containerId, path);
if (file == null) {
- PreparedStatement statement = connection.prepareStatement(Q_SELECT,
- Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection.prepareStatement(Q_SELECT);
try {
int param = 0;
statement.setString(++param, path);
@@ -100,17 +99,17 @@ public class H2FileDao implements IFileDao {
if (files == null) {
files = new LinkedList<File>();
- PreparedStatement statement = connection.prepareStatement(
- Q_SELECT_BY_CONTAINER_ID, Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection
+ .prepareStatement(Q_SELECT_BY_CONTAINER_ID);
try {
int param = 0;
statement.setInt(++param, containerId);
ResultSet result = statement.executeQuery();
try {
while (result.next()) {
- File file = new File(result.getInt(1), result
- .getString(2), result.getLong(3), result
- .getInt(4));
+ File file = new File(result.getInt(1),
+ result.getString(2), result.getLong(3),
+ result.getInt(4));
files.add(file);
H2Cache.addFile(file);
@@ -129,8 +128,8 @@ public class H2FileDao implements IFileDao {
File file = H2Cache.selectFileById(id);
if (file == null) {
- PreparedStatement statement = connection.prepareStatement(
- Q_SELECT_BY_ID, Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection
+ .prepareStatement(Q_SELECT_BY_ID);
try {
int param = 0;
statement.setInt(++param, id);
@@ -155,8 +154,7 @@ public class H2FileDao implements IFileDao {
public void delete(Connection connection, String path, int containerId)
throws SQLException {
- PreparedStatement statement = connection.prepareStatement(Q_DELETE,
- Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection.prepareStatement(Q_DELETE);
try {
int param = 0;
statement.setString(++param, path);
@@ -170,8 +168,8 @@ public class H2FileDao implements IFileDao {
}
public void deleteById(Connection connection, int id) throws SQLException {
- PreparedStatement statement = connection.prepareStatement(
- Q_DELETE_BY_ID, Statement.RETURN_GENERATED_KEYS);
+ PreparedStatement statement = connection
+ .prepareStatement(Q_DELETE_BY_ID);
try {
int param = 0;
statement.setInt(++param, id);

Back to the top