1 package org.cacert.gigi.database;
4 import java.sql.PreparedStatement;
5 import java.sql.ResultSet;
6 import java.sql.SQLException;
7 import java.sql.Timestamp;
9 public class GigiPreparedStatement {
11 PreparedStatement target;
13 public GigiPreparedStatement(PreparedStatement preparedStatement) {
14 target = preparedStatement;
17 public GigiResultSet executeQuery() {
19 return new GigiResultSet(target.executeQuery());
20 } catch (SQLException e) {
26 public void executeUpdate() {
28 int updated = target.executeUpdate();
30 throw new Error("FATAL: multiple or no data updated: " + updated);
32 } catch (SQLException e) {
38 public boolean execute() {
40 return target.execute();
41 } catch (SQLException e) {
47 public void setInt(int parameterIndex, int x) {
49 target.setInt(parameterIndex, x);
50 } catch (SQLException e) {
56 public void setString(int parameterIndex, String x) {
58 target.setString(parameterIndex, x);
59 } catch (SQLException e) {
65 public void setDate(int parameterIndex, Date x) {
67 target.setDate(parameterIndex, x);
68 } catch (SQLException e) {
74 public void setTimestamp(int parameterIndex, Timestamp x) {
76 target.setTimestamp(parameterIndex, x);
77 } catch (SQLException e) {
83 public int lastInsertId() {
85 ResultSet rs = target.getGeneratedKeys();
87 int id = rs.getInt(1);
90 } catch (SQLException e) {
96 public void setBoolean(int parameterIndex, boolean x) {
98 target.setBoolean(parameterIndex, x);
99 } catch (SQLException e) {
105 private void handleSQL(SQLException e) {
106 // TODO Auto-generated method stub