protected internal virtual DbBulkOperation performBulkOperationPreserveOrder(Type entityType, string statement, object parameter, DbOperationType operationType) { DbBulkOperation bulkOperation = createDbBulkOperation(entityType, statement, parameter, operationType); // schedule operation dbOperationManager.addOperationPreserveOrder(bulkOperation); return(bulkOperation); }
protected internal override void updateBulk(DbBulkOperation operation) { string statement = operation.Statement; object parameter = operation.Parameter; LOG.executeDatabaseBulkOperation("UPDATE", statement, parameter); executeUpdate(statement, parameter); }
protected internal override void deleteBulk(DbBulkOperation operation) { string statement = operation.Statement; object parameter = operation.Parameter; LOG.executeDatabaseBulkOperation("DELETE", statement, parameter); int rowsAffected = executeDelete(statement, parameter); operation.RowsAffected = rowsAffected; }
private DbBulkOperation createDbBulkOperation(Type entityType, string statement, object parameter, DbOperationType operationType) { // create operation DbBulkOperation bulkOperation = new DbBulkOperation(); // configure operation bulkOperation.OperationType = operationType; bulkOperation.EntityType = entityType; bulkOperation.Statement = statement; bulkOperation.Parameter = parameter; return(bulkOperation); }
private DatabasePurgeReport purgeDatabase(CommandContext commandContext) { DbEntityManager dbEntityManager = commandContext.DbEntityManager; // For MySQL and MariaDB we have to disable foreign key check, // to delete the table data as bulk operation (execution, incident etc.) // The flag will be reset by the DBEntityManager after flush. dbEntityManager.IgnoreForeignKeysForNextFlush = true; IList <string> tablesNames = dbEntityManager.TableNamesPresentInDatabase; string databaseTablePrefix = commandContext.ProcessEngineConfiguration.DatabaseTablePrefix.Trim(); // for each table DatabasePurgeReport databasePurgeReport = new DatabasePurgeReport(); foreach (string tableName in tablesNames) { string tableNameWithoutPrefix = tableName.Replace(databaseTablePrefix, EMPTY_STRING); if (!TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK.Contains(tableNameWithoutPrefix)) { // Check if table contains data IDictionary <string, string> param = new Dictionary <string, string>(); param[TABLE_NAME] = tableName; long?count = (long?)dbEntityManager.selectOne(SELECT_TABLE_COUNT, param); if (count > 0) { databasePurgeReport.addPurgeInformation(tableName, count); // Get corresponding entity classes for the table, which contains data IList <Type> entities = commandContext.TableDataManager.getEntities(tableName); if (entities.Count == 0) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new ProcessEngineException("No mapped implementation of " + typeof(DbEntity).FullName + " was found for: " + tableName); } // Delete the table data as bulk operation with the first entity Type entity = entities[0]; DbBulkOperation deleteBulkOp = new DbBulkOperation(DbOperationType.DELETE_BULK, entity, DELETE_TABLE_DATA, param); dbEntityManager.DbOperationManager.addOperation(deleteBulkOp); } } } return(databasePurgeReport); }
protected internal abstract void UpdateBulk(DbBulkOperation operation);