core-jgi/sqlj/postgresql/sqlj.ddr

232 lines
11 KiB
Plaintext
Raw Normal View History

2006-11-17 10:14:06 +07:00
SQLActions[ ] = {
"BEGIN INSTALL
--CREATE SCHEMA fun;
BEGIN PostgreSQL SET search_path TO adempiere END PostgreSQL;
CREATE OR REPLACE FUNCTION adempiereVersion()
RETURNS VARCHAR
AS 'org.compiere.sqlj.Adempiere.getVersion()'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION adempiereProperties()
RETURNS VARCHAR
AS 'org.compiere.sqlj.Adempiere.getProperties()'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION adempiereProperty(p_key VARCHAR)
RETURNS VARCHAR
AS 'org.compiere.sqlj.Adempiere.getProperty(java.lang.String)'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION TRUNC(datetime TIMESTAMP WITH TIME ZONE)
RETURNS TIMESTAMP WITH TIME ZONE
AS 'org.compiere.sqlj.Adempiere.trunc(java.sql.Timestamp)'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION firstOf(datetime TIMESTAMP WITH TIME ZONE ,xx VARCHAR)
RETURNS TIMESTAMP WITH TIME ZONE
AS 'org.compiere.sqlj.Adempiere.firstOf(java.sql.Timestamp,java.lang.String)'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION daysBetween(datetime1 TIMESTAMP WITH TIME ZONE , datetime2 TIMESTAMP WITH TIME ZONE)
RETURNS INTEGER
AS 'org.compiere.sqlj.Adempiere.getDaysBetween(java.sql.Timestamp,java.sql.Timestamp)'
LANGUAGE java 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 VOLATILE;;
CREATE OR REPLACE FUNCTION charAt(source VARCHAR, pos INTEGER)
RETURNS VARCHAR
AS 'org.compiere.sqlj.Adempiere.charAt (java.lang.String,int)'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION nextID(AD_Sequence_ID INTEGER, System VARCHAR)
RETURNS INTEGER
AS 'org.compiere.sqlj.Adempiere.nextID(int,java.lang.String)'
LANGUAGE java VOLATILE;;
/** Product **/
CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID INTEGER)
RETURNS VARCHAR
AS 'org.compiere.sqlj.Product.attributeName(int)'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION bomPriceLimit (M_Product_ID INTEGER, M_PriceList_Version_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomPriceLimit(int,int)'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION bomPriceList (M_Product_ID INTEGER, M_PriceList_Version_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomPriceList(int,int)'
LANGUAGE java VOLATILE;;
CREATE OR REPLACE FUNCTION bomPriceStd (M_Product_ID INTEGER, M_PriceList_Version_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomPriceStd(int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyAvailable (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyAvailable(int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyAvailable (M_Product_ID INTEGER , M_AttributeSetInstance_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyAvailable(int,int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyOnHand (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyOnHand(int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyOnHand (M_Product_ID INTEGER, M_AttributeSetInstance_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyOnHand(int,int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyOrdered (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyOrdered(int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyOrdered (M_Product_ID INTEGER, M_AttributeSetInstance_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyOrdered(int,int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyReserved (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyReserved(int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION bomQtyReserved (M_Product_ID INTEGER, M_AttributeSetInstance_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Product.bomQtyReserved(int,int,int,int)'
LANGUAGE java VOLATILE;
/** Currency **/
CREATE OR REPLACE FUNCTION currencyBase (Amount NUMERIC, C_CurrencyFrom_ID INTEGER,
ConversionDate TIMESTAMP WITH TIME ZONE, AD_Client_ID INTEGER, AD_Org_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Currency.base(java.math.BigDecimal,int,java.sql.Timestamp,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION currencyConvert (Amount NUMERIC, C_CurrencyFrom_ID INTEGER, C_CurrencyTo_ID INTEGER,
ConversionDate TIMESTAMP WITH TIME ZONE, C_ConversionType_ID INTEGER, AD_Client_ID INTEGER, AD_Org_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Currency.convert(java.math.BigDecimal,int,int,java.sql.Timestamp,int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION currencyRate (C_CurrencyFrom_ID INTEGER, C_CurrencyTo_ID INTEGER,
ConversionDate TIMESTAMP WITH TIME ZONE, C_ConversionType_ID INTEGER, AD_Client_ID INTEGER, AD_Org_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Currency.rate(int,int,java.sql.Timestamp,int,int,int)'
LANGUAGE java VOLATILE;
/** BPartner **/
CREATE OR REPLACE FUNCTION bpartnerRemitLocation (p_C_BPartner_ID INTEGER)
RETURNS INTEGER
AS 'org.compiere.sqlj.BPartner.remitLocation(int)'
LANGUAGE java VOLATILE;
/** Invoice **/
CREATE OR REPLACE FUNCTION invoiceOpen (p_C_Invoice_ID INTEGER, p_C_InvoicePaySchedule_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Invoice.open(int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION invoicePaid (p_C_Invoice_ID INTEGER, p_C_Currency_ID INTEGER, p_MultiplierAP INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Invoice.paid(int,int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION invoiceDiscount (p_C_Invoice_ID INTEGER, p_PayDate TIMESTAMP WITH TIME ZONE, p_C_InvoicePaySchedule_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Invoice.discount(int,java.sql.Timestamp,int)'
LANGUAGE java VOLATILE;
/** Payment Term **/
CREATE OR REPLACE FUNCTION paymentTermDueDays (p_C_PaymentTerm_ID INTEGER, p_DocDate TIMESTAMP WITH TIME ZONE, p_PayDate TIMESTAMP WITH TIME ZONE)
RETURNS INTEGER
AS 'org.compiere.sqlj.PaymentTerm.dueDays(int,java.sql.Timestamp,java.sql.Timestamp)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION paymentTermDueDate (p_C_PaymentTerm_ID INTEGER, p_DocDate TIMESTAMP WITH TIME ZONE)
RETURNS TIMESTAMP WITH TIME ZONE
AS 'org.compiere.sqlj.PaymentTerm.dueDate(int,java.sql.Timestamp)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION paymentTermDiscount (p_Amount NUMERIC, p_C_PaymentTerm_ID INTEGER, p_DocDate TIMESTAMP WITH TIME ZONE, p_PayDate TIMESTAMP WITH TIME ZONE)
RETURNS NUMERIC
AS 'org.compiere.sqlj.PaymentTerm.discount(java.math.BigDecimal,int,java.sql.Timestamp,java.sql.Timestamp)'
LANGUAGE java VOLATILE;
/** Payment **/
CREATE OR REPLACE FUNCTION paymentAllocated (p_C_Payment_ID INTEGER, p_C_Currency_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Payment.allocated(int,int)'
LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION paymentAvailable (p_C_Payment_ID INTEGER)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Payment.available(int)'
LANGUAGE java VOLATILE;
/** Account **/
CREATE OR REPLACE FUNCTION acctBalance (p_Account_ID INTEGER, p_AmtDr NUMERIC, p_AmtCr NUMERIC)
RETURNS NUMERIC
AS 'org.compiere.sqlj.Account.balance(int,java.math.BigDecimal,java.math.BigDecimal)'
LANGUAGE java VOLATILE;
/** Manufacturing e-evolution **/
CREATE OR REPLACE FUNCTION documentNo (p_MPC_MRP_ID INTEGER)
RETURNS VARCHAR
AS 'org.compiere.sqlj.Manufacturing.documentNo(int)'
LANGUAGE java VOLATILE;
END INSTALL",
"BEGIN REMOVE
--DROP SCHEMA fun CASCADE;
--DROP FUNCTION adempiereVersion();
--DROP FUNCTION adempiereProperties();
--DROP FUNCTION adempiereProperty(p_key VARCHAR);
--DROP FUNCTION TRUNC(datetime TIMESTAMP WITH TIME ZONE);
--DROP FUNCTION firstOf(datetime TIMESTAMP WITH TIME ZONE ,xx VARCHAR);
--DROP FUNCTION daysBetween(datetime1 TIMESTAMP WITH TIME ZONE , datetime2 TIMESTAMP WITH TIME ZONE);
--DROP FUNCTION addDays(day TIMESTAMP WITH TIME ZONE, days INTEGER);
--DROP FUNCTION charAt(source VARCHAR, pos NUMERIC);
--DROP FUNCTION productAttribute (M_AttributeSetInstance_ID INTEGER);
--DROP FUNCTION bomPriceLimit (M_Product_ID INTEGER, M_PriceList_Version_ID INTEGER);
--DROP FUNCTION bomPriceList (M_Product_ID INTEGER, M_PriceList_Version_ID INTEGER);
--DROP FUNCTION bomPriceStd (M_Product_ID INTEGER, M_PriceList_Version_ID INTEGER);
--DROP FUNCTION bomQtyAvailable (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER);
--DROP FUNCTION bomQtyOnHand (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER);
--DROP FUNCTION bomQtyOrdered (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER);
--DROP FUNCTION bomQtyReserved (M_Product_ID INTEGER, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER);
--DROP FUNCTION currencyBase (Amount DECIMAL, C_CurrencyFrom_ID INTEGER,
ConversionDate TIMESTAMP WITH TIME ZONE, AD_Client_ID INTEGER, AD_Org_ID INTEGER);
--DROP FUNCTION currencyConvert (Amount NUMERIC, C_CurrencyFrom_ID INTEGER, C_CurrencyTo_ID INTEGER,
ConversionDate TIMESTAMP WITH TIME ZONE, C_ConversionType_ID INTEGER, AD_Client_ID NUMERIC, AD_Org_ID INTEGER);
--DROP FUNCTION currencyRate (C_CurrencyFrom_ID INTEGER, C_CurrencyTo_ID INTEGER,
ConversionDate TIMESTAMP WITH TIME ZONE, C_ConversionType_ID INTEGER, AD_Client_ID INTEGER, AD_Org_ID INTEGER);
--DROP FUNCTION bpartnerRemitLocation (p_C_BPartner_ID INTEGER);
--DROP FUNCTION invoiceOpen (p_C_Invoice_ID INTEGER, p_C_InvoicePaySchedule_ID INTEGER);
--DROP FUNCTION invoicePaid (p_C_Invoice_ID INTEGER, p_C_Currency_ID INTEGER, p_MultiplierAP NUMERIC);
--DROP FUNCTION invoiceDiscount (p_C_Invoice_ID INTEGER, p_PayDate TIMESTAMP WITH TIME ZONE, p_C_InvoicePaySchedule_ID INTEGER);
--DROP FUNCTION paymentTermDueDays (p_C_PaymentTerm_ID INTEGER, p_DocDate TIMESTAMP WITH TIME ZONE, p_PayDate TIMESTAMP WITH TIME ZONE);
--DROP FUNCTION paymentTermDiscount (p_Amount NUMERIC, p_C_PaymentTerm_ID INTEGER, p_DocDate TIMESTAMP WITH TIME ZONE, p_PayDate TIMESTAMP WITH TIME ZONE);
--DROP FUNCTION paymentAllocated (p_C_Payment_ID INTEGER, p_C_Currency_ID INTEGER);
--DROP FUNCTION paymentAvailable (p_C_Payment_ID INTEGER);
--DROP FUNCTION acctBalance (p_Account_ID INTEGER, p_AmtDr NUMERIC, p_AmtCr NUMERIC);
END REMOVE"
}