jet.sql
Class WebSql

java.lang.Object
  extended by jet.sql.WebSql

public class WebSql
extends java.lang.Object

Author:
Markus Meisters

Field Summary
(package private)  int absolute
          offset
private  java.lang.Boolean autocommitChanged
          Indicates if autocommit was changedand holds the old value
protected  java.sql.Connection c
          Holds the connection
private static boolean debug
          Indicates if we run in debug modus
(package private)  int limit
          max rows returned
protected static org.apache.log4j.Logger log
          Logger object for debug
protected  java.sql.PreparedStatement p
          Holds the current prepared statement
(package private)  int pos
          helper var for setting values to prepared statement
protected  java.util.List<java.sql.PreparedStatement> ps
          Holds the prepared statements returned
protected  java.util.List rs
          Holds the results returned
protected  java.lang.String sql
          remember the statement for error messages
 
Constructor Summary
WebSql()
          Empty constructor
 
Method Summary
 void commit()
          calls Connection.commit()
 int executeUpdate()
          Executes the prepared statement and returns the amount of effected rows.
 void finalize()
          closes all database handles if they not null
 java.sql.ResultSet getResultSet()
          Executes the prepared query and returns a resultset
 RowSetDynaClass getRowSetDynaClass()
          Executes the prepared query and returns a RowSetDynaClass
 boolean hasConnection()
          Indicates if the util has already a connection set
 int pos()
          This method could be used to determine the current position to insert into the prepared statement - but wo have to use it on every set-method if you use it!
 int pos(boolean reset)
          This method could be used to determine the current position to insert into the prepared statement - but wo have to use it on every set-method if you use it!
 void prepareStatement(java.lang.String sql)
          Method to prepare a sql statement
 void prepareStatement(java.lang.String sql, int absolute, int limit)
          Method to prepare a sql statement
 void rollback()
          calls Connection.rollback()
 void setAsciiStream(java.io.InputStream x)
           
 void setAsciiStream(java.io.InputStream x, int bytes)
           
 void setAsciiStream(int parameterIndex, java.io.InputStream x)
           
 void setAsciiStream(int parameterIndex, java.io.InputStream x, int bytes)
           
 void setAutoCommit(boolean value)
          set the auto commit status to the database connection
 void setBinaryStream(java.io.InputStream x)
           
 void setBinaryStream(java.io.InputStream x, int bytes)
           
 void setBinaryStream(int parameterIndex, java.io.InputStream x)
           
 void setBinaryStream(int parameterIndex, java.io.InputStream x, int bytes)
           
 void setBlob(java.sql.Blob x)
           
 void setBlob(int parameterIndex, java.sql.Blob x)
           
 void setByte(byte x)
           
 void setByte(int parameterIndex, byte x)
           
 void setBytes(byte[] x)
           
 void setBytes(int parameterIndex, byte[] x)
           
 void setCharacterStream(int parameterIndex, java.io.Reader x)
           
 void setCharacterStream(int parameterIndex, java.io.Reader x, int bytes)
           
 void setCharacterStream(java.io.Reader x)
           
 void setCharacterStream(java.io.Reader x, int bytes)
           
 void setClob(java.sql.Clob x)
           
 void setClob(int parameterIndex, java.sql.Clob x)
           
 void setConnection(java.sql.Connection conn)
          Set the connection to use
 void setDate(java.sql.Date x)
           
 void setDate(int parameterIndex, java.sql.Date x)
           
 void setDouble(double x)
           
 void setDouble(int parameterIndex, double x)
           
 void setFloat(float x)
           
 void setFloat(int parameterIndex, float x)
           
 void setInt(int x)
           
 void setInt(int parameterIndex, int x)
           
 void setLong(int parameterIndex, long x)
           
 void setLong(long x)
           
 void setNull(int sqlType)
           
 void setNull(int parameterIndex, int sqlType)
           
 void setObject(int parameterIndex, java.lang.Object x)
           
 void setObject(int parameterIndex, java.lang.Object x, int type)
           
 void setObject(java.lang.Object x)
           
 void setObject(java.lang.Object x, int type)
           
 void setString(int parameterIndex, java.lang.String x)
           
 void setString(java.lang.String x)
           
 void setTime(int parameterIndex, java.sql.Time x)
           
 void setTime(java.sql.Time x)
           
 void setTimestamp(int parameterIndex, java.sql.Timestamp x)
           
 void setTimestamp(java.sql.Timestamp x)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Logger object for debug


p

protected java.sql.PreparedStatement p
Holds the current prepared statement


ps

protected java.util.List<java.sql.PreparedStatement> ps
Holds the prepared statements returned


rs

protected java.util.List rs
Holds the results returned


c

protected java.sql.Connection c
Holds the connection


sql

protected java.lang.String sql
remember the statement for error messages


pos

int pos
helper var for setting values to prepared statement


absolute

int absolute
offset


limit

int limit
max rows returned


debug

private static boolean debug
Indicates if we run in debug modus


autocommitChanged

private java.lang.Boolean autocommitChanged
Indicates if autocommit was changedand holds the old value

Constructor Detail

WebSql

public WebSql()
Empty constructor

Method Detail

prepareStatement

public void prepareStatement(java.lang.String sql)
                      throws java.sql.SQLException,
                             java.lang.IllegalStateException
Method to prepare a sql statement

Parameters:
sql - the sql to prepare
Throws:
java.sql.SQLException
java.lang.IllegalStateException

prepareStatement

public void prepareStatement(java.lang.String sql,
                             int absolute,
                             int limit)
                      throws java.sql.SQLException,
                             java.lang.IllegalStateException
Method to prepare a sql statement

Parameters:
sql - the sql to prepare
absolute - the position in the resultset
limit - maximum count of rows returned
Throws:
java.sql.SQLException
java.lang.IllegalStateException

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException
Executes the prepared query and returns a resultset

Throws:
java.sql.SQLException

getRowSetDynaClass

public RowSetDynaClass getRowSetDynaClass()
                                   throws java.sql.SQLException
Executes the prepared query and returns a RowSetDynaClass

Throws:
java.sql.SQLException

setObject

public void setObject(int parameterIndex,
                      java.lang.Object x)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setObject(int,Object)

setObject

public void setObject(int parameterIndex,
                      java.lang.Object x,
                      int type)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setObject(int,Object,int)

setInt

public void setInt(int parameterIndex,
                   int x)
            throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setInt(int,int)

setLong

public void setLong(int parameterIndex,
                    long x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setLong(int, long)

setNull

public void setNull(int parameterIndex,
                    int sqlType)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setNull(int,int)

setDate

public void setDate(int parameterIndex,
                    java.sql.Date x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setDate(int,Date)

setDouble

public void setDouble(int parameterIndex,
                      double x)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setDouble(int,double)

setFloat

public void setFloat(int parameterIndex,
                     float x)
              throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setFloat(int,float)

setString

public void setString(int parameterIndex,
                      java.lang.String x)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setString(int,String)

setTime

public void setTime(int parameterIndex,
                    java.sql.Time x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setTime(int,Time)

setTimestamp

public void setTimestamp(int parameterIndex,
                         java.sql.Timestamp x)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setTimestamp(int,Timestamp)

setAsciiStream

public void setAsciiStream(int parameterIndex,
                           java.io.InputStream x)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setAsciiStream(int,InputStream,int)

setAsciiStream

public void setAsciiStream(int parameterIndex,
                           java.io.InputStream x,
                           int bytes)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setAsciiStream(int,InputStream,int)

setBinaryStream

public void setBinaryStream(int parameterIndex,
                            java.io.InputStream x,
                            int bytes)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBinaryStream(int,InputStream,int)

setBinaryStream

public void setBinaryStream(int parameterIndex,
                            java.io.InputStream x)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBinaryStream(int,InputStream,int)

setCharacterStream

public void setCharacterStream(int parameterIndex,
                               java.io.Reader x,
                               int bytes)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setCharacterStream(int,Reader,int)

setCharacterStream

public void setCharacterStream(int parameterIndex,
                               java.io.Reader x)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setCharacterStream(int,Reader,int)

setBlob

public void setBlob(int parameterIndex,
                    java.sql.Blob x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBlob(int,Blob)

setClob

public void setClob(int parameterIndex,
                    java.sql.Clob x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setClob(int,Clob)

setBytes

public void setBytes(int parameterIndex,
                     byte[] x)
              throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBytes(int,byte[])

setByte

public void setByte(int parameterIndex,
                    byte x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setByte(int,byte)

setObject

public void setObject(java.lang.Object x)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setObject(int,Object)

setObject

public void setObject(java.lang.Object x,
                      int type)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setObject(int,Object,int)

setInt

public void setInt(int x)
            throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setInt(int,int)

setLong

public void setLong(long x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setLong(int, long)

setNull

public void setNull(int sqlType)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setNull(int,int)

setDate

public void setDate(java.sql.Date x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setDate(int,Date)

setDouble

public void setDouble(double x)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setDouble(int,double)

setFloat

public void setFloat(float x)
              throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setFloat(int,float)

setString

public void setString(java.lang.String x)
               throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setString(int,String)

setTime

public void setTime(java.sql.Time x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setTime(int,Time)

setTimestamp

public void setTimestamp(java.sql.Timestamp x)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setTimestamp(int,Timestamp)

setAsciiStream

public void setAsciiStream(java.io.InputStream x)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setAsciiStream(int,InputStream,int)

setAsciiStream

public void setAsciiStream(java.io.InputStream x,
                           int bytes)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setAsciiStream(int,InputStream,int)

setBinaryStream

public void setBinaryStream(java.io.InputStream x,
                            int bytes)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBinaryStream(int,InputStream,int)

setBinaryStream

public void setBinaryStream(java.io.InputStream x)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBinaryStream(int,InputStream,int)

setCharacterStream

public void setCharacterStream(java.io.Reader x,
                               int bytes)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setCharacterStream(int,Reader,int)

setCharacterStream

public void setCharacterStream(java.io.Reader x)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setCharacterStream(int,Reader,int)

setBlob

public void setBlob(java.sql.Blob x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBlob(int,Blob)

setClob

public void setClob(java.sql.Clob x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBlob(int,Blob)

setBytes

public void setBytes(byte[] x)
              throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setBytes(int,byte[])

setByte

public void setByte(byte x)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
PreparedStatement.setByte(int,byte)

setConnection

public void setConnection(java.sql.Connection conn)
                   throws java.sql.SQLException
Set the connection to use

Parameters:
conn - connection object
Throws:
java.sql.SQLException

hasConnection

public boolean hasConnection()
Indicates if the util has already a connection set


pos

public int pos()
This method could be used to determine the current position to insert into the prepared statement - but wo have to use it on every set-method if you use it!


pos

public int pos(boolean reset)
This method could be used to determine the current position to insert into the prepared statement - but wo have to use it on every set-method if you use it!

Parameters:
reset - indicates if the counter should be resetted

executeUpdate

public int executeUpdate()
                  throws java.sql.SQLException
Executes the prepared statement and returns the amount of effected rows.

Returns:
amount of effected rows
Throws:
java.sql.SQLException

finalize

public void finalize()
closes all database handles if they not null

Overrides:
finalize in class java.lang.Object

setAutoCommit

public void setAutoCommit(boolean value)
                   throws java.sql.SQLException
set the auto commit status to the database connection

Throws:
java.sql.SQLException

commit

public void commit()
            throws java.sql.SQLException
calls Connection.commit()

Throws:
java.sql.SQLException

rollback

public void rollback()
              throws java.sql.SQLException
calls Connection.rollback()

Throws:
java.sql.SQLException