/*
* DbTableInterface.java
*
*/
package com.m16e.tools.db;
import java.sql.*;
import com.m16e.tools.*;
import com.m16e.tools.xgm.*;
import com.m16e.tools.xml.*;
////////////////////////////////////////////////////////////
public interface DbTableInterface
{
////////////////////////////////////////////////////////////
/**
* Gets the FROM clause of a SQL query
* @return A <code>String</code> containe the FROM clause
* for the SQL query.
*/
public String getFrom();
/**
* Gets the columns part of a SQL statement
* @return An array of <code>String</code>'s containing the
* fields for the SQL query.
*/
public String[] getFieldNames();
////////////////////////////////////////////////////////////
public int getColumnIndex( String colName );
// public Database getDatabase();
public TupleDataModel getDataModel();
public DbTable getDbTable();
////////////////////////////////////////////////////////////
/** Gets the <CODE>i</CODE>th field of this table.
* @param i the index of the field in this table
* @return a <CODE>DbField</CODE> object containing a field's
* instance
*/
public DbField getField( int i );
////////////////////////////////////////////////////////////
/** Gets a field from this table.
* @param name the name of the field in this table
* @return a <CODE>DbField</CODE> object containing a field's
* instance
*/
public DbField getField( String name );
public Integer autoGenId( Integer ... keys )
throws SQLException;
public int getFieldCount();
public String getPKeyOrder();
////////////////////////////////////////////////////////////
/** Gets this table's primary key.
* @throws SQLException in case of error
* @return an array of ints containing the indexes of the fields
* that are part of the primary key
*/
public java.util.List<Integer> getPrimaryKey()
throws SQLException;
////////////////////////////////////////////////////////////
/**
*
* @return the table's name
*/
public String getTableName();
// public void setDatabase( Database database )
// throws SQLException;
////////////////////////////////////////////////////////////
public void setDataModel( TupleDataModel tdm );
public void setTableName( String tableName )
throws SQLException;
public Tuple getTuple();
public void setTuple( Tuple tuple );
public void setTuple( ResultSet rs )
throws SQLException;
public void setTuple( Tuple t, ResultSet rs )
throws SQLException;
public void setTuple( Object[] newData, String[] colNames );
public void setValue( int col, Object value )
throws MpToolsException;
///////////////////////////////////////////////////////////
public Object toObject( int col );
////////////////////////////////////////////////////////////
// public DbTableInterface createTab(
// Database db, String tableName, ResultSet rs )
// throws SQLException;
public DbTableInterface createTab( String tableName, ResultSet rs )
throws SQLException;
// public XmlTreeNodeable getFormLayout()
// throws XgmException;
// public XmlTreeNodeable getTabLayout()
// throws XgmException;
public String getFormLayoutFilename();
public String getTabLayoutFilename();
////////////////////////////////////////////////////////////
public void setChangedField( int field, boolean changed );
public void setChangedFields( boolean changed );
public boolean hasChanged( int field );
public int getFocusField();
public void setFocusField( int field );
////////////////////////////////////////////////////////////
public int insert()
throws SQLException, MpToolsException, DatabaseException;
public int update()
throws SQLException, MpToolsException, DatabaseException;
public int update( int ... changedFields )
throws SQLException, DatabaseException;
public int update( String ... changedFields )
throws SQLException, DatabaseException;
public int delete()
throws SQLException, MpToolsException, DatabaseException;
public int delete( String where, Object... args )
throws SQLException, MpToolsException, DatabaseException;
public java.util.List<Tuple> select( String where, String order, Object... args )
throws SQLException;
public java.util.List<Tuple> select(
String where, String order, boolean validateMaxRows, Object... args )
throws SQLException, DatabaseException;
// public java.util.List<Tuple> select(
// String where, String order, String[] auxTables, String[][] using,
// boolean validateMaxRows )
// throws SQLException, DatabaseException;
public boolean fetchNext()
throws SQLException, DatabaseException;
public boolean fetchPrev()
throws SQLException, DatabaseException;
public boolean getById()
throws SQLException, DatabaseException;
////////////////////////////////////////////////////////////
public XmlTreeNodeable toXmlTreeNode();
////////////////////////////////////////////////////////////
public void setData( XmlTreeNodeable xtnData )
throws MpToolsException, SQLException;
////////////////////////////////////////////////////////////
public Tuple getPrimaryKeyValue()
throws SQLException;
public void setFromPrimaryKeyValue( Tuple key )
throws SQLException, MpToolsException;
}
|