Oracle 中GetDataDictionary()
/// <summary>
/// 根据schema和region得到相应的数据字典
/// </summary>
/// <returns></returns>
public DataSet GetDataDictionary(string schema,string datasource)
{
DatabaseManager dbMgr = GetDatabaseManager(datasource);
PreparedStatement sql = new PreparedStatement();
//string schema = GetSchema();
string name = GetName();
if (!String.IsNullOrEmpty(schema))
{
sql.SqlText = "select lower(column_name) name, data_type type, nullable,data_scale scale from all_tab_columns where table_name =:table_name and owner= :schema order by column_id";
sql.Parameters.Add(new Parameter(":table_name", name.ToUpper(), DbType.AnsiStringFixedLength));
sql.Parameters.Add(new Parameter(":schema", schema.ToUpper(), DbType.AnsiStringFixedLength));
}
else
{
sql.SqlText = "select lower(column_name) name, data_type type, nullable,data_scale scale from user_tab_columns where table_name = :tablename order by column_id";
sql.Parameters.Add(new Parameter(":tablename", name.ToUpper(), DbType.AnsiStringFixedLength));
}
DataSet ds = dbMgr.GetDataSet(sql);
return ds;
}
/// 根据schema和region得到相应的数据字典
/// </summary>
/// <returns></returns>
public DataSet GetDataDictionary(string schema,string datasource)
{
DatabaseManager dbMgr = GetDatabaseManager(datasource);
PreparedStatement sql = new PreparedStatement();
//string schema = GetSchema();
string name = GetName();
if (!String.IsNullOrEmpty(schema))
{
sql.SqlText = "select lower(column_name) name, data_type type, nullable,data_scale scale from all_tab_columns where table_name =:table_name and owner= :schema order by column_id";
sql.Parameters.Add(new Parameter(":table_name", name.ToUpper(), DbType.AnsiStringFixedLength));
sql.Parameters.Add(new Parameter(":schema", schema.ToUpper(), DbType.AnsiStringFixedLength));
}
else
{
sql.SqlText = "select lower(column_name) name, data_type type, nullable,data_scale scale from user_tab_columns where table_name = :tablename order by column_id";
sql.Parameters.Add(new Parameter(":tablename", name.ToUpper(), DbType.AnsiStringFixedLength));
}
DataSet ds = dbMgr.GetDataSet(sql);
return ds;
}