use of com.alibaba.otter.node.etl.common.db.dialect.mysql.MysqlSqlTemplate in project otter by alibaba.
the class SqlTemplateTest method test_mysql.
@Test
public void test_mysql() {
SqlTemplate sqlTemplate = new MysqlSqlTemplate();
// 执行insert
String sql1 = sqlTemplate.getInsertSql(SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
String sql2 = sqlTemplate.getInsertSql(SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
want.bool(sql1 == sql2);
// 执行update
sql1 = sqlTemplate.getUpdateSql(SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
sql2 = sqlTemplate.getUpdateSql(SCHEMA_NAME, TABLE_NAME, pkColumns, columns);
want.bool(sql1 == sql2);
// 执行deleate
sql1 = sqlTemplate.getDeleteSql(SCHEMA_NAME, TABLE_NAME, pkColumns);
sql2 = sqlTemplate.getDeleteSql(SCHEMA_NAME, TABLE_NAME, pkColumns);
want.bool(sql1 == sql2);
// 执行merge
sql1 = sqlTemplate.getMergeSql(SCHEMA_NAME, TABLE_NAME, pkColumns, columns, null, true);
sql2 = sqlTemplate.getMergeSql(SCHEMA_NAME, TABLE_NAME, pkColumns, columns, null, true);
want.bool(sql1 == sql2);
}
Aggregations