protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "CreateRowUpdatedEvent"); return new NpgsqlRowUpdatedEventArgs(dataRow, command, statementType, tableMapping); }
private bool TryGetSimpleCaseStatementType(SwitchCase theCase, out StatementType statementType, out string gotoLabel) { gotoLabel = null; statementType = StatementType.None; if (theCase.Body.Statements.Count != 1 || !string.IsNullOrEmpty(theCase.Body.Statements[0].Label)) { return false; } Statement statement = theCase.Body.Statements[0]; if (statement is GotoStatement) { statementType = StatementType.Goto; gotoLabel = (statement as GotoStatement).TargetLabel; } else if (statement is BreakStatement) { statementType = StatementType.Break; } else if (statement is ContinueStatement) { statementType = StatementType.Continue; } return statementType != StatementType.None; }
/// <summary> /// Initializes a new instance of the <see cref="TaxRequest"/> class. /// </summary> /// <param name="docType"> /// The doc Type. This determines if the quotation should be recorded or if it is just an estimate. /// Defaults to an estimate. /// </param> public TaxRequest(StatementType docType = StatementType.SalesOrder) { DocDate = DateTime.Today.ToString("yyyy-M-dddd"); DetailLevel = DetailLevel.Tax; Commit = false; DocType = docType; }
/// <summary> /// Initializes a new instance of the Statement class. /// </summary> /// <param name="proxy">Proxy object for the statement.</param> /// <param name="type">The type of the statement.</param> internal Statement(CodeUnitProxy proxy, StatementType type) : base(proxy, (int)type) { Param.AssertNotNull(proxy, "proxy"); Param.Ignore(type); CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(StatementType), this.StatementType), "The type is invalid."); }
/// <summary> /// Resets content of this request. /// Used for pooling. /// </summary> public void Clear() { DbStatementType = 0; EntityName = null; FieldNames = null; InputItemsCount = 0; }
public Command(string identifier, string value, StatementType statementType, MetaData<IMeta> metaData, bool rcon) : base(statementType, metaData) { Identifier = identifier; Value = value; RCON = rcon; }
public Statement(string text, StatementType type, ResultType result, IDictionary<string, object> parameters) { Type = type; Text = text; Result = result; Parameters = parameters ?? new Dictionary<string, object>(); }
protected override void ApplyParameterInfo(DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause) { SqlParameter parameter2 = (SqlParameter) parameter; object obj3 = datarow[SchemaTableColumn.ProviderType]; parameter2.SqlDbType = (SqlDbType) obj3; parameter2.Offset = 0; if ((parameter2.SqlDbType == SqlDbType.Udt) && !parameter2.SourceColumnNullMapping) { parameter2.UdtTypeName = datarow["DataTypeName"] as string; } else { parameter2.UdtTypeName = string.Empty; } object obj2 = datarow[SchemaTableColumn.NumericPrecision]; if (DBNull.Value != obj2) { byte num2 = (byte) ((short) obj2); parameter2.PrecisionInternal = (0xff != num2) ? num2 : ((byte) 0); } obj2 = datarow[SchemaTableColumn.NumericScale]; if (DBNull.Value != obj2) { byte num = (byte) ((short) obj2); parameter2.ScaleInternal = (0xff != num) ? num : ((byte) 0); } }
public void CreateStatement_ExpectValid() { //Arrange string localStatementIdString = "STMT01"; StatementId localStatementId = new StatementId(localStatementIdString); SpecificFieldsFactory localfactory = new SpecificFieldsFactory(); string[] listspecificfields = { "Credit Card", "12" }; StatementType localStatementType = new StatementType(localfactory, "CreditCardProvider", listspecificfields); StatementSpecificFields localspecificfields = localStatementType.getSpecificFields(); int localstatementAccountnumber = 1234567; string localstatementAccountholdername = "Bruce"; DateTime localstatementDate = DateTime.Now; StatementCommonFields localStatementCommonFields = new StatementCommonFields(localstatementAccountnumber, localstatementAccountholdername, localstatementDate); APSUser localAPSUser = new APSUser(new APSUserId("1"), "testusername", "testpassword"); BillingAccount localBillingAccount = new BillingAccount(new BillingAccountId("1"), new BillingCompanyId("1"), "testusername", "testpassword", localAPSUser); //Act Statement localStatement = new Statement(localStatementId, localStatementCommonFields, localStatementType, localspecificfields, localAPSUser, localBillingAccount); //Assert Assert.AreEqual(localStatement.StatementId, localStatementId); Assert.AreEqual(localStatement.StatementCommonFields, localStatementCommonFields); Assert.AreEqual(localStatement.StatementType, localStatementType); Assert.AreEqual(localStatement.StatementSpecificFields, localspecificfields); Assert.AreEqual(localStatement.APSUser, localAPSUser); Assert.AreEqual(localStatement.BillingAccount, localBillingAccount); }
RowUpdatedEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { this.dataRow = dataRow; this.command = command; this.statementType = statementType; this.tableMapping = tableMapping; this.status = UpdateStatus.Continue; }
protected override RowUpdatingEventArgs CreateRowUpdatingEvent( DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { return null; }
public FbRowUpdatedEventArgs( DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) : base(row, command, statementType, tableMapping) { }
protected override RowUpdatedEventArgs CreateRowUpdatedEvent( DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { return new NpgsqlRowUpdatedEventArgs(dataRow, command, statementType, tableMapping); }
protected RowUpdatedEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { this.dataRow = dataRow; this.command = command; this.statementType = statementType; this.tableMapping = tableMapping; this.errors = null; this.status = UpdateStatus.Continue; this.recordsAffected = 0; // FIXME }
public void CreateStatementSpecificFields_ExpectValid() { //Arrange SpecificFieldsFactory localfactory = new SpecificFieldsFactory(); string[] listspecificfields = { "You will need to pay by the 25th on the month", "1000" }; StatementType localStatementType = new StatementType(localfactory, "Municipality", listspecificfields); StatementSpecificFields localspecificfields = localStatementType.getSpecificFields(); //Assert Assert.IsNotNull(localspecificfields); }
protected override void ApplyParameterInfo (DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause) { OleDbParameter p = (OleDbParameter) parameter; p.Size = int.Parse (datarow ["ColumnSize"].ToString ()); if (datarow ["NumericPrecision"] != DBNull.Value) { p.Precision = byte.Parse (datarow ["NumericPrecision"].ToString ()); } if (datarow ["NumericScale"] != DBNull.Value) { p.Scale = byte.Parse (datarow ["NumericScale"].ToString ()); } p.DbType = (DbType) datarow ["ProviderType"]; }
public RowUpdatedEventArgs(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { switch(statementType) { case StatementType.Select: case StatementType.Insert: case StatementType.Update: case StatementType.Delete: case StatementType.Batch: break; default: throw ADP.InvalidStatementType(statementType); } _dataRow = dataRow; _command = command; _statementType = statementType; _tableMapping = tableMapping; }
override protected void ApplyParameterInfo(DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause) { OdbcParameter p = (OdbcParameter) parameter; object valueType = datarow[SchemaTableColumn.ProviderType]; p.OdbcType = (OdbcType) valueType; object bvalue = datarow[SchemaTableColumn.NumericPrecision]; if (DBNull.Value != bvalue) { byte bval = (byte)(short)bvalue; p.PrecisionInternal = ((0xff != bval) ? bval : (byte)0); } bvalue = datarow[SchemaTableColumn.NumericScale]; if (DBNull.Value != bvalue) { byte bval = (byte)(short)bvalue; p.ScaleInternal = ((0xff != bval) ? bval : (byte)0); } }
protected override void ApplyParameterInfo(DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause) { OdbcParameter parameter2 = (OdbcParameter) parameter; object obj3 = datarow[SchemaTableColumn.ProviderType]; parameter2.OdbcType = (OdbcType) obj3; object obj2 = datarow[SchemaTableColumn.NumericPrecision]; if (DBNull.Value != obj2) { byte num2 = (byte) ((short) obj2); parameter2.PrecisionInternal = (0xff != num2) ? num2 : ((byte) 0); } obj2 = datarow[SchemaTableColumn.NumericScale]; if (DBNull.Value != obj2) { byte num = (byte) ((short) obj2); parameter2.ScaleInternal = (0xff != num) ? num : ((byte) 0); } }
private UpdateStatus _status; // UpdateStatus.Continue; /*0*/ public RowUpdatingEventArgs(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { ADP.CheckArgumentNull(dataRow, "dataRow"); ADP.CheckArgumentNull(tableMapping, "tableMapping"); switch(statementType) { case StatementType.Select: case StatementType.Insert: case StatementType.Update: case StatementType.Delete: break; case StatementType.Batch: throw ADP.NotSupportedStatementType(statementType, "RowUpdatingEventArgs"); default: throw ADP.InvalidStatementType(statementType); } _dataRow = dataRow; _command = command; // maybe null _statementType = statementType; _tableMapping = tableMapping; }
public Statement(string encoded) { var split = encoded.Split(':'); var enumint = int.Parse(split[0]); statementType = (StatementType)enumint; var split1 = split[1].Split(','); if (split1 != null && split1.Length > 0) { startingTokens = new GenericType[split1.Length]; for (int i = 0; i < split1.Length; i++) { enumint = int.Parse(split1[i]); startingTokens[i] = (GenericType)enumint; } } else { enumint = int.Parse(split[1]); startingTokens = new GenericType[1]; startingTokens[0] = (GenericType)enumint; } var preTokenIds = split[2].Split(','); if (preTokenIds != null && preTokenIds.Length > 1) followUpTokens = SetTokens(preTokenIds); else { enumint = int.Parse(split[2]); if (enumint != -1) { followUpTokens = new GenericType[1]; followUpTokens[0] = (GenericType)enumint; } } requiresClosure = bool.Parse(split[3]); var expressions = split[4].Split(','); if (expressions != null && expressions.Length > 0) { canHaveExpression = true; this.expressions = SetExpression(expressions); } }
/////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Minimal amount of parameter processing. Primarily sets the DbType for the parameter equal to the provider type in the schema /// </summary> /// <param name="parameter">The parameter to use in applying custom behaviors to a row</param> /// <param name="row">The row to apply the parameter to</param> /// <param name="statementType">The type of statement</param> /// <param name="whereClause">Whether the application of the parameter is part of a WHERE clause</param> protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause) { SQLiteParameter param = (SQLiteParameter)parameter; param.DbType = (DbType)row[SchemaTableColumn.ProviderType]; }
protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause) { parameter.DbType = (DbType)row["DbType"]; }
protected AddStatement(StatementType statementType) : base(CodeElementType.AddStatement, statementType) { }
protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { throw new NotSupportedException(); }
public Statement(string text, StatementType type, IDictionary <string, object> parameters) : this(text, type, ResultType.None, parameters) { }
protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause) { var param = (DeveelDbParameter)parameter; param.SqlType = (SqlTypeCode)((int)row[SchemaTableColumn.ProviderType]); var size = (int?)row[SchemaTableColumn.ColumnSize]; var scale = (int?)row[SchemaTableColumn.NumericScale]; var nullable = (bool?)row[SchemaTableColumn.AllowDBNull]; if (size != null) { param.Size = size.Value; } if (scale != null) { param.Scale = (byte)scale.Value; } if (nullable != null) { param.IsNullable = nullable.Value; } // TODO: apply any other setups? }
//never used //private string QualifiedTableName(string schema, string tableName) //{ // if (schema == null || schema.Length == 0) // { // return tableName; // } // else // { // return schema + "." + tableName; // } //} /* private static void SetParameterValuesFromRow(NpgsqlCommand command, DataRow row) { foreach (NpgsqlParameter parameter in command.Parameters) { parameter.Value = row[parameter.SourceColumn, parameter.SourceVersion]; } } */ protected override void ApplyParameterInfo(DbParameter p, DataRow row, StatementType statementType, bool whereClause) { NpgsqlParameter parameter = (NpgsqlParameter) p; /* TODO: Check if this is the right thing to do. * ADO.Net seems to set this property to true when creating the parameter for the following query: * ((@IsNull_FieldName = 1 AND FieldName IS NULL) OR (FieldName = @Original_FieldName)) * This parameter: @IsNull_FieldName was having its sourcecolumn set to the same name of FieldName. * This was causing ADO.Net to try to set a value of different type of Int32. * See bug 1010973 for more info. */ if (parameter.SourceColumnNullMapping) { parameter.SourceColumn = ""; } else parameter.NpgsqlDbType = NpgsqlTypesHelper.GetNativeTypeInfo((Type)row[SchemaTableColumn.DataType]).NpgsqlDbType; }
protected abstract void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause);
protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand?command, StatementType statementType, DataTableMapping tableMapping) { return(new OleDbRowUpdatedEventArgs(dataRow, command, statementType, tableMapping)); }
/// <summary> /// Review .NET Framework documentation. /// </summary> protected override int Update(DataRow[] dataRows, DataTableMapping tableMapping) { int updated = 0; IDbCommand command = null; StatementType statementType = StatementType.Insert; ICollection <IDbConnection> connections = new List <IDbConnection>(); RowUpdatingEventArgs updatingArgs = null; Exception updateException = null; foreach (DataRow row in dataRows) { updateException = null; if (row.RowState == DataRowState.Detached || row.RowState == DataRowState.Unchanged) { continue; } switch (row.RowState) { case DataRowState.Unchanged: case DataRowState.Detached: continue; case DataRowState.Added: command = this.InsertCommand; statementType = StatementType.Insert; break; case DataRowState.Modified: command = this.UpdateCommand; statementType = StatementType.Update; break; case DataRowState.Deleted: command = this.DeleteCommand; statementType = StatementType.Delete; break; } /* The order of execution can be reviewed in the .NET 1.1 documentation * * 1. The values in the DataRow are moved to the parameter values. * 2. The OnRowUpdating event is raised. * 3. The command executes. * 4. If the command is set to FirstReturnedRecord, then the first returned result is placed in the DataRow. * 5. If there are output parameters, they are placed in the DataRow. * 6. The OnRowUpdated event is raised. * 7 AcceptChanges is called. */ try { updatingArgs = this.CreateRowUpdatingEvent(row, command, statementType, tableMapping); /* 1. Update Parameter values (It's very similar to what we * are doing in the FbCommandBuilder class). * * Only input parameters should be updated. */ if (command != null && command.Parameters.Count > 0) { try { this.UpdateParameterValues(command, statementType, row, tableMapping); } catch (Exception ex) { updatingArgs.Errors = ex; updatingArgs.Status = UpdateStatus.ErrorsOccurred; } } // 2. Raise RowUpdating event this.OnRowUpdating(updatingArgs); if (updatingArgs.Status == UpdateStatus.SkipAllRemainingRows) { break; } else if (updatingArgs.Status == UpdateStatus.ErrorsOccurred) { if (updatingArgs.Errors == null) { throw new InvalidOperationException("RowUpdatingEvent: Errors occurred; no additional information is available."); } throw updatingArgs.Errors; } else if (updatingArgs.Status == UpdateStatus.SkipCurrentRow) { updated++; continue; } else if (updatingArgs.Status == UpdateStatus.Continue) { if (command != updatingArgs.Command) { command = updatingArgs.Command; } if (command == null) { /* Samples of exceptions thrown by DbDataAdapter class * * Update requires a valid InsertCommand when passed DataRow collection with new rows * Update requires a valid UpdateCommand when passed DataRow collection with modified rows. * Update requires a valid DeleteCommand when passed DataRow collection with deleted rows. */ throw new InvalidOperationException(this.CreateExceptionMessage(statementType)); } // 3. Execute the command if (command.Connection.State == ConnectionState.Closed) { command.Connection.Open(); // Track command connection connections.Add(command.Connection); } int rowsAffected = command.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DBConcurrencyException(new DBConcurrencyException().Message, null, new DataRow[] { row }); } updated++; // http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=933212&SiteID=1 if (statementType == StatementType.Insert) { row.AcceptChanges(); } /* 4. If the command is set to FirstReturnedRecord, then the * first returned result is placed in the DataRow. * * We have nothing to do in this case as there are no * support for batch commands. */ /* 5. Check if we have output parameters and they should * be updated. * * Only output parameters should be updated */ if (command.UpdatedRowSource == UpdateRowSource.OutputParameters || command.UpdatedRowSource == UpdateRowSource.Both) { // Process output parameters foreach (IDataParameter parameter in command.Parameters) { if ((parameter.Direction == ParameterDirection.Output || parameter.Direction == ParameterDirection.ReturnValue || parameter.Direction == ParameterDirection.InputOutput) && !String.IsNullOrEmpty(parameter.SourceColumn)) { DataColumn column = null; DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction( parameter.SourceColumn, this.MissingMappingAction); if (columnMapping != null) { column = columnMapping.GetDataColumnBySchemaAction( row.Table, null, this.MissingSchemaAction); if (column != null) { row[column] = parameter.Value; } } } } } } } catch (Exception ex) { row.RowError = ex.Message; updateException = ex; } if (updatingArgs != null && updatingArgs.Status == UpdateStatus.Continue) { // 6. Raise RowUpdated event RowUpdatedEventArgs updatedArgs = this.CreateRowUpdatedEvent(row, command, statementType, tableMapping); this.OnRowUpdated(updatedArgs); if (updatedArgs.Status == UpdateStatus.SkipAllRemainingRows) { break; } else if (updatedArgs.Status == UpdateStatus.ErrorsOccurred) { if (updatingArgs.Errors == null) { throw new InvalidOperationException("RowUpdatedEvent: Errors occurred; no additional information available."); } throw updatedArgs.Errors; } else if (updatedArgs.Status == UpdateStatus.SkipCurrentRow) { } else if (updatingArgs.Status == UpdateStatus.Continue) { // If the update result is an exception throw it if (!this.ContinueUpdateOnError && updateException != null) { this.CloseConnections(connections); throw updateException; } // 7. Call AcceptChanges if (this.AcceptChangesDuringUpdate && !row.HasErrors) { row.AcceptChanges(); } } } else { // If the update result is an exception throw it if (!this.ContinueUpdateOnError && updateException != null) { this.CloseConnections(connections); throw updateException; } } } this.CloseConnections(connections); return(updated); }
public StatementNode(string word, WordType wordType, StatementType statementType, Tense tense) : base(word, wordType, tense) { StatementType = statementType; }
public static void AfterUpdateBatchExecute(IBatchingAdapter adapter, BatchCommandInfo[] batchCommands, int commandCount, RowUpdatedEventArgs rowUpdatedEvent) { MissingMappingAction missingMapping = adapter.UpdateMappingAction; MissingSchemaAction missingSchema = adapter.UpdateSchemaAction; int checkRecordsAffected = 0; bool hasConcurrencyViolation = false; List <DataRow> rows = null; // walk through the batch to build the sum of recordsAffected // determine possible indivdual messages per datarow // determine possible concurrency violations per datarow // map output parameters to the datarow for (int bc = 0; bc < commandCount; ++bc) { BatchCommandInfo batchCommand = batchCommands[bc]; StatementType statementType = batchCommand.StatementType; // default implementation always returns 1, derived classes must override // otherwise DbConcurrencyException will only be thrown if sum of all records in batch is 0 if (adapter.GetBatchedRecordsAffected(batchCommand.CommandIdentifier, out int rowAffected, error: out batchCommands[bc].Errors)) { batchCommands[bc].RecordsAffected = rowAffected; } if ((null == batchCommands[bc].Errors) && batchCommands[bc].RecordsAffected.HasValue) { // determine possible concurrency violations per datarow if ((StatementType.Update == statementType) || (StatementType.Delete == statementType)) { checkRecordsAffected++; if (0 == rowAffected) { if (null == rows) { rows = new List <DataRow>(); } batchCommands[bc].Errors = ADP.UpdateConcurrencyViolation(batchCommands[bc].StatementType, 0, 1, new DataRow[] { rowUpdatedEvent.GetRow_(bc) }); hasConcurrencyViolation = true; rows.Add(rowUpdatedEvent.GetRow_(bc)); } } // map output parameters to the datarow if (((StatementType.Insert == statementType) || (StatementType.Update == statementType)) && (0 != (UpdateRowSource.OutputParameters & batchCommand.UpdatedRowSource)) && (0 != rowAffected)) // MDAC 71174 { if (StatementType.Insert == statementType) { // AcceptChanges for 'added' rows so backend generated keys that are returned // propagte into the datatable correctly. rowUpdatedEvent.GetRow_(bc).AcceptChanges(); } for (int i = 0; i < batchCommand.ParameterCount; ++i) { IDataParameter parameter = adapter.GetBatchedParameter(batchCommand.CommandIdentifier, i); ParameterMethods.ParameterOutput(parameter, batchCommand.Row, rowUpdatedEvent.TableMapping, missingMapping, missingSchema); } } } } if (null == rowUpdatedEvent.Errors) { // Only error if RecordsAffect == 0, not -1. A value of -1 means no count was received from server, // do not error in that situation (means 'set nocount on' was executed on server). if (UpdateStatus.Continue == rowUpdatedEvent.Status) { if ((0 < checkRecordsAffected) && ((0 == rowUpdatedEvent.RecordsAffected) || hasConcurrencyViolation)) { // bug50526, an exception if no records affected and attempted an Update/Delete Debug.Assert(null == rowUpdatedEvent.Errors, "Continue - but contains an exception"); DataRow[] rowsInError = (null != rows) ? rows.ToArray() : rowUpdatedEvent.GetRows_(); rowUpdatedEvent.Errors = ADP.UpdateConcurrencyViolation(StatementType.Batch, commandCount - rowsInError.Length, commandCount, rowsInError); // MDAC 55735 rowUpdatedEvent.Status = UpdateStatus.ErrorsOccurred; } } } }
RowUpdatingEventArgs DbDataAdapter.\u200B(DataRow _param1, IDbCommand _param2, StatementType _param3, DataTableMapping _param4) { // ISSUE: unable to decompile the method. }
RowUpdatedEventArgs DbDataAdapter.\u206B(DataRow _param1, IDbCommand _param2, StatementType _param3, DataTableMapping _param4) { // ISSUE: unable to decompile the method. }
protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { throw new NotImplementedException (); }
public NpgsqlRowUpdatingEventArgs(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) : base(dataRow, command, statementType, tableMapping) { }
private string CreateExceptionMessage(StatementType statementType) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("Update requires a valid "); sb.Append(statementType.ToString()); sb.Append("Command when passed DataRow collection with "); switch (statementType) { case StatementType.Insert: sb.Append("new"); break; case StatementType.Update: sb.Append("modified"); break; case StatementType.Delete: sb.Append("deleted"); break; } sb.Append(" rows."); return sb.ToString(); }
/// <summary> /// Creates a new <see cref="RowUpdatingEventArgs"/> to fire the RowUpdating event. /// </summary> /// <param name="dataRow"></param> /// <param name="command"></param> /// <param name="statementType"></param> /// <param name="tableMapping"></param> /// <returns></returns> protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { return new SharpHsqlRowUpdatingEventArgs(dataRow, command, statementType, tableMapping); }
//never used //private string QualifiedTableName(string schema, string tableName) //{ // if (schema == null || schema.Length == 0) // { // return tableName; // } // else // { // return schema + "." + tableName; // } //} /* * private static void SetParameterValuesFromRow(NpgsqlCommand command, DataRow row) * { * foreach (NpgsqlParameter parameter in command.Parameters) * { * parameter.Value = row[parameter.SourceColumn, parameter.SourceVersion]; * } * } */ protected override void ApplyParameterInfo(DbParameter p, DataRow row, StatementType statementType, bool whereClause) { NpgsqlParameter parameter = (NpgsqlParameter)p; parameter.NpgsqlDbType = NpgsqlTypesHelper.GetNativeTypeInfo((Type)row[SchemaTableColumn.DataType]).NpgsqlDbType; }
public Statement(string text, StatementType type, ResultType result) : this(text, type, result, new Dictionary <string, object>()) { }
public OleDbRowUpdatedEventArgs(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) : base(dataRow, command, statementType, tableMapping) { }
void DbCommandBuilder.\u200C(DbParameter _param1, DataRow _param2, StatementType _param3, bool _param4) { // ISSUE: unable to decompile the method. }
/// <summary> /// Overridden. See <see cref="DbDataAdapter.CreateRowUpdatingEvent"/>. /// </summary> /// <param name="dataRow"></param> /// <param name="command"></param> /// <param name="statementType"></param> /// <param name="tableMapping"></param> /// <returns></returns> override protected RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) { return(new MySqlRowUpdatingEventArgs(dataRow, command, statementType, tableMapping)); }
private ClientBillingFile ConstructOutputFile(FileInfo file, string outputDirectoryName, StatementType statementType, bool testRun) { var filePath = (statementType switch { StatementType.NcBranch => Regex.Match(file.FullName, @"(?<=NC Branches\\).*$"), StatementType.NcAgency => Regex.Match(file.FullName, @"(?<=NC Agencies\\).*$"), StatementType.NmAgency => Regex.Match(file.FullName, @"(?<=NM Agencies\\).*$"), StatementType.Srcn => Regex.Match(file.FullName, @"(?<=SRCN\\).*$"), StatementType.Mbdot => Regex.Match(file.FullName, @"(?<=MBDOT\\).*$"), StatementType.DirectOps => Regex.Match(file.FullName, @"(?<=NC Branches\\).*$"), }).Value;
protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause) { ((MySqlParameter)parameter).MySqlDbType = (MySqlDbType)row["ProviderType"]; }
protected MultiplyStatement(StatementType statementType) : base(CodeElementType.MultiplyStatement, statementType) { }
protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause) { throw new System.NotImplementedException(); }
public MultiplyStatement(StatementType statementType) : base(CodeElementType.MultiplyStatement, statementType) { }
public static StatementType From(string value) { var statementType = new StatementType(value); return(statementType); }
/// <summary> /// Initializes a new instance of the MySqlRowUpdatedEventArgs class. /// </summary> /// <param name="row">The <see cref="DataRow"/> sent through an <see cref="DbDataAdapter.Update(DataSet)"/>.</param> /// <param name="command">The <see cref="IDbCommand"/> executed when <see cref="DbDataAdapter.Update(DataSet)"/> is called.</param> /// <param name="statementType">One of the <see cref="StatementType"/> values that specifies the type of query executed.</param> /// <param name="tableMapping">The <see cref="DataTableMapping"/> sent through an <see cref="DbDataAdapter.Update(DataSet)"/>.</param> public MySqlRowUpdatedEventArgs(DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) : base(row, command, statementType, tableMapping) { }
public AddStatement(StatementType statementType) : base(CodeElementType.AddStatement, statementType) { }
public AssignStatement(StatementType statementType, Identifier variableIdentifier, NonTerminal expression) : base(statementType) { VariableIdentifier = variableIdentifier; Expression = expression; }
private static StatementNodeBuilder StatementNode(int indent, StatementType type, TokenListBuilder <ParserTokenType> tokens, StatementNodeBuilder children = null) { var builder = new StatementNodeBuilder(); return(builder.StatementNode(indent, type, tokens, children)); }
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommandBuilder.xml' path='docs/members[@name="SqlCommandBuilder"]/ApplyParameterInfo/*'/> protected override void ApplyParameterInfo(DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause) { SqlParameter p = (SqlParameter)parameter; object valueType = datarow[SchemaTableColumn.ProviderType]; p.SqlDbType = (SqlDbType)valueType; p.Offset = 0; if ((p.SqlDbType == SqlDbType.Udt) && !p.SourceColumnNullMapping) { p.UdtTypeName = datarow["DataTypeName"] as string; } else { p.UdtTypeName = string.Empty; } object bvalue = datarow[SchemaTableColumn.NumericPrecision]; if (DBNull.Value != bvalue) { byte bval = (byte)(short)bvalue; p.PrecisionInternal = ((0xff != bval) ? bval : (byte)0); } bvalue = datarow[SchemaTableColumn.NumericScale]; if (DBNull.Value != bvalue) { byte bval = (byte)(short)bvalue; p.ScaleInternal = ((0xff != bval) ? bval : (byte)0); } }
internal static ArgumentOutOfRangeException NotSupportedStatementType(StatementType value, string method) { return(NotSupportedEnumerationValue(typeof(StatementType), value.ToString(), method)); }
protected override void ApplyParameterInfo(DbParameter parameter, DataRow datarow, StatementType statementType, bool whereClause) { OleDbParameter p = (OleDbParameter)parameter; object valueType = datarow[SchemaTableColumn.ProviderType]; p.OleDbType = (OleDbType)valueType; object bvalue = datarow[SchemaTableColumn.NumericPrecision]; if (DBNull.Value != bvalue) { byte bval = (byte)(short)bvalue; p.PrecisionInternal = ((0xff != bval) ? bval : (byte)0); } bvalue = datarow[SchemaTableColumn.NumericScale]; if (DBNull.Value != bvalue) { byte bval = (byte)(short)bvalue; p.ScaleInternal = ((0xff != bval) ? bval : (byte)0); } }
private void UpdateParameterValues( IDbCommand command, StatementType statementType, DataRow row, DataTableMapping tableMapping) { foreach (DbParameter parameter in command.Parameters) { // Process only input parameters if ((parameter.Direction == ParameterDirection.Input || parameter.Direction == ParameterDirection.InputOutput) && !String.IsNullOrEmpty(parameter.SourceColumn)) { DataColumn column = null; /* Get the DataColumnMapping that matches the given * column name */ DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction( parameter.SourceColumn, MissingMappingAction); if (columnMapping != null) { column = columnMapping.GetDataColumnBySchemaAction(row.Table, null, MissingSchemaAction); if (column != null) { DataRowVersion dataRowVersion = DataRowVersion.Default; if (statementType == StatementType.Insert) { dataRowVersion = DataRowVersion.Current; } else if (statementType == StatementType.Update) { dataRowVersion = parameter.SourceVersion; } else if (statementType == StatementType.Delete) { dataRowVersion = DataRowVersion.Original; } if (parameter.SourceColumnNullMapping) { parameter.Value = IsNull(row[column, dataRowVersion]) ? 1 : 0; } else { parameter.Value = row[column, dataRowVersion]; } } } } } }
// // DbDataAdapter // internal static ArgumentException UnwantedStatementType(StatementType statementType) { return(Argument(SR.Format(SR.ADP_UnwantedStatementType, statementType.ToString()))); }