Driver modified for JDeveloper+ADF communication
От | Javier Caballero |
---|---|
Тема | Driver modified for JDeveloper+ADF communication |
Дата | |
Msg-id | 4677B87B.2000108@empretal.com обсуждение исходный текст |
Ответы |
Re: Driver modified for JDeveloper+ADF communication
|
Список | pgsql-jdbc |
Hi. I'm doing a program with JDeveloper+ADF and Postgre and was having problems with the update sentence (created automatically by JDeveloper). After some research, found the problem in the SQL sentence. Postgre don't accept alias in a UPDATE query and JDeveloper sends it. I have modified the driver to eliminate the alias, here's a new method to include in AbstractJdbc2Statement.java: private String eliminaAlias(String sql) { String nuevaSQL= sql; StringTokenizer cadenaTokens=new StringTokenizer(sql); String vTokens[]= new String[cadenaTokens.countTokens()]; int j= 0; String temp; while(cadenaTokens.hasMoreTokens()) { temp= cadenaTokens.nextToken(); vTokens[j]= temp; j++; } // La sentencia tiene un alias, hay que eliminarlo if((vTokens[1].toLowerCase()).equals(vTokens[2].toLowerCase()) || (vTokens[1].toLowerCase()).equals("public."+vTokens[2].toLowerCase())) { nuevaSQL= ""; for(int i=0;i<vTokens.length;i++) { if(i==2)continue; nuevaSQL+= vTokens[i]; if(i!=(vTokens.length - 1)) { nuevaSQL+= " "; } else { nuevaSQL+= ";"; } } } return nuevaSQL; } And the call to this method is in the constructor of the class: public AbstractJdbc2Statement(AbstractJdbc2Connection connection, String sql, boolean isCallable, int rsType, int rsConcurrency) throws SQLException { // -- Added // Si es una sentencia UPDATE eliminamos el alias if(sql.trim().toUpperCase().indexOf("UPDATE") == 0) { sql = eliminaAlias(sql); } // -- End added . . . I'm sending it to the list because it was ussefull to me and maybe for others. Bye, Paxet.
В списке pgsql-jdbc по дате отправления: