I have a system developed in Delphi 7 already stable using the Firebird database, and some clients have requested that they can use Postgres as a database on that same system.
As in some SELECT'S, my system uses some reserved Firebird words, I decided to create an intermediate component that at run time, change these words, or change the syntax so the system continues to function, as it is today with Firebird.
However, I would like to know if there is any framework, component or even DLL that does this. So I do not have to reinvent the wheel, studying both syntaxes of each one and creating checks for it. Preferably in Delphi 7 (being DLL, it may be higher).
Example:
--FIREBIRD
EXECUTE BLOCK
AS
BEGIN
IF
( EXISTS
( SELECT 1 FROM TB_FNC_SEC
WHERE FD_FNC = 1
AND FD_SEC = 'LOC'
AND FD_KEY = 'FD_FNC'
)
) THEN
UPDATE TB_FNC_SEC SET
FD_VAL = '0'
WHERE FD_FNC = 1
AND FD_SEC = 'LOC'
AND FD_KEY = 'FD_FNC';
ELSE
INSERT INTO TB_FNC_SEC (
FD_FNC,FD_SEC,FD_KEY,FD_VAL
) VALUES (
1,'LOC','FD_FNC','0') ;
END
--POSTGRES
DO
$$ --INICIO
BEGIN
IF
( EXISTS
( SELECT 1 FROM TB_FNC_SEC
WHERE FD_FNC = 1
AND FD_SEC = 'LOC'
AND FD_KEY = 'FD_FNC'
)
) THEN
UPDATE TB_FNC_SEC SET
FD_VAL = '0'
WHERE FD_FNC = 1
AND FD_SEC = 'LOC'
AND FD_KEY = 'FD_FNC';
ELSE
INSERT INTO TB_FNC_SEC (
FD_FNC, FD_SEC, FD_KEY,FD_VAL
) VALUES (
1, 'LOC','FD_FNC','0') ;
$$
Thanks for the help right away.