info.informatica.data.sql
Class TableMetaData

java.lang.Object
  extended by info.informatica.data.MetaData
      extended by info.informatica.data.sql.TableMetaData

public class TableMetaData
extends MetaData

MetaData involving a database table.

Author:
amengual at informatica dot info

Constructor Summary
TableMetaData(String name)
           
TableMetaData(String schemaName, String name)
           
 
Method Summary
 int doDelete(Connection con, Valueset view)
          Performs a delete.
 int doInsert(Connection con, Valueset view)
          Performs an Insert query.
 ResultSet doKeySelect(Connection con, Valueset view)
          Performs a Select query with Keys in Where clause.
 boolean doSafeInsert(Connection con, Valueset view)
          Performs a safe Insert query.
 ResultSet doSelect(Connection con)
          Performs a Select query with no fields in Where clause.
 int doUpdate(Connection con, Valueset view)
          Performs an Update query.
 SQLStatement getDeleteStmt()
           
 SQLStatement getInsertStmt()
           
 SelectStatement getKeySelectStmt()
          Gives the Select statement with the key fields in the WHERE part of the statement.
 SelectStatement getSelectStatement()
          Gives a default Select statement.
 SQLStatement getUpdateStmt()
           
 
Methods inherited from class info.informatica.data.MetaData
addDataEntity, count, fillStatement, fillStatement, findColumn, getData, getDataEntity, getDataEntity, getDataFields, getInsertFieldNames, getKeyNames, getLabel, getLocalLabels, getName, getNames, getSampleDataset, getSchemaName, getUpdateFieldNames, rename, replace, setLocalLabels, toCreateTableString, toString, validate, validate, validate, validate, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableMetaData

public TableMetaData(String name)

TableMetaData

public TableMetaData(String schemaName,
                     String name)
Method Detail

getSelectStatement

public SelectStatement getSelectStatement()
Gives a default Select statement.

Returns:
the Select statement.

getKeySelectStmt

public SelectStatement getKeySelectStmt()
                                 throws DataException
Gives the Select statement with the key fields in the WHERE part of the statement.

Returns:
the Select statement, or null if there are no keys in the metadata.
Throws:
DataException

getDeleteStmt

public SQLStatement getDeleteStmt()
                           throws DataException
Returns:
the Delete statement String automatically generated by the dictionary
Throws:
DataException

getInsertStmt

public SQLStatement getInsertStmt()
Returns:
the Insert statement String automatically generated by the dictionary

getUpdateStmt

public SQLStatement getUpdateStmt()
Returns:
the Update statement String automatically generated by the dictionary

doDelete

public int doDelete(Connection con,
                    Valueset view)
             throws SQLException,
                    DataException
Performs a delete. Parameter i of the Statement is filled with the value of the i field of the form.

Parameters:
con - the connection
view - the dataview
Returns:
the row count
Throws:
SQLException
DataException

doSelect

public ResultSet doSelect(Connection con)
                   throws SQLException,
                          DataException
Performs a Select query with no fields in Where clause. Parameter i of the Statement is filled with the value of the i field of the form.

Parameters:
con - the connection
Returns:
the ResultSet
Throws:
SQLException
DataException

doKeySelect

public ResultSet doKeySelect(Connection con,
                             Valueset view)
                      throws SQLException,
                             DataException
Performs a Select query with Keys in Where clause. Parameter i of the Statement is filled with the value of the i field of the form.

Parameters:
con - the connection
view - the dataview
Returns:
the ResultSet
Throws:
SQLException
DataException

doSafeInsert

public boolean doSafeInsert(Connection con,
                            Valueset view)
                     throws SQLException,
                            DataException
Performs a safe Insert query. Parameter i of the Statement is filled with the value of the i field of the form.

Parameters:
con - the connection
view - the dataview
Returns:
true if the INSERT succeeded, false otherwise.
Throws:
SQLException
DataException

doInsert

public int doInsert(Connection con,
                    Valueset view)
             throws SQLException,
                    DataException
Performs an Insert query. Parameter i of the Statement is filled with the value of the i field of the dataview.

Be sure to validate the fields first.

Parameters:
con - the connection
view - the dataview
Returns:
the row count
Throws:
SQLException
DataException

doUpdate

public int doUpdate(Connection con,
                    Valueset view)
             throws SQLException,
                    DataException
Performs an Update query. Parameter i of the Statement is filled with the value of the i field of the dataview.

Parameters:
con - the connection
view - the dataview
Returns:
the row count
Throws:
SQLException
DataException