1 19 20 package org.apache.cayenne.dba.postgres; 21 22 import java.sql.Connection ; 23 24 import org.apache.cayenne.access.trans.ProcedureTranslator; 25 import org.apache.cayenne.dba.DbAdapter; 26 import org.apache.cayenne.dba.sqlserver.SQLServerProcedureAction; 27 import org.apache.cayenne.map.EntityResolver; 28 import org.apache.cayenne.query.ProcedureQuery; 29 30 39 class PostgresProcedureAction extends SQLServerProcedureAction { 40 41 PostgresProcedureAction(ProcedureQuery query, DbAdapter adapter, 42 EntityResolver entityResolver) { 43 super(query, adapter, entityResolver); 44 } 45 46 49 protected ProcedureTranslator createTranslator(Connection connection) { 51 ProcedureTranslator translator = new PostgresProcedureTranslator(); 52 translator.setAdapter(getAdapter()); 53 translator.setQuery(query); 54 translator.setEntityResolver(getEntityResolver()); 55 translator.setConnection(connection); 56 return translator; 57 } 58 59 static class PostgresProcedureTranslator extends ProcedureTranslator { 60 61 protected String createSqlString() { 62 63 String sql = super.createSqlString(); 64 65 if (sql.endsWith("}") && !sql.endsWith(")}")) { 67 sql = sql.substring(0, sql.length() - 1) + "()}"; 68 } 69 70 return sql; 71 } 72 } 73 } 74 | Popular Tags |