public MySqlCommand() { this.cmdType = (CommandType)1; this.parameterMap = new ArrayList(); this.parameters = new MySqlParameterCollection(); this.updatedRowSource = (UpdateRowSource)3; }
private IDbCommand GetDbCommandForUpdate(SqlStatement sql, UpdateRowSource updateRowSource) { var c = GetDbCommand(sql); c.UpdatedRowSource = updateRowSource; return(c); }
/// <summary> /// Initializes a command with the given SQL, connection and transaction /// </summary> /// <param name="commandText">The SQL command text</param> /// <param name="connection">The connection to associate with the command</param> /// <param name="transaction">The transaction the command should be associated with</param> public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction) { _commandTimeout = 30; _parameterCollection = new SQLiteParameterCollection(this); _designTimeVisible = true; _updateRowSource = UpdateRowSource.None; if (commandText != null) { CommandText = commandText; } if (connection != null) { DbConnection = connection; _commandTimeout = connection.DefaultTimeout; } if (transaction != null) { Transaction = transaction; } SQLiteConnection.OnChanged(connection, new ConnectionEventArgs( SQLiteConnectionEventType.NewCommand, null, transaction, this, null, null, null, null)); }
public int InsertDataTable(DataTable dt, string sql, UpdateRowSource updateRowSource) { if (string.IsNullOrEmpty(sql)) { throw new ArgumentNullException("sql", "A SQL query or stored procedure name is required"); } if (dt == null) { throw new ArgumentNullException("dt", "DataTable cannot be null."); } DbDataAdapter adapter = null; try { adapter = _dbProviderFactory.CreateDataAdapter(); adapter.InsertCommand = Command; adapter.InsertCommand.CommandText = sql; adapter.InsertCommand.UpdatedRowSource = updateRowSource; return(adapter.Update(dt)); } finally { if (adapter.InsertCommand != null) { adapter.InsertCommand.Dispose(); } adapter.Dispose(); } }
public OleDbCommand() { this._commandTimeout = 30; this._updatedRowSource = UpdateRowSource.Both; this.ObjectID = Interlocked.Increment(ref _objectTypeCount); GC.SuppressFinalize(this); }
public H2Command(string commandText, H2Connection connection, H2Transaction transaction) { this.commandText = commandText; this.connection = connection; this.collection = new H2ParameterCollection(); this.updatedRowSource = UpdateRowSource.None; }
/// <include file='docs/mysqlcommand.xml' path='docs/ctor1/*'/> public MySqlCommand() { cmdType = CommandType.Text; parameterMap = new ArrayList(); parameters = new MySqlParameterCollection(); updatedRowSource = UpdateRowSource.Both; }
/// <include file='Doc/en_EN/FbCommand.xml' path='doc/class[@name="FbCommand"]/constructor[@name="ctor(System.String,FbConnection,Transaction)"]/*'/> public FbCommand(string cmdText, FbConnection connection, FbTransaction transaction) : base() { this.parameters = new FbParameterCollection(); this.namedParameters = new StringCollection(); this.updatedRowSource = UpdateRowSource.Both; this.commandType = CommandType.Text; this.designTimeVisible = true; this.designTimeVisible = true; this.commandTimeout = 30; this.fetchSize = 200; this.commandText = ""; if (connection != null) { this.fetchSize = connection.ConnectionOptions.FetchSize; } if (cmdText != null) { this.CommandText = cmdText; } this.Connection = connection; this.transaction = transaction; }
/// <summary> /// Initializes a command with the given SQL, connection and transaction /// </summary> /// <param name="commandText">The SQL command text</param> /// <param name="connection">The connection to associate with the command</param> /// <param name="transaction">The transaction the command should be associated with</param> public SqliteCommand(string commandText, SqliteConnection connection, SqliteTransaction transaction) { _statementList = null; _activeReader = null; _commandTimeout = 30; _parameterCollection = new SqliteParameterCollection(this); _designTimeVisible = true; _updateRowSource = UpdateRowSource.None; _transaction = null; if (commandText != null) { CommandText = commandText; } if (connection != null) { DbConnection = connection; _commandTimeout = connection.DefaultTimeout; } if (transaction != null) { Transaction = transaction; } }
/// <include file='docs/mysqlcommand.xml' path='docs/ctor1/*'/> public MySqlCommand() { designTimeVisible = true; cmdType = CommandType.Text; parameters = new MySqlParameterCollection(this); updatedRowSource = UpdateRowSource.Both; cmdText = String.Empty; }
public OdbcCommand() { timeout = DEFAULT_COMMAND_TIMEOUT; commandType = CommandType.Text; _parameters = new OdbcParameterCollection(); designTimeVisible = true; updateRowSource = UpdateRowSource.Both; }
protected DbCommandBase (DbCommandBase from) { _commandText = from._commandText; _commandTimeout = from._commandTimeout; _commandType = from._commandType; _updatedRowSource = from._updatedRowSource; _designTimeVisible = from._designTimeVisible; }
protected DbCommandBase() { _commandText = String.Empty; _commandTimeout = 30; _commandType = CommandType.Text; _designTimeVisible = true; _updatedRowSource = UpdateRowSource.Both; }
protected DbCommandBase(DbCommandBase from) { _commandText = from._commandText; _commandTimeout = from._commandTimeout; _commandType = from._commandType; _updatedRowSource = from._updatedRowSource; _designTimeVisible = from._designTimeVisible; }
public OdbcCommand () { timeout = DEFAULT_COMMAND_TIMEOUT; commandType = CommandType.Text; _parameters = new OdbcParameterCollection (); designTimeVisible = true; updateRowSource = UpdateRowSource.Both; }
protected DbCommandBase () { _commandText = String.Empty; _commandTimeout = 30; _commandType = CommandType.Text; _designTimeVisible = true; _updatedRowSource = UpdateRowSource.Both; }
public DbProxyCommand(string cmdText, DbProxyConnection connection) { commandText = cmdText; this.connection = connection; commandType = CommandType.Text; updatedRowSource = UpdateRowSource.Both; parameters = new DbProxyParameterCollection(this); behavior = CommandBehavior.Default; }
public MySqlCommand() { this.designTimeVisible = true; this.cmdType = System.Data.CommandType.Text; this.parameters = new MySqlParameterCollection(this); this.updatedRowSource = UpdateRowSource.Both; this.cursorPageSize = 0; this.cmdText = string.Empty; this.timedOut = false; }
public OleDbCommand () { timeout = DEFAULT_COMMAND_TIMEOUT; commandType = CommandType.Text; parameters = new OleDbParameterCollection (); behavior = CommandBehavior.Default; gdaCommand = IntPtr.Zero; designTimeVisible = true; this.updatedRowSource = UpdateRowSource.Both; }
public void ShouldSetUpdatedRowSourceToInnerCommand() { UpdateRowSource testUpdatedRowSource = fixture.Create <UpdateRowSource>(); Mock <DbCommand> dbCommandMock = new Mock <DbCommand>(); Mock <ISyncPolicy> retryPolicyMock = new Mock <ISyncPolicy>(); var commandWrapper = new ReliableDbCommandWrapper(dbCommandMock.Object, retryPolicyMock.Object); commandWrapper.UpdatedRowSource = testUpdatedRowSource; dbCommandMock.VerifySet(x => x.UpdatedRowSource = testUpdatedRowSource); }
private SQLiteCommand(SQLiteCommand source) : this(source.CommandText, source.Connection, source.Transaction) { this.CommandTimeout = source.CommandTimeout; this.DesignTimeVisible = source.DesignTimeVisible; this.UpdatedRowSource = source.UpdatedRowSource; foreach (SQLiteParameter sQLiteParameter in source._parameterCollection) { this.Parameters.Add(sQLiteParameter.Clone()); } }
public OleDbCommand() { timeout = DEFAULT_COMMAND_TIMEOUT; commandType = CommandType.Text; parameters = new OleDbParameterCollection(); behavior = CommandBehavior.Default; gdaCommand = IntPtr.Zero; designTimeVisible = true; this.updatedRowSource = UpdateRowSource.Both; }
public void ShouldReadUpdatedRowSourceFromInnerCommand() { UpdateRowSource testUpdatedRowSource = fixture.Create <UpdateRowSource>(); Mock <DbCommand> dbCommandMock = new Mock <DbCommand>(); Mock <ISyncPolicy> retryPolicyMock = new Mock <ISyncPolicy>(); dbCommandMock.Setup(x => x.UpdatedRowSource).Returns(testUpdatedRowSource); var commandWrapper = new ReliableDbCommandWrapper(dbCommandMock.Object, retryPolicyMock.Object); Assert.Equal(testUpdatedRowSource, commandWrapper.UpdatedRowSource); }
public SQLiteCommand() { _CommandText = String.Empty; _UpdatedRowSource = UpdateRowSource.Both; _Timeout = 30; _ServingDataReader = false; _Transaction = null; _Parameters = new SQLiteParameterCollection(); _Statements = new SQLiteStatementCollection(); }
/// <include file='docs/mysqlcommand.xml' path='docs/ctor1/*'/> public MySqlCommand() { designTimeVisible = true; cmdType = CommandType.Text; parameters = new MySqlParameterCollection(this); updatedRowSource = UpdateRowSource.Both; cursorPageSize = 0; cmdText = String.Empty; commandTimeout = 30; timedOut = false; }
public TdsCommand(string commandText, TdsConnection connection, TdsTransaction transaction) { this.commandText = commandText; this.connection = connection; this.transaction = transaction; this.commandType = CommandType.Text; this.updatedRowSource = UpdateRowSource.Both; this.designTimeVisible = false; this.commandTimeout = 30; parameters = new TdsParameterCollection(this); }
internal EntityCommand( DbInterceptionContext interceptionContext, EntityCommand.EntityDataReaderFactory factory) { this._designTimeVisible = true; this._commandType = CommandType.Text; this._updatedRowSource = UpdateRowSource.Both; this._parameters = new EntityParameterCollection(); this._interceptionContext = interceptionContext; this._enableQueryPlanCaching = true; this._entityDataReaderFactory = factory ?? new EntityCommand.EntityDataReaderFactory(); }
public virtual void UpdatedRowSource() { using (HsqlConnection connection = NewConnection()) using (HsqlCommand testSubject = connection.CreateCommand()) { UpdateRowSource expected = UpdateRowSource.Both; UpdateRowSource actual = testSubject.UpdatedRowSource; Assert.AreEqual(expected, actual); Assert.Fail("TODO"); } }
public SqlCommand(string cmdText, SqlConnection connection, SqlTransaction transaction) { this.commandText = cmdText; this.connection = connection; this.transaction = transaction; this.commandType = CommandType.Text; this.updatedRowSource = UpdateRowSource.Both; this.commandTimeout = DEFAULT_COMMAND_TIMEOUT; notificationAutoEnlist = true; designTimeVisible = true; parameters = new SqlParameterCollection(this); }
/// <include file='docs/mysqlcommand.xml' path='docs/ctor1/*'/> public MySqlCommand() { designTimeVisible = true; cmdType = CommandType.Text; parameterMap = new ArrayList(); parameters = new MySqlParameterCollection(); updatedRowSource = UpdateRowSource.Both; cursorPageSize = 0; cmdText = String.Empty; commandTimeout = 30; canCancel = false; timedOut = false; querySent = new AutoResetEvent(false); }
internal EntityCommand(EntityDataReaderFactory factory) { // Initalize the member field with proper default values _designTimeVisible = true; _commandType = CommandType.Text; _updatedRowSource = UpdateRowSource.Both; _parameters = new EntityParameterCollection(); // Future Enhancement: (See SQLPT #300004256) At some point it would be // really nice to read defaults from a global configuration, but we're not // doing that today. _enableQueryPlanCaching = true; _entityDataReaderFactory = factory ?? new EntityDataReaderFactory(); }
/// <summary> /// Constructs the EntityCommand object not yet associated to a connection object /// </summary> public EntityCommand() { GC.SuppressFinalize(this); // Initalize the member field with proper default values this._designTimeVisible = true; this._commandType = CommandType.Text; this._updatedRowSource = UpdateRowSource.Both; this._parameters = new EntityParameterCollection(); // Future Enhancement: (See SQLPT #300004256) At some point it would be // really nice to read defaults from a global configuration, but we're not // doing that today. this._enableQueryPlanCaching = true; }
private SqlCommand(string commandText, SqlConnection connection, SqlTransaction transaction, CommandType commandType, UpdateRowSource updatedRowSource, bool designTimeVisible, int commandTimeout, SqlParameterCollection parameters) { this.commandText = commandText; this.connection = connection; this.transaction = transaction; this.commandType = commandType; this.updatedRowSource = updatedRowSource; this.designTimeVisible = designTimeVisible; this.commandTimeout = commandTimeout; this.parameters = new SqlParameterCollection(this); for (int i = 0; i < parameters.Count; i++) { this.parameters.Add(((ICloneable)parameters[i]).Clone()); } }
// IDbCommand.UpdateRowSource internal static ArgumentOutOfRangeException InvalidUpdateRowSource(UpdateRowSource value) { #if DEBUG switch (value) { case UpdateRowSource.None: case UpdateRowSource.OutputParameters: case UpdateRowSource.FirstReturnedRecord: case UpdateRowSource.Both: Debug.Fail("valid UpdateRowSource " + value.ToString()); break; } #endif return(InvalidEnumerationValue(typeof(UpdateRowSource), (int)value)); }
public FbCommand(string cmdText, FbConnection connection, FbTransaction transaction) : base() { this.namedParameters = new List<string>(); this.updatedRowSource = UpdateRowSource.Both; this.commandType = CommandType.Text; this.designTimeVisible = true; this.commandTimeout = 30; this.fetchSize = 200; this.commandText = string.Empty; if (connection != null) { this.fetchSize = connection.ConnectionOptions.FetchSize; } if (cmdText != null) { this.CommandText = cmdText; } this.Connection = connection; this.transaction = transaction; }
public SqlCommand() { this.ObjectID = Interlocked.Increment(ref _objectTypeCount); this._commandTimeout = 30; this._updatedRowSource = UpdateRowSource.Both; this._prepareHandle = -1; this._rowsAffected = -1; this._notificationAutoEnlist = true; GC.SuppressFinalize(this); }
public OracleCommand() { this._objectID = Interlocked.Increment(ref _objectTypeCount); this._updatedRowSource = UpdateRowSource.Both; GC.SuppressFinalize(this); }
internal static ArgumentOutOfRangeException InvalidUpdateRowSource(UpdateRowSource value) { return InvalidEnumerationValue(typeof(UpdateRowSource), (int) value); }
public int UpdateDataset(SqlStatement selectSql, DataSet ds, int updateBatchSize, UpdateRowSource updateRowSource) { int ret = 0; DbEntry.UsingConnection( () => { var c = GetDbCommand(selectSql); c.UpdatedRowSource = updateRowSource; var d = (DbDataAdapter)InnerDriver.GetDbAdapter(c); var cb = InnerDriver.GetCommandBuilder(); cb.QuotePrefix = Dialect.OpenQuote.ToString(); cb.QuoteSuffix = Dialect.CloseQuote.ToString(); cb.DataAdapter = d; d.UpdateBatchSize = updateBatchSize; ret = d.Update(ds); ds.AcceptChanges(); }); return ret; }
private int UpdateDataset(SqlStatement insertSql, SqlStatement updateSql, SqlStatement deleteSql, DataSet ds, int updateBatchSize, UpdateRowSource updateRowSource, bool throwException) { int ret = 0; DbEntry.UsingConnection(delegate { IDbDataAdapter d = InnerDriver.GetDbAdapter(); if(insertSql != null) { d.InsertCommand = GetDbCommandForUpdate(insertSql, updateRowSource); } if(updateSql != null) { d.UpdateCommand = GetDbCommandForUpdate(updateSql, updateRowSource); } if(deleteSql != null) { d.DeleteCommand = GetDbCommandForUpdate(deleteSql, updateRowSource); } var adapter = d as DbDataAdapter; if (adapter != null) { adapter.UpdateBatchSize = updateBatchSize; } else if(throwException) { throw new DataException("The DbDataAdapter doesn't support UpdateBatchSize feature."); } ret = d.Update(ds); ds.AcceptChanges(); }); return ret; }
/// <summary> /// Initializes a command with the given SQL, connection and transaction /// </summary> /// <param name="commandText">The SQL command text</param> /// <param name="connection">The connection to associate with the command</param> /// <param name="transaction">The transaction the command should be associated with</param> public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction) { _statementList = null; _activeReader = null; _commandTimeout = 30; _parameterCollection = new SQLiteParameterCollection(this); _designTimeVisible = true; _updateRowSource = UpdateRowSource.FirstReturnedRecord; _transaction = null; if (commandText != null) CommandText = commandText; if (connection != null) DbConnection = connection; if (transaction != null) Transaction = transaction; }
private SqlCommand(string commandText, SqlConnection connection, SqlTransaction transaction, CommandType commandType, UpdateRowSource updatedRowSource, bool designTimeVisible, int commandTimeout, SqlParameterCollection parameters) { this.commandText = commandText; this.connection = connection; this.transaction = transaction; this.commandType = commandType; this.updatedRowSource = updatedRowSource; this.designTimeVisible = designTimeVisible; this.commandTimeout = commandTimeout; this.parameters = new SqlParameterCollection(this); for (int i = 0;i < parameters.Count;i++) this.parameters.Add(((ICloneable)parameters[i]).Clone()); }
// IDbCommand.UpdateRowSource static internal ArgumentOutOfRangeException InvalidUpdateRowSource(UpdateRowSource value) { #if DEBUG switch (value) { case UpdateRowSource.None: case UpdateRowSource.OutputParameters: case UpdateRowSource.FirstReturnedRecord: case UpdateRowSource.Both: Debug.Assert(false, "valid UpdateRowSource " + value.ToString()); break; } #endif return InvalidEnumerationValue(typeof(UpdateRowSource), (int)value); }
/// <summary> /// Initializes a command with the given SQL, connection and transaction /// </summary> /// <param name="commandText">The SQL command text</param> /// <param name="connection">The connection to associate with the command</param> /// <param name="transaction">The transaction the command should be associated with</param> public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction) { _commandTimeout = 30; _parameterCollection = new SQLiteParameterCollection(this); _designTimeVisible = true; _updateRowSource = UpdateRowSource.None; if (commandText != null) CommandText = commandText; if (connection != null) { DbConnection = connection; _commandTimeout = connection.DefaultTimeout; } if (transaction != null) Transaction = transaction; SQLiteConnection.OnChanged(connection, new ConnectionEventArgs( SQLiteConnectionEventType.NewCommand, null, transaction, this, null, null, null, null)); }
public TdsCommand (string commandText, TdsConnection connection, TdsTransaction transaction) { this.commandText = commandText; this.connection = connection; this.transaction = transaction; this.commandType = CommandType.Text; this.updatedRowSource = UpdateRowSource.Both; this.designTimeVisible = false; this.commandTimeout = 30; parameters = new TdsParameterCollection (this); }
public SqlCommand (string cmdText, SqlConnection connection, SqlTransaction transaction) { this.commandText = cmdText; this.connection = connection; this.transaction = transaction; this.commandType = CommandType.Text; this.updatedRowSource = UpdateRowSource.Both; this.commandTimeout = DEFAULT_COMMAND_TIMEOUT; #if NET_2_0 notificationAutoEnlist = true; #endif designTimeVisible = true; parameters = new SqlParameterCollection (this); }
/// <summary> /// Initializes a command with the given SQL, connection and transaction /// </summary> /// <param name="commandText">The SQL command text</param> /// <param name="connection">The connection to associate with the command</param> /// <param name="transaction">The transaction the command should be associated with</param> public SqliteCommand(string commandText, SqliteConnection connection, SqliteTransaction transaction) { _statementList = null; _activeReader = null; _commandTimeout = 30; _parameterCollection = new SqliteParameterCollection(this); _designTimeVisible = true; _updateRowSource = UpdateRowSource.None; _transaction = null; if (commandText != null) CommandText = commandText; if (connection != null) { DbConnection = connection; _commandTimeout = connection.DefaultTimeout; } if (transaction != null) Transaction = transaction; }
public void DeleteParametersAdd(String parameterName, MySqlDbType dbType, int size, String sourceColumn, UpdateRowSource urs) { _MySql_Delete_Command.Parameters.Add(parameterName, dbType, size, sourceColumn); //_MySql_Delete_Command.UpdatedRowSource = urs; }
private IDbCommand GetDbCommandForUpdate(SqlStatement sql, UpdateRowSource updateRowSource) { var c = GetDbCommand(sql); c.UpdatedRowSource = updateRowSource; return c; }