Esempio n. 1
0
        public object Clone()
        {
            // create a new OracleCommand object with the same properties

            OracleCommand cmd = new OracleCommand();

            cmd.CommandText = this.CommandText;
            cmd.CommandType = this.CommandType;

            // FIXME: not sure if I should set the same object here
            // or get a clone of these too
            cmd.Connection  = this.Connection;
            cmd.Transaction = this.Transaction;

            foreach (OracleParameter parm in this.Parameters)
            {
                OracleParameter newParm = cmd.CreateParameter();

                newParm.DbType        = parm.DbType;
                newParm.Direction     = parm.Direction;
                newParm.IsNullable    = parm.IsNullable;
                newParm.Offset        = parm.Offset;
                newParm.OracleType    = parm.OracleType;
                newParm.ParameterName = parm.ParameterName;
                //newParm.Precision = parm.Precision;
                //newParm.Scale = parm.Scale;
                newParm.SourceColumn  = parm.SourceColumn;
                newParm.SourceVersion = parm.SourceVersion;
                newParm.Value         = parm.Value;

                cmd.Parameters.Add(newParm);
            }

            //cmd.Container = this.Container;
            cmd.DesignTimeVisible = this.DesignTimeVisible;
            //cmd.DesignMode = this.DesignMode;
            cmd.Site = this.Site;
            //cmd.UpdateRowSource = this.UpdateRowSource;

            return(cmd);
        }
 public void Append(OracleCommand command)
 {
     System.Data.Common.ADP.CheckArgumentNull(command, "command");
     if (System.Data.Common.ADP.IsEmpty(command.CommandText))
     {
         throw System.Data.Common.ADP.CommandTextRequired("Append");
     }
     ICollection parameters = command.Parameters;
     OracleParameter[] array = new OracleParameter[parameters.Count];
     parameters.CopyTo(array, 0);
     string[] parameterNames = new string[array.Length];
     if (0 < array.Length)
     {
         for (int i = 0; i < array.Length; i++)
         {
             parameterNames[i] = array[i].ParameterName;
             OracleParameter destination = command.CreateParameter();
             array[i].CopyTo(destination);
             object obj2 = destination.Value;
             if (obj2 is byte[])
             {
                 byte[] src = (byte[]) obj2;
                 int offset = destination.Offset;
                 int size = destination.Size;
                 int num4 = src.Length - offset;
                 if ((size != 0) && (size < num4))
                 {
                     num4 = size;
                 }
                 byte[] dst = new byte[Math.Max(num4, 0)];
                 Buffer.BlockCopy(src, offset, dst, 0, dst.Length);
                 destination.Offset = 0;
                 destination.Value = dst;
             }
             else if (obj2 is char[])
             {
                 char[] chArray2 = (char[]) obj2;
                 int srcOffset = destination.Offset;
                 int num3 = destination.Size;
                 int num2 = chArray2.Length - srcOffset;
                 if ((num3 != 0) && (num3 < num2))
                 {
                     num2 = num3;
                 }
                 char[] chArray = new char[Math.Max(num2, 0)];
                 Buffer.BlockCopy(chArray2, srcOffset, chArray, 0, chArray.Length * 2);
                 destination.Offset = 0;
                 destination.Value = chArray;
             }
             else if (obj2 is ICloneable)
             {
                 destination.Value = ((ICloneable) obj2).Clone();
             }
             array[i] = destination;
         }
     }
     string statementText = command.StatementText;
     bool isQuery = false;
     LocalParameter[] parameterInsertionPoints = this.ParseText(command, statementText, out isQuery);
     LocalCommand command2 = new LocalCommand(statementText, isQuery, array, parameterNames, parameterInsertionPoints);
     this._dirty = true;
     this.CommandList.Add(command2);
 }
        public void Append(OracleCommand command)
        {
            System.Data.Common.ADP.CheckArgumentNull(command, "command");
            if (System.Data.Common.ADP.IsEmpty(command.CommandText))
            {
                throw System.Data.Common.ADP.CommandTextRequired("Append");
            }
            ICollection parameters = command.Parameters;

            OracleParameter[] array = new OracleParameter[parameters.Count];
            parameters.CopyTo(array, 0);
            string[] parameterNames = new string[array.Length];
            if (0 < array.Length)
            {
                for (int i = 0; i < array.Length; i++)
                {
                    parameterNames[i] = array[i].ParameterName;
                    OracleParameter destination = command.CreateParameter();
                    array[i].CopyTo(destination);
                    object obj2 = destination.Value;
                    if (obj2 is byte[])
                    {
                        byte[] src    = (byte[])obj2;
                        int    offset = destination.Offset;
                        int    size   = destination.Size;
                        int    num4   = src.Length - offset;
                        if ((size != 0) && (size < num4))
                        {
                            num4 = size;
                        }
                        byte[] dst = new byte[Math.Max(num4, 0)];
                        Buffer.BlockCopy(src, offset, dst, 0, dst.Length);
                        destination.Offset = 0;
                        destination.Value  = dst;
                    }
                    else if (obj2 is char[])
                    {
                        char[] chArray2  = (char[])obj2;
                        int    srcOffset = destination.Offset;
                        int    num3      = destination.Size;
                        int    num2      = chArray2.Length - srcOffset;
                        if ((num3 != 0) && (num3 < num2))
                        {
                            num2 = num3;
                        }
                        char[] chArray = new char[Math.Max(num2, 0)];
                        Buffer.BlockCopy(chArray2, srcOffset, chArray, 0, chArray.Length * 2);
                        destination.Offset = 0;
                        destination.Value  = chArray;
                    }
                    else if (obj2 is ICloneable)
                    {
                        destination.Value = ((ICloneable)obj2).Clone();
                    }
                    array[i] = destination;
                }
            }
            string statementText = command.StatementText;
            bool   isQuery       = false;

            LocalParameter[] parameterInsertionPoints = this.ParseText(command, statementText, out isQuery);
            LocalCommand     command2 = new LocalCommand(statementText, isQuery, array, parameterNames, parameterInsertionPoints);

            this._dirty = true;
            this.CommandList.Add(command2);
        }
Esempio n. 4
0
		public object Clone ()
		{
			// create a new OracleCommand object with the same properties

			OracleCommand cmd = new OracleCommand ();

			cmd.CommandText = this.CommandText;
			cmd.CommandType = this.CommandType;

			// FIXME: not sure if I should set the same object here
			// or get a clone of these too
			cmd.Connection = this.Connection;
			cmd.Transaction = this.Transaction;

			foreach (OracleParameter parm in this.Parameters) {

				OracleParameter newParm = cmd.CreateParameter ();

				newParm.DbType = parm.DbType;
				newParm.Direction = parm.Direction;
				newParm.IsNullable = parm.IsNullable;
				newParm.Offset = parm.Offset;
				newParm.OracleType = parm.OracleType;
				newParm.ParameterName = parm.ParameterName;
				//newParm.Precision = parm.Precision;
				//newParm.Scale = parm.Scale;
				newParm.SourceColumn = parm.SourceColumn;
				newParm.SourceVersion = parm.SourceVersion;
				newParm.Value = parm.Value;

				cmd.Parameters.Add (newParm);
			}

			//cmd.Container = this.Container;
			cmd.DesignTimeVisible = this.DesignTimeVisible;
			//cmd.DesignMode = this.DesignMode;
			cmd.Site = this.Site;
			//cmd.UpdateRowSource = this.UpdateRowSource;

			return cmd;
		}
Esempio n. 5
0
 protected override DbParameter CreateDbParameter()
 {
     return(new OracleDBParameter(cmd.CreateParameter()));
 }
Esempio n. 6
0
 public int BackIsSelect(string strSql, Hashtable ht)
 {
     int num;
     try
     {
         OracleCommand command = new OracleCommand {
             CommandText = strSql,
             Connection = this.con
         };
         OracleParameter parameter = null;
         if (this.st != null)
         {
             command.Transaction = this.st;
         }
         if (ht != null)
         {
             foreach (DictionaryEntry entry in ht)
             {
                 parameter = command.CreateParameter();
                 parameter.ParameterName = entry.Key.ToString();
                 parameter.Value = entry.Value.ToString();
                 command.Parameters.Add(parameter);
             }
         }
         num = int.Parse(command.ExecuteScalar().ToString());
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return num;
 }
Esempio n. 7
0
 public string SelectString(string strSql, Hashtable ht)
 {
     string str;
     try
     {
         OracleCommand command = new OracleCommand {
             CommandText = strSql,
             Connection = this.con
         };
         OracleParameter parameter = null;
         if (this.st != null)
         {
             command.Transaction = this.st;
         }
         if (ht != null)
         {
             foreach (DictionaryEntry entry in ht)
             {
                 parameter = command.CreateParameter();
                 parameter.ParameterName = entry.Key.ToString();
                 parameter.Value = entry.Value.ToString();
                 command.Parameters.Add(parameter);
             }
         }
         string str2 = "";
         object obj2 = command.ExecuteScalar();
         if (obj2 != null)
         {
             str2 = obj2.ToString();
         }
         str = str2;
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return str;
 }