Package liquibase.statement.core

Examples of liquibase.statement.core.InsertOrUpdateStatement


    @Test
    public void ContainsInsertStatement(){
        OracleDatabase database = new OracleDatabase();
        InsertOrUpdateGeneratorOracle generator = new InsertOrUpdateGeneratorOracle();
        InsertOrUpdateStatement statement = new InsertOrUpdateStatement("mycatalog", "myschema","mytable","pk_col1");
        statement.addColumnValue("pk_col1","value1");
        statement.addColumnValue("col2","value2");
        Sql[] sql = generator.generateSql( statement, database,  null);
        String theSql = sql[0].toSql();
        assertTrue(theSql.contains("INSERT INTO mycatalog.mytable (pk_col1, col2) VALUES ('value1', 'value2');"));
        assertTrue(theSql.contains("UPDATE mycatalog.mytable"));
        String[] sqlLines = theSql.split("\n");
View Full Code Here


    @Test
    public void testOnlyUpdateFlag(){
        OracleDatabase database = new OracleDatabase();
        InsertOrUpdateGeneratorOracle generator = new InsertOrUpdateGeneratorOracle();
        InsertOrUpdateStatement statement = new InsertOrUpdateStatement("mycatalog", "myschema","mytable","pk_col1", true);
        statement.addColumnValue("pk_col1","value1");
        statement.addColumnValue("col2","value2");
        Sql[] sql = generator.generateSql( statement, database,  null);
        String theSql = sql[0].toSql();
        assertFalse("should not have had insert statement",theSql.contains("INSERT INTO mycatalog.mytable (pk_col1, col2) VALUES ('value1', 'value2');"));
        assertTrue("missing update statement", theSql.contains("UPDATE mycatalog.mytable"));
        String[] sqlLines = theSql.split("\n");
View Full Code Here

    this.onlyUpdate = (onlyUpdate == null ? Boolean.FALSE : onlyUpdate) ;
  }

  @Override
    protected InsertStatement createStatement(String catalogName, String schemaName, String tableName) {
        return new InsertOrUpdateStatement(catalogName, schemaName, tableName, this.primaryKey, this.getOnlyUpdate());
    }
View Full Code Here

    public SqlStatement[] generateRollbackStatements(Database database) throws RollbackImpossibleException {
        List<SqlStatement> statements = new ArrayList<SqlStatement>();
        SqlStatement[] forward = this.generateStatements(database);

        for(SqlStatement thisForward: forward){
            InsertOrUpdateStatement thisInsert = (InsertOrUpdateStatement)thisForward;
            DeleteStatement delete = new DeleteStatement(getCatalogName(), getSchemaName(),getTableName());
            delete.setWhere(getWhere(thisInsert,database));
            statements.add(delete);
        }
View Full Code Here

    @Test
    public void getRecordCheck(){
        InsertOrUpdateGeneratorMSSQL generator = new InsertOrUpdateGeneratorMSSQL();
        MSSQLDatabase database = new MSSQLDatabase();

        InsertOrUpdateStatement statement = new InsertOrUpdateStatement("mycatalog", "myschema","mytable","pk_col1");
        statement.addColumnValue("pk_col1","value1");
        statement.addColumnValue("col2","value2");

        String where = "1 = 1";

        String recordCheck = (String)invokePrivateMethod(generator,"getRecordCheck", new Object[] {statement,database,where});
View Full Code Here

    @Test
    public void getInsert(){
        InsertOrUpdateGeneratorMSSQL generator = new InsertOrUpdateGeneratorMSSQL();
        MSSQLDatabase database = new MSSQLDatabase();

        InsertOrUpdateStatement statement = new InsertOrUpdateStatement("mycatalog", "myschema","mytable","pk_col1");
        statement.addColumnValue("pk_col1","value1");
        statement.addColumnValue("col2","value2");

        String where = "1 = 1";

        Class c = InsertOrUpdateGenerator.class.getClass();
        //InsertOrUpdateStatement insertOrUpdateStatement, Database database, SqlGeneratorChain sqlGeneratorChain
View Full Code Here

    @Test
    public void getElse(){
        InsertOrUpdateGeneratorMSSQL generator = new InsertOrUpdateGeneratorMSSQL();
        MSSQLDatabase database = new MSSQLDatabase();

        InsertOrUpdateStatement statement = new InsertOrUpdateStatement("mycatalog", "myschema","mytable","pk_col1");
        statement.addColumnValue("pk_col1","value1");
        statement.addColumnValue("col2","value2");

        String where = "1 = 1";

        Class c = InsertOrUpdateGenerator.class.getClass();
        //InsertOrUpdateStatement insertOrUpdateStatement, Database database, SqlGeneratorChain sqlGeneratorChain
View Full Code Here

    @Test
     public void getUpdate(){
         InsertOrUpdateGeneratorMSSQL generator = new InsertOrUpdateGeneratorMSSQL();
         MSSQLDatabase database = new MSSQLDatabase();

         InsertOrUpdateStatement statement = new InsertOrUpdateStatement("mycatalog", "myschema","mytable","pk_col1");
         statement.addColumnValue("col2","value2");

         String where = "1 = 1";

         Class c = InsertOrUpdateGenerator.class.getClass();
        //InsertOrUpdateStatement insertOrUpdateStatement, Database database, String whereClause, SqlGeneratorChain sqlGeneratorChain
View Full Code Here

TOP

Related Classes of liquibase.statement.core.InsertOrUpdateStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.