Ejemplo n.º 1
0
 private static IDataParameter[] ToSqlParameter(DbBaseProvider dbProvider, SqlParam[] paramList)
 {
     IDataParameter[] list = new IDataParameter[paramList.Length];
     for (int i = 0; i < paramList.Length; i++)
     {
         SqlParam param = paramList[i];
         list[i] = dbProvider.CreateParameter(param.ParamName, param.DbTypeValue, param.Size, param.Value.Value);
     }
     return list;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="parameters"></param>
 /// <returns></returns>
 internal static SqlParam[] ConvertSqlParam(IDataParameter[] parameters)
 {
     SqlParam[] paramList = new SqlParam[parameters.Length];
     for (int i = 0; i < parameters.Length; i++)
     {
         var p = parameters[i];
         int size = 0;
         int dbType = (int)p.DbType;
         if (p is SqlParameter)
         {
             size = ((SqlParameter)p).Size;
             dbType = Convert.ToInt32(((SqlParameter)p).SqlDbType);
         }
         else if (p is MySqlParameter)
         {
             size = ((MySqlParameter)p).Size;
             dbType = Convert.ToInt32(((MySqlParameter)p).MySqlDbType);
         }
         paramList[i] = new SqlParam()
         {
             ParamName = p.ParameterName,
             DbTypeValue = dbType,
             Size = size,
             Value = new ProtoObject(p.Value)
         };
     }
     return paramList;
 }
Ejemplo n.º 3
0
 private string GetParamToString(SqlParam[] list)
 {
     StringBuilder sb = new StringBuilder();
     foreach (var item in list)
     {
         sb.AppendLine(string.Format("    {0}:{1}", item.ParamName, item.Value));
     }
     return sb.ToString();
 }