First we need to open a connection to the FairCom Database Engine.
Below is the code for Initialize():
SET ECHO OFF
-- Initialize
ECHO INIT;
SET AUTOCOMMIT OFF;
IF EXISTS (select proc_name from sysprocedures where proc_name = 'define')
BEGIN
DROP PROCEDURE Define;
END
IF EXISTS (select proc_name from sysprocedures where proc_name = 'add_customermaster_record')
BEGIN
DROP PROCEDURE Add_CustomerMaster_Record;
END
IF EXISTS (select proc_name from sysprocedures where proc_name = 'add_customerorders_record')
BEGIN
DROP PROCEDURE Add_CustomerOrders_Record;
END
IF EXISTS (select proc_name from sysprocedures where proc_name = 'add_orderitems_record')
BEGIN
DROP PROCEDURE Add_OrderItems_Record;
END
IF EXISTS (select proc_name from sysprocedures where proc_name = 'add_itemmaster_record')
BEGIN
DROP PROCEDURE Add_ItemMaster_Record;
END
IF EXISTS (select proc_name from sysprocedures where proc_name = 'delete_records')
BEGIN
DROP PROCEDURE Delete_Records;
END
IF EXISTS (select triggername from systrigger where triggername = 'validate_customerorders_record')
BEGIN
DROP TRIGGER Validate_CustomerOrders_Record;
END
IF EXISTS (select triggername from systrigger where triggername = 'validate_orderitems_record')
BEGIN
DROP TRIGGER Validate_OrderItems_Record;
END
IF EXISTS (select tbl from systables where tbl = 'ordritem')
BEGIN
DROP TABLE ordritem;
END
IF EXISTS (select tbl from systables where tbl = 'custordr')
BEGIN
DROP TABLE custordr;
END
IF EXISTS (select tbl from systables where tbl = 'itemmast')
BEGIN
DROP TABLE itemmast;
END
IF EXISTS (select tbl from systables where tbl = 'custmast')
BEGIN
DROP TABLE custmast;
END