/** * 构造函数,构建表的基本信息 * * @param Connection con 由biaoping.yin添加 * @param dbname 表所属的数据库链接池 * @param tableName 表的名称 * @param primaryKeyName 表的主键名称 * @param increment 表主键自增值 * @param curValue 表主键当前值 */ public PrimaryKey( String dbname, String tableName, String primaryKeyName, Object customKey, Connection con) { this.dbname = dbname; dbAdapter = SQLManager.getInstance().getDBAdapter(dbname); this.tableName = tableName; this.primaryKeyName = primaryKeyName; JDBCPool pool = (JDBCPool) (SQLManager.getInstance().getPool(dbname)); synsequece = pool.getJDBCPoolMetadata().synsequence(); this.seqfunction = pool.getJDBCPoolMetadata().getSeqfunction(); try { TableMetaData table = pool.getTableMetaData(con, tableName); if (table != null) { if (primaryKeyName != null) { ColumnMetaData cd = pool.getColumnMetaData(con, tableName, primaryKeyName); int type_ = cd.getDataType(); this.setType_(type_); } else { Set keys = table.getPrimaryKeys(); if (keys != null) { Iterator keyitrs = keys.iterator(); if (keyitrs.hasNext()) { PrimaryKeyMetaData key = (PrimaryKeyMetaData) keyitrs.next(); this.primaryKeyName = key.getColumnName().toLowerCase(); this.setType_(key.getColumn().getDataType()); } } } } } catch (Exception e) { e.printStackTrace(); } String mode = pool.getKeygenerate(); if (mode.trim().equalsIgnoreCase("auto")) keygenerator_mode = 0; else if (mode.trim().equalsIgnoreCase("composite")) keygenerator_mode = 1; this.customKey = customKey; }
public int getResultTableColumnType(String columnName) { return tableMetaData.getColumnType(columnName); }
public String[] getResultTableColumnNames() { return tableMetaData.getColumnNames(); }
public String getResultTableName() { return tableMetaData.getName(); }