Esempio n. 1
0
 private void FillParams(params object[] paramValues)
 {
     if (paramValues == null || paramValues.Length <= 0)
     {
         return;
     }
     for (int index = 0; index < this.FParamTypes.Length; ++index)
     {
         IDataParameter parameter  = (IDataParameter)this.FCommand.Parameters[index];
         DataType       fparamType = this.FParamTypes[index];
         object         paramValue = paramValues[index];
         if (paramValue == null || paramValue == DBNull.Value)
         {
             parameter.Value = (object)DBNull.Value;
         }
         else
         {
             object obj = InDbUtils.Convert(paramValues[index], fparamType);
             parameter.Value = obj;
             if (obj != null && (parameter.DbType == DbType.AnsiString || parameter.DbType == DbType.String || parameter.DbType == DbType.Binary))
             {
                 OracleParameter oracleParameter = (OracleParameter)parameter;
                 if (fparamType == DataType.Memo)
                 {
                     oracleParameter.OracleType = OracleType.Clob;
                 }
                 oracleParameter.Size = ((string)obj).Length + 1;
             }
         }
     }
 }
 private void FillParams(params object[] paramValues)
 {
     if (this.FParamTypes == null || paramValues == null || paramValues.Length == 0)
     {
         if (this.FCommand != null)
         {
             return;
         }
         this.RecreateCommand();
     }
     else
     {
         object[] objArray = new object[paramValues.Length];
         for (int index = 0; index < this.FParamTypes.Length; ++index)
         {
             DataType fparamType = this.FParamTypes[index];
             object   paramValue = paramValues[index];
             if (paramValue == null || paramValue == DBNull.Value)
             {
                 objArray[index] = (object)DBNull.Value;
             }
             else
             {
                 object obj = InDbUtils.Convert(paramValue, fparamType);
                 objArray[index] = obj;
                 int fparamMaxSiz = this.FParamMaxSizes[index];
                 if (fparamMaxSiz > 0)
                 {
                     int num = obj is string?((string)obj).Length : ((byte[])obj).Length;
                     if (num > fparamMaxSiz)
                     {
                         if (num > 4000 && num <= 8000)
                         {
                             num = 8001;
                         }
                         this.FParamMaxSizes[index] = num;
                         if (this.FCommand != null)
                         {
                             this.FCommand.Dispose();
                             this.FCommand = (SqlCommand)null;
                         }
                     }
                 }
             }
         }
         if (this.FCommand == null)
         {
             this.RecreateCommand();
         }
         for (int index = 0; index < objArray.Length; ++index)
         {
             this.FCommand.Parameters[index].Value = objArray[index];
         }
     }
 }