1 56 package org.objectstyle.cayenne.dba.sqlserver; 57 58 import org.objectstyle.cayenne.access.DataNode; 59 import org.objectstyle.cayenne.access.trans.QualifierTranslator; 60 import org.objectstyle.cayenne.access.trans.QueryAssembler; 61 import org.objectstyle.cayenne.access.trans.TrimmingQualifierTranslator; 62 import org.objectstyle.cayenne.dba.sybase.SybaseAdapter; 63 import org.objectstyle.cayenne.map.DbAttribute; 64 import org.objectstyle.cayenne.query.Query; 65 import org.objectstyle.cayenne.query.SQLAction; 66 67 118 public class SQLServerAdapter extends SybaseAdapter { 119 120 public static final String TRIM_FUNCTION = "RTRIM"; 121 122 public SQLServerAdapter() { 123 this.setSupportsGeneratedKeys(true); 126 } 127 128 129 134 public SQLAction getAction(Query query, DataNode node) { 135 return query.createSQLAction(new SQLServerActionBuilder(this, node.getEntityResolver())); 136 } 137 138 139 142 public QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler) { 143 return new TrimmingQualifierTranslator( 144 queryAssembler, 145 SQLServerAdapter.TRIM_FUNCTION); 146 } 147 148 149 154 protected void createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) { 155 super.createTableAppendColumn(sqlBuffer, column); 156 157 if(column.isGenerated()) { 158 sqlBuffer.append(" IDENTITY (1, 1)"); 160 } 161 } 162 } | Popular Tags |