public void bind( int paramIndex, Object parameterValue )
throws KExceptionClass{
// check transition
if( status != READY && status != FINISHED_QUERY ){
throw new KExceptionClass(
"**** Query error **** \n" +
"Cannot bind DB transaction. Transaction not READY or FINISHED_QUERY.", null
);
}
// for the record
{
String message = new String();
message = " Binding parameter ";
message += paramIndex;
message += " with [";
message += parameterValue;
message += "]";
log.log( this, message );
}
try {
if( parameterValue instanceof Short )
SQLStatement.setShort( paramIndex, ((Short)parameterValue).shortValue() );
else if( parameterValue instanceof Integer )
SQLStatement.setInt( paramIndex, ((Integer)parameterValue).intValue() );
else if( parameterValue instanceof Long )
SQLStatement.setLong( paramIndex, ((Long)parameterValue).longValue() );
else if( parameterValue instanceof Float )
SQLStatement.setFloat( paramIndex, ((Float)parameterValue).floatValue() );
else if( parameterValue instanceof Double )
SQLStatement.setDouble( paramIndex, ((Double)parameterValue).doubleValue() );
else if( parameterValue instanceof String )
SQLStatement.setString( paramIndex, (String)parameterValue );
else if( parameterValue instanceof java.sql.Date )
SQLStatement.setDate( paramIndex, (java.sql.Date)parameterValue );
else if( parameterValue instanceof java.sql.Time )
SQLStatement.setTime( paramIndex, (java.sql.Time)parameterValue );
else if( parameterValue instanceof java.sql.Timestamp )
SQLStatement.setTimestamp( paramIndex, (java.sql.Timestamp)parameterValue );
else
throw new KExceptionClass( "**** Query error **** \n" +
"Invalid parameter " + paramIndex + " binding with [" + parameterValue + "]", null );
}
catch( Exception err ) {
String message = "**** Query error **** \n" +
"Cannot bind parameter" + paramIndex + " with [" + parameterValue + "].\n";
log.log( this, message + "Exception: " + err );
throw new KExceptionClass( message, err );
}
fetchComplete = true;
}