From a688bd0f16258bc2077933834d14aacd8040a802 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 1 Dec 2008 18:15:15 +0000 Subject: [PATCH] Fix error replacing getDate() - ID: 2371805 --- .../compiere/dbPort/ConvertMap_PostgreSQL.java | 18 ++++++++++++++++-- .../dbPort/Convert_PostgreSQLTest.java | 14 +++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/base/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java b/base/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java index 690dcc0c7a..6152de6efa 100644 --- a/base/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java +++ b/base/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java @@ -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"); diff --git a/base/src/org/compiere/dbPort/Convert_PostgreSQLTest.java b/base/src/org/compiere/dbPort/Convert_PostgreSQLTest.java index 3f77f53bc9..16da23ae34 100644 --- a/base/src/org/compiere/dbPort/Convert_PostgreSQLTest.java +++ b/base/src/org/compiere/dbPort/Convert_PostgreSQLTest.java @@ -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 */