*/
private boolean initFromDB()
throws SQLException
{
DatabaseMetaData metaData = _session.getSQLConnection().getConnection().getMetaData();
SQLDatabaseMetaData md = _session.getSQLConnection().getSQLMetaData();
Hashtable<String, ConstraintData> dbConstraintInfosByConstraintName = new Hashtable<String, ConstraintData>();
Vector<ColumnInfo> colInfosBuf = new Vector<ColumnInfo>();
if (s_log.isDebugEnabled()) {
s_log.debug("initFromDB: _catalog="+_catalog+" _schema="+_schema+
" _tableName="+_tableName);
}
TableColumnInfo[] infos = md.getColumnInfo(_catalog, _schema, _tableName);
for (int i = 0; i < infos.length; i++) {
TableColumnInfo info = infos[i];
String columnName = info.getColumnName();
String columnType = info.getTypeName();
int columnSize = info.getColumnSize();
int decimalDigits = info.getDecimalDigits();
boolean nullable = "YES".equalsIgnoreCase(info.isNullable());
ColumnInfo colInfo = new ColumnInfo(columnName,
columnType,
columnSize,
decimalDigits,
nullable);
colInfosBuf.add(colInfo);
}
_colInfos = colInfosBuf.toArray(new ColumnInfo[colInfosBuf.size()]);
if(0 == _colInfos.length)
{
// Table was deleted from DB
return false;
}
try {
PrimaryKeyInfo[] pkinfos =
md.getPrimaryKey(_catalog, _schema, _tableName);
for (int i = 0; i < pkinfos.length; i++) {
PrimaryKeyInfo info = pkinfos[i];
for (int c = 0; c < _colInfos.length; c++)
{
if(_colInfos[c].getName().equals(info.getColumnName()))