IDEMPIERE-384 Problem with insertTranslations in multilanguage env caused by Generate_UUID

This commit is contained in:
Carlos Ruiz 2012-08-10 16:54:44 -05:00
parent 3a01c153d2
commit f28f327cbe
4 changed files with 37 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/*
*This file is part of Adempiere ERP Bazaar
*http://www.adempiere.org
*This file is part of iDempiere ERP
*http://www.idempiere.org
*
*This program is free software; you can redistribute it and/or
*modify it under the terms of the GNU General Public License
@ -22,5 +22,5 @@ RETURNS char(36) AS $$
BEGIN
return uuid_generate_v4()::char(36);
END;
$$ LANGUAGE plpgsql IMMUTABLE STRICT;
$$ LANGUAGE plpgsql;

View File

@ -0,0 +1,10 @@
-- IDEMPIERE-384 Problem with insertTranslations in multilanguage env caused by Generate_UUID
-- just for postgresql
UPDATE AD_System
SET LastMigrationScriptApplied='874_IDEMPIERE-384.sql'
WHERE LastMigrationScriptApplied<'874_IDEMPIERE-384.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,13 @@
-- IDEMPIERE-384 Problem with insertTranslations in multilanguage env caused by Generate_UUID
CREATE OR REPLACE FUNCTION generate_uuid()
RETURNS char(36) AS $$
BEGIN
return uuid_generate_v4()::char(36);
END;
$$ LANGUAGE plpgsql;
UPDATE AD_System
SET LastMigrationScriptApplied='874_IDEMPIERE-384.sql'
WHERE LastMigrationScriptApplied<'874_IDEMPIERE-384.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -2358,16 +2358,22 @@ public final class DB
}
}
private static boolean m_isUUIDVerified = false;
private static boolean m_isUUIDSupported = false;
/***
* @return true if current db have working generate_uuid function. generate_uuid doesn't work on 64 bit postgresql
* on windows yet.
*/
public static boolean isGenerateUUIDSupported() {
if (! m_isUUIDVerified) {
String uuidTest = null;
try {
uuidTest = getSQLValueStringEx(null, "SELECT Generate_UUID() FROM Dual");
} catch (Exception e) {}
return uuidTest != null && uuidTest.trim().length() == 36;
m_isUUIDSupported = uuidTest != null && uuidTest.trim().length() == 36;
m_isUUIDVerified = true;
}
return m_isUUIDSupported;
}
private static void verifyTrx(String trxName, String sql) {