|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jdbcimporter.util.JDBCParameterHelper
The JDBCParameterHelper provides a methods to set parameters of a PreparedStatement and retrieve values from a ResultSet.
Field Summary | |
protected boolean |
emptyStringAsNull
|
protected static org.apache.commons.logging.Log |
LOG
The log for debug information. |
Constructor Summary | |
JDBCParameterHelper()
|
Method Summary | |
boolean |
compareResultSet(java.sql.ResultSet rset,
ImportColumnDef[] columns,
int[] compareIndices,
ColumnValue[] values)
Compare the row in the result set with the values given. |
ColumnValue |
getColumn(java.sql.ResultSet resultSet,
int column,
ColumnDef def)
Returns the column value for a given column index in the result set. |
java.lang.String |
getFullyQualifiedTableName(java.sql.DatabaseMetaData metaData,
java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Returns the fully qualified table name (that includes the catalog and the schema). |
protected boolean |
isStringNull(int type,
java.lang.String val)
|
int[] |
resolveRowStates(java.sql.Connection con,
ImportEntityDef entityDef,
java.util.List rows,
int[] keyIndices,
int[] compareIndices)
Resolve whether the rows provided where imported into the database by select them based on the key indices. |
void |
setColumn(java.sql.PreparedStatement pstmt,
int column,
ColumnDef def,
ColumnValue val)
Set the column value in the prepared statement. |
void |
setEmptyStringAsNull(boolean flag)
Sets a flag indicating how empty strings are set in a prepared statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static org.apache.commons.logging.Log LOG
protected boolean emptyStringAsNull
Constructor Detail |
public JDBCParameterHelper()
Method Detail |
public void setEmptyStringAsNull(boolean flag)
flag
- flag indicating how empty strings are set in a prepared statementpublic void setColumn(java.sql.PreparedStatement pstmt, int column, ColumnDef def, ColumnValue val) throws MalformedDataException
pstmt
- the prepared statementcolumn
- the column indexdef
- the column definitionval
- the column value
MalformedDataException
public int[] resolveRowStates(java.sql.Connection con, ImportEntityDef entityDef, java.util.List rows, int[] keyIndices, int[] compareIndices)
con
- the connectionentityDef
- the entity defrows
- the rows to resolvekeyIndices
- the indices into the entity def columns that represent the primary keycompareIndices
- the indices of the entity def columns that need to be compared
public boolean compareResultSet(java.sql.ResultSet rset, ImportColumnDef[] columns, int[] compareIndices, ColumnValue[] values) throws java.sql.SQLException
rset
- the result setcolumns
- the list of columnscompareIndices
- the indices of the columns that should be comparedvalues
- the column values
java.sql.SQLException
public ColumnValue getColumn(java.sql.ResultSet resultSet, int column, ColumnDef def) throws java.sql.SQLException
resultSet
- the result setcolumn
- the column indexdef
- the column definition
java.sql.SQLException
public java.lang.String getFullyQualifiedTableName(java.sql.DatabaseMetaData metaData, java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
metaData
- The database meta datacatalog
- The catalogschema
- The schematable
- The table
java.sql.SQLException
protected boolean isStringNull(int type, java.lang.String val)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |