public PGDMLEntityActions(IDMLService service, ITableSourceInfo tableSourceInfo) : base(service, tableSourceInfo) { getforupdateplaceholder = new Dictionary <SelectPlaceholder, string>() { { SelectPlaceholder.AfterStatement, "FOR UPDATE" } }; }
public DatabaseServices(IRuntimeDatabaseConfiguration databaseConfiguration) { configuration = databaseConfiguration; objectFactory = new DatabaseObjectFactory(this); transactionService = new TransactionService.TransactionService(this); executionService = new ExecutionService.ExecutionService(this); dmlService = new DMLService.DMLService(this); introspectionService = new IntrospectionService.IntrospectionService(this); }
/// <summary> /// Initializes a new instance of the <see cref="CacheDatabaseServices"/> class. /// </summary> /// <param name="databaseConfiguration">The database configuration.</param> public CacheDatabaseServices(IRuntimeDatabaseConfiguration databaseConfiguration) { _configuration = databaseConfiguration; _objectFactory = new CacheDatabaseObjectFactory(this); _transactionService = new CacheTransactionService(this); _executionService = new CacheExecutionService(this); _dmlService = new CacheDMLService(this); _introspectionService = new CacheIntrospectionService(this); }
public MySQLDatabaseServices(IRuntimeDatabaseConfiguration databaseConfiguration) { configuration = databaseConfiguration; objectFactory = new MySQLDatabaseObjectFactory(this); transactionService = new MySQLTransactionService(this); executionService = new MySQLExecutionService(this); dmlService = new MySQLDMLService(this); introspectionService = new MySQLIntrospectionService(this); }
public iDB2DatabaseServices(IRuntimeDatabaseConfiguration databaseConfiguration) { configuration = databaseConfiguration; objectFactory = new IDB2DatabaseObjectFactory(this); transactionService = new iDB2TransactionService(this); executionService = new iDB2ExecutionService(this); dmlService = new iDB2DMLService(this); introspectionService = new iDB2IntrospectionService(this); }
public DB2LUWDatabaseServices(IRuntimeDatabaseConfiguration databaseConfiguration) { configuration = databaseConfiguration; objectFactory = new DB2LUWDatabaseObjectFactory(this); transactionService = new DB2LUWTransactionService(this); executionService = new DB2LUWExecutionService(this); dmlService = new DB2LUWDMLService(this); introspectionService = new DB2LUWIntrospectionService(this); }
internal iDB2DMLIdentifiers(IDMLService dmlService) : base(dmlService) { }
/// <summary> /// Initializes a new instance of the <see cref="CacheDMLAggregateFunctions"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> internal CacheDMLAggregateFunctions(IDMLService dmlService) : base(dmlService) { }
internal DB2LUWDMLIdentifiers(IDMLService dmlService) : base(dmlService) { }
internal MySQLDMLAggregateFunctions(IDMLService dmlService) : base(dmlService) { }
internal iDB2DMLDefaultValues(IDMLService dmlService) : base(dmlService) { }
protected BaseDMLDefaultValues(IDMLService dmlService) { DMLService = dmlService; }
/// <summary> /// This method generates the query that will be used in the event trigger. /// This assumes that the underlying database has the NULLIF and COALESCE functions. /// </summary> /// <param name="sql">StringBuilder that will receive the query SQL.</param> /// <param name="triggerTablePrimaryKeyColumn">Primary key column of the table associated with the trigger.</param> /// <param name="triggerTableEventColumns">Columns of the table associated with the trigger that fire events.</param> /// <param name="triggerTableForeignKeys">Foreign keys of the table associated with the trigger.</param> /// <param name="eventTable">Table source that stores the events for the table associated with the trigger. This table resides in the same database as the table where the trigger is defined.</param> /// <param name="eventQueueTable">Table source that stores the events to be fired by the platform.</param> /// <param name="triggerDataAccessor">SQL snippet to access the newly triggered data (new or updated line in trigger table).</param> /// <param name="needsTriggerDataAccessorInFrom">True if we need to include the <paramref name="triggerDataAccessor"/> in a from clause to access it in a query.</param> /// <param name="isUpdateVariableAccessor">SQL snippet to access the variable that is true if this trigger is an update.</param> protected virtual void FillEventTriggerQuery(StringBuilder sql, IPlatformTableSourceColumnInfo triggerTablePrimaryKeyColumn, IEnumerable <IPlatformTableSourceColumnInfo> triggerTableEventColumns, IEnumerable <ITableSourceForeignKeyInfo> triggerTableForeignKeys, ITableSourceInfo eventTable, ITableSourceInfo eventQueueTable, string triggerDataAccessor, bool needsTriggerDataAccessorInFrom, string isUpdateVariableAccessor) { // We don't use the qualified name if both tables are in the same database, because this breaks database clone processes sql.AppendFormat(" INSERT INTO {0}", eventTable.Database.Equals(eventQueueTable.Database) ? eventQueueTable.Name : eventQueueTable.QualifiedName); sql.Append("(ESPACE_ID, TENANT_ID, ACTIVITY_ID, PROCESS_DEF_ID, DATA_ID, ENQUEUE_TIME, ERROR_COUNT, NEXT_RUN)"); var triggerTableEventColumnsList = triggerTableEventColumns.ToList(); ITableSourceColumnInfo tenantFilterField = GetTenantFilterField(triggerTableEventColumnsList); string defaultTenantIdField = Identifiers.EscapeIdentifier("_TENANT_ID"); string tenantIdInSelect = (tenantFilterField == null)? defaultTenantIdField: "COALESCE(" + defaultTenantIdField + ", " + triggerDataAccessor + "." + Identifiers.EscapeIdentifier(tenantFilterField.Name) + ")"; IDMLService dmlService = DatabaseServices.DMLService; string dataIdInSelect = String.Format("{0}.{1}", triggerDataAccessor, Identifiers.EscapeIdentifier(triggerTablePrimaryKeyColumn.Name)); dataIdInSelect = (triggerTablePrimaryKeyColumn.DataType.Type == DBDataType.INTEGER)? dmlService.Functions.IntegerToText(dataIdInSelect): dataIdInSelect; sql.AppendFormat(" (SELECT {0}, {1}, {2}, {3}, {4}, GETDATE(), 0, GETDATE() FROM {5} evt{6}", Identifiers.EscapeIdentifier("_ESPACE_ID"), tenantIdInSelect, Identifiers.EscapeIdentifier("_ACTIVITY_ID"), Identifiers.EscapeIdentifier("_PROCESS_DEF_ID"), dataIdInSelect, Identifiers.EscapeIdentifier(eventTable.Name), needsTriggerDataAccessorInFrom? (", " + triggerDataAccessor): String.Empty); sql.Append(" WHERE "); IDMLOperators operators = dmlService.Operators; string whereClause = operators.Equal("evt." + Identifiers.EscapeIdentifier("_IS_UPDATE"), isUpdateVariableAccessor); var triggerTableColumnNames = new HashSet <string>(triggerTableForeignKeys.Select(fk => fk.ColumnName.ToUpperInvariant())); foreach (var column in triggerTableEventColumnsList) { string insertedFieldSnippet = triggerDataAccessor + "." + Identifiers.EscapeIdentifier(column.Name); string evtFieldSnippet = "evt." + Identifiers.EscapeIdentifier(column.Name); string coalesceSnippet = "{0}"; string nullIfSnippet = "{0}"; if (triggerTableColumnNames.Contains(column.Name.ToUpperInvariant()) || (column == tenantFilterField)) { switch (column.DataType.Type) { case DBDataType.INTEGER: nullIfSnippet = "NULLIF({0}, " + GetDefaultValue(DBDataType.INTEGER) + ")"; coalesceSnippet = "COALESCE({0}, " + GetDefaultValue(DBDataType.INTEGER) + ")"; break; case DBDataType.LONGINTEGER: nullIfSnippet = "NULLIF({0}, " + GetDefaultValue(DBDataType.LONGINTEGER) + ")"; coalesceSnippet = "COALESCE({0}, " + GetDefaultValue(DBDataType.LONGINTEGER) + ")"; break; case DBDataType.TEXT: nullIfSnippet = "NULLIF({0}, " + GetDefaultValue(DBDataType.TEXT) + ")"; coalesceSnippet = "COALESCE({0}, " + GetDefaultValue(DBDataType.TEXT) + ")"; break; } } string condition = operators.Or(operators.IsNull(nullIfSnippet.F(evtFieldSnippet)), operators.Equal(evtFieldSnippet, coalesceSnippet.F(insertedFieldSnippet))); whereClause = operators.And(whereClause, "(" + condition + ")"); } sql.Append(whereClause); sql.Append(")"); }
internal MySQLPlatformDMLIdentifiers(IDMLService dmlService) : base(dmlService) { }
/// <summary> /// Initializes a new instance of the <see cref="GenericDMLSyntaxHighlightDefinitions"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> public GenericDMLSyntaxHighlightDefinitions(IDMLService dmlService) { DMLService = dmlService; }
internal DB2LUWDMLAggregateFunctions(IDMLService dmlService) : base(dmlService) { }
/// <summary> /// Initializes a new instance of the <see cref="DMLAggregateFunctions"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> internal SnowflakeDMLAggregateFunctions(IDMLService dmlService) : base(dmlService) { }
/// <summary> /// Initializes a new instance of the <see cref="DMLQueries"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> internal SnowflakeDMLQueries(IDMLService dmlService) : base(dmlService) { }
internal MySQLDMLOperators(IDMLService dmlService) : base(dmlService) { }
internal DB2ZOSDMLOperators(IDMLService dmlService) : base(dmlService) { }
internal DMLFunctions(IDMLService dmlService) : base(dmlService) { }
/// <summary> /// Initializes a new instance of the <see cref="DMLOperators"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> internal SnowflakeDMLOperators(IDMLService dmlService) : base(dmlService) { }
protected override string GetCreateActivityNextRunSql(IDMLService dmlService) { return(dmlService.Functions.AddSeconds("GETDATE()", "1")); }
protected BaseDMLEntityActions(IDMLService dmlServices, ITableSourceInfo tableSourceInfo) { DMLService = dmlServices; TableSourceInfo = tableSourceInfo; }
internal MySQLPlatformDMLFunctions(IDMLService dmlService) : base(dmlService) { }
/// <summary> /// Initializes a new instance of the <see cref="DMLIdentifiers"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> internal SnowflakeDMLIdentifiers(IDMLService dmlService) : base(dmlService) { }
/// <summary> /// Initializes a new instance of the <see cref="CacheDMLOperators"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> internal CacheDMLOperators(IDMLService dmlService) : base(dmlService) { }
protected BaseDMLIdentifiers(IDMLService dmlService) { DMLService = dmlService; }
/// <summary> /// Initializes a new instance of the <see cref="CacheDMLEntityActions"/> class. /// </summary> /// <param name="dmlService">The DML service.</param> /// <param name="tableSourceInfo">The table source information.</param> internal CacheDMLEntityActions(IDMLService dmlService, ITableSourceInfo tableSourceInfo) : base(dmlService, tableSourceInfo) { }
internal DB2LUWDMLQueries(IDMLService dmlService) : base(dmlService) { }