IDEMPIERE-384 Problem with insertTranslations in multilanguage env caused by Generate_UUID
This commit is contained in:
parent
3a01c153d2
commit
f28f327cbe
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
;
|
|
@ -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
|
||||
;
|
|
@ -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() {
|
||||
String uuidTest = null;
|
||||
try {
|
||||
uuidTest = getSQLValueStringEx(null, "SELECT Generate_UUID() FROM Dual");
|
||||
} catch (Exception e) {}
|
||||
return uuidTest != null && uuidTest.trim().length() == 36;
|
||||
if (! m_isUUIDVerified) {
|
||||
String uuidTest = null;
|
||||
try {
|
||||
uuidTest = getSQLValueStringEx(null, "SELECT Generate_UUID() FROM Dual");
|
||||
} catch (Exception e) {}
|
||||
m_isUUIDSupported = uuidTest != null && uuidTest.trim().length() == 36;
|
||||
m_isUUIDVerified = true;
|
||||
}
|
||||
return m_isUUIDSupported;
|
||||
}
|
||||
|
||||
private static void verifyTrx(String trxName, String sql) {
|
||||
|
|
Loading…
Reference in New Issue