if(entity.getDataMap()!=null && entity.getDataMap().isQuotingSQLIdentifiers()){
status= true;
} else {
status = false;
}
QuotingStrategy context = getAdapter().getQuotingStrategy(status);
if (pk == null || pk.size() == 0) {
throw new CayenneRuntimeException("Entity '"
+ entity.getName()
+ "' has no PK defined.");
}
StringBuilder buffer = new StringBuilder();
// compound PK doesn't work well with UNIQUE index...
// create a regular one in this case
buffer.append(pk.size() == 1 ? "CREATE UNIQUE INDEX " : "CREATE INDEX ");
buffer.append(context.quoteString(entity.getName()));
buffer.append(" (");
Iterator<DbAttribute> it = pk.iterator();
// at this point we know that there is at least on PK column
DbAttribute firstColumn = it.next();
buffer.append(context.quoteString(firstColumn.getName()));
while (it.hasNext()) {
DbAttribute column = it.next();
buffer.append(", ");
buffer.append(context.quoteString(column.getName()));
}
buffer.append(")");
return buffer.toString();
}