* Replace some sqlj function with pl/pgsql version.
This commit is contained in:
parent
b0e6e1552a
commit
e532181e97
|
@ -49,7 +49,7 @@
|
||||||
</condition>
|
</condition>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="install-pljava" depends="setupInit" unless="isWindows"
|
<target name="install-pljava" depends="setupInit" unless="isWindows"
|
||||||
description="Non Windows Setup" >
|
description="Non Windows Setup" >
|
||||||
<echo message="----- Loading PLJAVa to Linux " />
|
<echo message="----- Loading PLJAVa to Linux " />
|
||||||
<ant antfile="build-pljava.xml" target="init" />
|
<ant antfile="build-pljava.xml" target="init" />
|
||||||
|
@ -74,7 +74,25 @@
|
||||||
<param name="file.name" value="${basedir}/load_sqlj_functions.sql" />
|
<param name="file.name" value="${basedir}/load_sqlj_functions.sql" />
|
||||||
</antcall>
|
</antcall>
|
||||||
<antcall target="load">
|
<antcall target="load">
|
||||||
<param name="file.name" value="${basedir}/init.sql" />
|
<param name="file.name" value="${basedir}/functions/getDate.sql" />
|
||||||
|
</antcall>
|
||||||
|
<antcall target="load">
|
||||||
|
<param name="file.name" value="${basedir}/functions/charAt.sql" />
|
||||||
|
</antcall>
|
||||||
|
<antcall target="load">
|
||||||
|
<param name="file.name" value="${basedir}/functions/firstOf.sql" />
|
||||||
|
</antcall>
|
||||||
|
<antcall target="load">
|
||||||
|
<param name="file.name" value="${basedir}/functions/addDays.sql" />
|
||||||
|
</antcall>
|
||||||
|
<antcall target="load">
|
||||||
|
<param name="file.name" value="${basedir}/functions/daysBetween.sql" />
|
||||||
|
</antcall>
|
||||||
|
<antcall target="load">
|
||||||
|
<param name="file.name" value="${basedir}/functions/trunc.sql" />
|
||||||
|
</antcall>
|
||||||
|
<antcall target="load">
|
||||||
|
<param name="file.name" value="${basedir}/operators.sql" />
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
/** Change Numeric for Integer */
|
|
||||||
CREATE OR REPLACE FUNCTION adempiere.ID (record NUMERIC)
|
|
||||||
RETURNS INTEGER AS $$
|
|
||||||
DECLARE
|
|
||||||
ID integer := 0;
|
|
||||||
BEGIN
|
|
||||||
ID := CAST(record AS INTEGER);
|
|
||||||
--RAISE NOTICE 'Quantity here is %', ID;
|
|
||||||
RETURN ID;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql VOLATILE;
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION adempiere.getdate()
|
|
||||||
RETURNS TIMESTAMP WITH TIME ZONE AS $$
|
|
||||||
BEGIN
|
|
||||||
RETURN now();
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql VOLATILE;
|
|
||||||
|
|
||||||
/**TIMESTAMP WITH TIME ZONE **/
|
|
||||||
CREATE OR REPLACE FUNCTION adempiere.addDays (day TIMESTAMP WITH TIME ZONE, days DECIMAL)
|
|
||||||
RETURNS TIMESTAMP WITH TIME ZONE AS $$
|
|
||||||
BEGIN
|
|
||||||
RETURN adempiere.addDays(day,adempiere.ID(days));
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql VOLATILE;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION adempiere.subtractdays (day TIMESTAMP WITH TIME ZONE, days DECIMAL)
|
|
||||||
RETURNS TIMESTAMP WITH TIME ZONE AS $$
|
|
||||||
BEGIN
|
|
||||||
RETURN adempiere.addDays(day,adempiere.ID(days * -1));
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql VOLATILE;
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION adddays("day" timestamp with time zone, days integer) RETURNS timestamp with time zone
|
|
||||||
AS $$org.compiere.sqlj.Adempiere.addDays(java.sql.Timestamp,int)$$
|
|
||||||
LANGUAGE java;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION adempiere.subtractdays (day TIMESTAMP WITH TIME ZONE, days INTEGER)
|
|
||||||
RETURNS TIMESTAMP WITH TIME ZONE AS $$
|
|
||||||
BEGIN
|
|
||||||
RETURN adempiere.addDays(day,days * -1);
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql VOLATILE;
|
|
||||||
|
|
||||||
DROP OPERATOR adempiere.+ (timestamptz, INTEGER);
|
|
||||||
CREATE OPERATOR adempiere.+ ( PROCEDURE = adempiere.adddays,
|
|
||||||
LEFTARG = TIMESTAMPTZ, RIGHTARG = INTEGER,
|
|
||||||
COMMUTATOR = +);
|
|
||||||
|
|
||||||
DROP OPERATOR adempiere.- (timestamptz, INTEGER);
|
|
||||||
CREATE OPERATOR adempiere.- ( PROCEDURE = adempiere.subtractdays,
|
|
||||||
LEFTARG = TIMESTAMPTZ, RIGHTARG = INTEGER,
|
|
||||||
COMMUTATOR = -);
|
|
||||||
|
|
||||||
DROP OPERATOR adempiere.+ (timestamptz, NUMERIC);
|
|
||||||
CREATE OPERATOR adempiere.+ ( PROCEDURE = adempiere.adddays,
|
|
||||||
LEFTARG = TIMESTAMPTZ, RIGHTARG = NUMERIC,
|
|
||||||
COMMUTATOR = +);
|
|
||||||
|
|
||||||
DROP OPERATOR adempiere.- (timestamptz, NUMERIC);
|
|
||||||
CREATE OPERATOR adempiere.- ( PROCEDURE = adempiere.subtractdays,
|
|
||||||
LEFTARG = TIMESTAMPTZ, RIGHTARG = NUMERIC,
|
|
||||||
COMMUTATOR = -);
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
DROP OPERATOR + (timestamptz, NUMERIC);
|
||||||
|
CREATE OPERATOR + ( PROCEDURE = adddays,
|
||||||
|
LEFTARG = TIMESTAMPTZ, RIGHTARG = NUMERIC,
|
||||||
|
COMMUTATOR = +);
|
||||||
|
|
||||||
|
DROP OPERATOR - (timestamptz, NUMERIC);
|
||||||
|
CREATE OPERATOR - ( PROCEDURE = subtractdays,
|
||||||
|
LEFTARG = TIMESTAMPTZ, RIGHTARG = NUMERIC,
|
||||||
|
COMMUTATOR = -);
|
Loading…
Reference in New Issue