1 19 20 package org.apache.cayenne.dba.sqlserver; 21 22 import org.apache.cayenne.access.DataNode; 23 import org.apache.cayenne.access.trans.QualifierTranslator; 24 import org.apache.cayenne.access.trans.QueryAssembler; 25 import org.apache.cayenne.access.trans.TrimmingQualifierTranslator; 26 import org.apache.cayenne.dba.sybase.SybaseAdapter; 27 import org.apache.cayenne.map.DbAttribute; 28 import org.apache.cayenne.query.Query; 29 import org.apache.cayenne.query.SQLAction; 30 31 82 public class SQLServerAdapter extends SybaseAdapter { 83 84 public static final String TRIM_FUNCTION = "RTRIM"; 85 86 public SQLServerAdapter() { 87 this.setSupportsGeneratedKeys(true); 90 this.setSupportsBatchUpdates(true); 91 } 92 93 94 99 public SQLAction getAction(Query query, DataNode node) { 100 return query.createSQLAction(new SQLServerActionBuilder(this, node.getEntityResolver())); 101 } 102 103 104 107 public QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler) { 108 return new TrimmingQualifierTranslator( 109 queryAssembler, 110 SQLServerAdapter.TRIM_FUNCTION); 111 } 112 113 114 119 protected void createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) { 120 super.createTableAppendColumn(sqlBuffer, column); 121 122 if(column.isGenerated()) { 123 sqlBuffer.append(" IDENTITY (1, 1)"); 125 } 126 } 127 } 128 | Popular Tags |