Fix error replacing getDate() - ID: 2371805

This commit is contained in:
Carlos Ruiz 2008-12-01 18:15:15 +00:00
parent a58e7f394d
commit a688bd0f16
2 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,17 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 Adempiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.dbPort;
import java.util.TreeMap;
@ -52,8 +66,8 @@ public final class ConvertMap_PostgreSQL {
s_pg.put("\\bSYSDATE\\b", "CURRENT_TIMESTAMP"); // alternative: NOW()
//begin vpj-cd e-evolution 03/11/2005 PostgreSQL
s_pg.put("\\bDUMP\\b", "MD5");
s_pg.put("END CASE", "END");
s_pg.put("\\bgetDate()\\b", "CURRENT_TIMESTAMP"); // alternative: NOW()
s_pg.put("END CASE", "END");
s_pg.put("\\bgetDate\\b\\(\\)", "CURRENT_TIMESTAMP"); // alternative: NOW()
//end vpj-cd e-evolution 03/11/2005 PostgreSQL
s_pg.put("\\bNVL\\b", "COALESCE");
s_pg.put("\\bTO_DATE\\b", "TO_TIMESTAMP");

View File

@ -417,7 +417,19 @@ public final class Convert_PostgreSQLTest extends TestCase{
r = convert.convert(sql);
assertEquals(sqe, r[0]);
}
public void test2371805_GetDate() {
sql = "SELECT getdate() FROM DUAL";
sqe = "SELECT CURRENT_TIMESTAMP";
r = convert.convert(sql);
assertEquals(sqe, r[0]);
sql = "SELECT SYSDATE FROM DUAL";
sqe = "SELECT CURRENT_TIMESTAMP";
r = convert.convert(sql);
assertEquals(sqe, r[0]);
}
/**
* Test BF [ 1824256 ] Convert sql casts
*/