use of org.apache.cayenne.dba.mysql.MySQLAdapter in project cayenne by apache.
the class JdbcAdapterIT method testCreateTableQuoteSqlIdentifiers.
@Test
public void testCreateTableQuoteSqlIdentifiers() {
if (dbAdapter instanceof MySQLAdapter) {
DbEntity entity = new DbEntity();
DbAttribute attr = new DbAttribute();
attr.setName("name column");
attr.setType(1);
entity.addAttribute(attr);
DbKeyGenerator id = new DbKeyGenerator();
entity.setPrimaryKeyGenerator(id);
DataMap dm = new DataMap();
dm.setQuotingSQLIdentifiers(true);
entity.setDataMap(dm);
entity.setName("name table");
MySQLAdapter adaptMySQL = (MySQLAdapter) dbAdapter;
String str = "CREATE TABLE `name table` (`name column` CHAR NULL) ENGINE=InnoDB";
assertEquals(str, adaptMySQL.createTable(entity));
}
}
Aggregations