diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2010-04-19 16:03:31 +0000 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2010-04-19 16:03:31 +0000 |
commit | 69c75bec0b0423e038452bf126c39baa7196adfd (patch) | |
tree | be568862a1995f39321a429a5bf041457b743981 /src/net/sourceforge/opentracking/helper/NamedParameterStatement.java | |
parent | 79cb531f8511d0a4f34327b0df4f858bd7cf68f3 (diff) | |
download | trackermap-server-69c75bec0b0423e038452bf126c39baa7196adfd.tar.gz trackermap-server-69c75bec0b0423e038452bf126c39baa7196adfd.tar.bz2 trackermap-server-69c75bec0b0423e038452bf126c39baa7196adfd.zip |
Diffstat (limited to 'src/net/sourceforge/opentracking/helper/NamedParameterStatement.java')
-rw-r--r-- | src/net/sourceforge/opentracking/helper/NamedParameterStatement.java | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/src/net/sourceforge/opentracking/helper/NamedParameterStatement.java b/src/net/sourceforge/opentracking/helper/NamedParameterStatement.java index 2480a15e2..4e5ffc4fc 100644 --- a/src/net/sourceforge/opentracking/helper/NamedParameterStatement.java +++ b/src/net/sourceforge/opentracking/helper/NamedParameterStatement.java @@ -1,18 +1,3 @@ -/* - * Copyright 2010 Anton Tananaev (anton@tananaev.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package net.sourceforge.opentracking.helper; import java.sql.Connection; @@ -128,34 +113,26 @@ public class NamedParameterStatement { statement.close(); } - /** - * Set a parameter - */ - /*public void setObject(String name, Object value) throws SQLException { + public void setInt(String name, int value) throws SQLException { List indexList = (List) indexMap.get(name); - if (indexList != null) { - for (Object index: indexList) { - statement.setObject((Integer) index, value); - } - } - else { - throw new IllegalArgumentException(); + if (indexList != null) for (Object index: indexList) { + statement.setInt((Integer) index, value); } - }*/ + } - public void setInt(String name, int value) throws SQLException { + public void setLong(String name, long value) throws SQLException { List indexList = (List) indexMap.get(name); - for (Object index: indexList) { - statement.setInt((Integer) index, value); + if (indexList != null) for (Object index: indexList) { + statement.setLong((Integer) index, value); } } public void setBoolean(String name, boolean value) throws SQLException { List indexList = (List) indexMap.get(name); - for (Object index: indexList) { + if (indexList != null) for (Object index: indexList) { statement.setBoolean((Integer) index, value); } } @@ -163,7 +140,7 @@ public class NamedParameterStatement { public void setDouble(String name, double value) throws SQLException { List indexList = (List) indexMap.get(name); - for (Object index: indexList) { + if (indexList != null) for (Object index: indexList) { statement.setDouble((Integer) index, value); } } @@ -171,7 +148,7 @@ public class NamedParameterStatement { public void setTimestamp(String name, Date value) throws SQLException { List indexList = (List) indexMap.get(name); - for (Object index: indexList) { + if (indexList != null) for (Object index: indexList) { statement.setTimestamp( (Integer) index, new Timestamp(value.getTime())); |