Methods Summary |
---|
public void | clearParameters()
// Clear all the bound parameters
boundParams.clear();
|
public boolean | execute()
resultSetColumns = null;
// First, parse the sql statement into a String array
parsedSQL = ownerConnection.parseSQL(sqlStatement);
// Now validate the SQL statement and execute it.
// Returns true if a result set exists.
boolean rc = prepare(false);
return rc;
|
public boolean | execute(java.lang.String sql)
throw new SQLException("Method is not valid");
|
public java.sql.ResultSet | executeQuery()
if (traceOn()) {
trace("@executeQuery()");
}
java.sql.ResultSet rs = null;
// Execute the query. If execute returns true, then a result set
// exists
if (execute()) {
rs = getResultSet();
}
return rs;
|
public java.sql.ResultSet | executeQuery(java.lang.String sql)
throw new SQLException("Method is not valid");
|
public int | executeUpdate()
if (traceOn()) {
trace("@executeUpdate()");
}
int count = -1;
// Execute the query. If execute returns false, then an update
// count exists.
if (execute() == false) {
count = getUpdateCount();
}
return count;
|
public int | executeUpdate(java.lang.String sql)
throw new SQLException("Method is not valid");
|
protected int | getObjectType(java.lang.Object x)
// Determine the data type of the Object by attempting to cast
// the object. An exception will be thrown if an invalid casting
// is attempted.
try {
if ((String) x != null) {
return Types.VARCHAR;
}
}
catch (Exception ex) {
}
try {
if ((Integer) x != null) {
return Types.INTEGER;
}
}
catch (Exception ex) {
}
try {
if ((byte[]) x != null) {
return Types.VARBINARY;
}
}
catch (Exception ex) {
}
throw new SQLException("Unknown object type");
|
public void | initialize(SimpleTextIConnection con, java.lang.String sql)
super.initialize(con);
// Save the SQL statement
sqlStatement = sql;
// To prepare the statement, we must parse and validate. The act
// of preparing does nothing more than validate the statement; it
// does not save an execution plan. When the prepared statement is
// executed, it is re-parsed and re-validated each time.
parsedSQL = ownerConnection.parseSQL(sql);
// Prepare the statement, indicating the we are only preparing
prepare(true);
// Create a new boundParams Hashtable
boundParams = new Hashtable();
|
public void | setAsciiStream(int parameterIndex, java.io.InputStream x, int length)
// Only binary InputStreams are current supported
throw DataTypeNotSupported();
|
public void | setBigDecimal(int parameterIndex, java.math.BigDecimal x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setBinaryStream(int parameterIndex, java.io.InputStream x, int length)
// Validate the parameter index
verify(parameterIndex);
// Read in the entire InputStream all at once. A more optimal
// way of handling this would be to defer the read until execute
// time, and only read in chunks at a time.
byte b[] = new byte[length];
try {
x.read(b);
}
catch (Exception ex) {
throw new SQLException("Unable to read InputStream: " +
ex.getMessage());
}
// Set the data as a byte array
setBytes(parameterIndex, b);
|
public void | setBoolean(int parameterIndex, boolean x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setByte(int parameterIndex, byte x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setBytes(int parameterIndex, byte[] x)
// Validate the parameter index
verify(parameterIndex);
// Put the parameter into the boundParams Hashtable. Coerce the
// data into a String
boundParams.put(new Integer(parameterIndex),
(new CommonValue(x)).getString());
|
public void | setDate(int parameterIndex, java.sql.Date x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setDouble(int parameterIndex, double x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setFloat(int parameterIndex, float x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setInt(int parameterIndex, int x)
// Validate the parameter index
verify(parameterIndex);
// Put the parameter into the boundParams Hashtable. Coerce the
// data into a String
boundParams.put(new Integer(parameterIndex),
(new CommonValue(x)).getString());
|
public void | setLong(int parameterIndex, long x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setNull(int parameterIndex, int sqlType)
// The SimpleText driver does not support null values
throw DriverNotCapable();
|
public void | setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale)
//TODO
|
public void | setObject(int parameterIndex, java.lang.Object x, int targetSqlType)
setObject(parameterIndex, x, targetSqlType, 0);
|
public void | setObject(int parameterIndex, java.lang.Object x)
// We don't handle nulls
if (x == null) {
throw new SQLException("Null values are not supported");
}
// Determine the data type of the object. We'll do this by attempting
// to cast the given Object to the data types that are supported.
int type = getObjectType(x);
setObject(parameterIndex, x, type);
|
public void | setShort(int parameterIndex, short x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setString(int parameterIndex, java.lang.String x)
// Validate the parameter index
verify(parameterIndex);
// Put the parameter into the boundParams Hashtable
boundParams.put(new Integer(parameterIndex), x);
|
public void | setTime(int parameterIndex, java.sql.Time x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setTimestamp(int parameterIndex, java.sql.Timestamp x)
// The SimpleText driver does not support this data type. We could
// coerce the data, but an exception is will be thrown for now.
throw DataTypeNotSupported();
|
public void | setUnicodeStream(int parameterIndex, java.io.InputStream x, int length)
// Only binary InputStreams are current supported
throw DataTypeNotSupported();
|
protected void | verify(int parameterIndex)
clearWarnings();
// The paramCount was set when the statement was prepared
if ((parameterIndex <= 0) ||
(parameterIndex > paramCount)) {
throw new SQLException("Invalid parameter number: " +
parameterIndex);
}
// If the parameter has already been set, clear it
if (boundParams.get(new Integer(parameterIndex)) != null) {
boundParams.remove(new Integer(parameterIndex));
}
|