Пример #1
0
 /// <summary>
 /// 获取 <see cref="ProcedureParameter"/> 元数据序列。
 /// </summary>
 /// <param name="table">架构信息的表。</param>
 /// <param name="action">用于填充元数据的方法。</param>
 /// <returns></returns>
 protected override IEnumerable <ProcedureParameter> GetProcedureParameters(DataTable table, Action <ProcedureParameter, DataRow> action)
 {
     foreach (DataRow row in table.Rows)
     {
         var item = new ProcedureParameter
         {
             Schema           = row["OWNER"].ToString(),
             ProcedureName    = row["OBJECT_NAME"].ToString(),
             Name             = row["ARGUMENT_NAME"].ToString(),
             DataType         = row["DATA_TYPE"].ToString(),
             Direction        = GetDirection(row["IN_OUT"].ToString()),
             NumericPrecision = row["DATA_PRECISION"].To <int>(),
             NumericScale     = row["DATA_SCALE"].To <int>(),
             Length           = row["DATA_LENGTH"].To <int>(),
         };
         if (action != null)
         {
             action(item, row);
         }
         yield return(item);
     }
 }
Пример #2
0
 /// <summary>
 /// 获取 <see cref="ProcedureParameter"/> 元数据序列。
 /// </summary>
 /// <param name="table">架构信息的表。</param>
 /// <param name="action">用于填充元数据的方法。</param>
 /// <returns></returns>
 protected virtual IEnumerable <ProcedureParameter> GetProcedureParameters(DataTable table, Action <ProcedureParameter, DataRow> action)
 {
     foreach (DataRow row in table.Rows)
     {
         var item = new ProcedureParameter
         {
             Catalog          = row["SPECIFIC_CATALOG"].ToString(),
             Schema           = row["SPECIFIC_SCHEMA"].ToString(),
             ProcedureName    = row["SPECIFIC_NAME"].ToString(),
             Direction        = row["PARAMETER_MODE"].ToString() == "OUT" ? ParameterDirection.Output : ParameterDirection.Input,
             Name             = row["PARAMETER_NAME"].ToString(),
             DataType         = row["DATA_TYPE"].ToString(),
             Length           = row["CHARACTER_MAXIMUM_LENGTH"].To <long>(),
             NumericScale     = row["NUMERIC_SCALE"].To <int>(),
             NumericPrecision = row["NUMERIC_PRECISION"].To <int>(),
         };
         if (action != null)
         {
             action(item, row);
         }
         yield return(item);
     }
 }