Ejemplo n.º 1
0
        static MySQLProcessors()
        {
            var processors = SQLProcessorAggregator.GetDefaultProcessorsCopy();

            // MySQL doesn't understand schemas
            processors[typeof(TableNameDirectImpl)]     = new MySQLTableNameDirectProcessor();
            processors[typeof(TableNameFunctionImpl)]   = new MySQLTableNameFunctionProcessor();
            processors[typeof(SchemaDefinitionImpl)]    = new MySQLSchemaDefinitionProcessor();
            processors[typeof(DropSchemaStatementImpl)] = new NoOpProcessor();

            // MySQL has custom way of handling auto generation syntax of columns
            processors[typeof(ColumnDefinitionImpl)] = new MySQLColumnDefinitionProcessor();

            // MySQL has different syntax for OFFSET/FETCH
            processors[typeof(QuerySpecificationImpl)] = new MySQLQuerySpecificationProcessor();

            DEFAULT_PROCESSORS = processors;
        }
Ejemplo n.º 2
0
        static PgSQLProcessors()
        {
            var processors = SQLProcessorAggregator.GetDefaultProcessorsCopy();

            // Override default processor for date-time
            processors[typeof(TimestampLiteralImpl)] = new PgSQLTimestampLiteralProcessor();

            // Override default processor for column definition
            processors[typeof(ColumnDefinitionImpl)] = new PgSQLColumnDefinitionProcessor();

            // Override default processor for regexp predicates
            processors[typeof(RegexpPredicateImpl)] = new BinaryPredicateProcessor("~", "!~");

            // Override default processor for query specification
            processors[typeof(QuerySpecificationImpl)] = new PgSQLQuerySpecificationProcessor();

            // Override default processor for table definition by adding support for table commit action
            var tableCommitActions = TableDefinitionProcessor.NewCopyOfDefaultCommitActions();

            tableCommitActions.Add((TableCommitAction)PgSQLTableCommitAction.Drop, "DROP");
            processors[typeof(TableDefinitionImpl)] = new TableDefinitionProcessor(null, tableCommitActions);

            // Add support for TEXT datatype
            processors.Add(typeof(SQLDTTextImpl), new ConstantProcessor("TEXT"));

            // Add IF EXISTS functionality to DROP TABLE/VIEW statements
            processors.Remove(typeof(DropTableOrViewStatementImpl));
            processors.Add(typeof(PgSQLDropTableOrViewStatementImpl), new PgSQLDropTableOrViewStatementProcessor());

            // Add support for PgSQL-specific INSERT statement RETURNING clause
            processors.Remove(typeof(InsertStatementImpl));
            processors.Add(typeof(PgSQLInsertStatementImpl), new PgSQLInsertStatementProcessor());

            // Add support for column name list to appear as non-boolean expression (e.g. within where-clause)
            processors.Add(typeof(ColumnNameListExpressionImpl), new ColumnNamesProcessor());

            // Add support for VALUES clause to be value expression (e.g. within where-clause)
            processors.Add(typeof(ValuesExpressionImpl), new ValuesExpressionProcessor());

            DEFAULT_PROCESSORS = processors;
        }