Пример #1
0
/*
 * Params use native values now, this is unnecessary
 *              public static Alphora.Dataphor.DAE.Runtime.Data.DataValue DataValue(Schema.IDataType AType, object AValue, DAECommand ACommand)
 *              {
 *                      if (AValue == null)
 *                              return null;
 *                      return Alphora.Dataphor.DAE.Runtime.Data.DataValue.FromNative(((DAEConnection)ACommand.Connection).ServerProcess, AType, AValue);
 *              }
 */

        internal string Prepare(string commandText, DAECommand command)
        {
            if (commandText.IndexOf(ParameterName) > -1)
            {
                DataParam runtimeParam = null;
                if (command.DAERuntimeParams.IndexOf(ParameterName) < 0)
                {
                    if ((Direction == ParameterDirection.Output) || (Direction == ParameterDirection.ReturnValue))
                    {
                        runtimeParam = new DataParam(ParameterName, DataTypeFromDAEDbType(_type, (DAEConnection)command.Connection), Modifier(Direction));
                    }
                    else
                    {
                        runtimeParam = new DataParam(ParameterName, DataTypeFromDAEDbType(_type, (DAEConnection)command.Connection), Modifier(Direction), _value);
                    }
                    command.DAERuntimeParams.Add(runtimeParam);
                }
                else
                {
                    runtimeParam = command.DAERuntimeParams[ParameterName];
                    if ((Direction != ParameterDirection.Output) && (Direction != ParameterDirection.ReturnValue))
                    {
                        runtimeParam.Value = _value;
                    }
                }
            }
            return(commandText);
        }
Пример #2
0
        protected internal DAEDataReader(IServerCursor cursor, DAECommand command)
        {
            _cursor  = cursor;
            _command = command;

            // Cache native types
            _nativeTypes = new ArrayList();
            foreach (TableVarColumn column in _cursor.Plan.TableVar.Columns)
            {
                _nativeTypes.Add(GetNativeType(column.DataType, column, _cursor.Plan.Process.DataTypes));
            }
        }
Пример #3
0
        public virtual object Clone()
        {
            DAECommand newInstance = new DAECommand();

            newInstance.CommandText      = _commandText;
            newInstance.CommandType      = _commandType;
            newInstance.UpdatedRowSource = _updatedRowSource;
            foreach (DAEParameter param in _parameters)
            {
                newInstance.Parameters.Add(param.Clone());
            }
            newInstance.Connection     = _connection;
            newInstance.Transaction    = _transaction;
            newInstance.CommandTimeout = _commandTimeout;
            return(newInstance);
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the DAEDataAdapter class with the
 /// specified D4 select statement.
 /// </summary>
 /// <param name="selectCommand">D4 select statement.</param>
 public DAEDataAdapter(DAECommand selectCommand)
 {
     SelectCommand = selectCommand;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the DAEDataAdapter class with an D4 select statement and a DAEConnection object.
 /// </summary>
 /// <param name="selectCommandText">D4 select statement.</param>
 /// <param name="connection">The DAE connection</param>
 public DAEDataAdapter(string selectCommandText, DAEConnection connection)
 {
     SelectCommand = new DAECommand(selectCommandText, connection);
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the DAEDataAdapter class with an D4 select statement and a connection string.
 /// </summary>
 /// <param name="selectCommandText">D4 select statement.</param>
 /// <param name="selectConnectionString"></param>
 public DAEDataAdapter(string selectCommandText, string selectConnectionString)
 {
     SelectCommand = new DAECommand(selectCommandText, new DAEConnection(selectConnectionString));
 }
Пример #7
0
 /// <summary>
 /// A special reader that returns 1 for records affected.
 /// When records affected is required for an execute statement.
 /// </summary>
 /// <param name="command"></param>
 protected internal DAEDataReader(DAECommand command)
 {
     _command     = command;
     _rowCount    = 1;          //Records effected is always one when the reader is in a non-cursor.
     _nativeTypes = new ArrayList();
 }
Пример #8
0
 public DAEParameterCollection(DAECommand command) : base()
 {
     _command = command;
     _items   = new List <DAEParameter>();
 }