Hi to everyone, i want ask if someone knows about a script/program to convert the .gdl (Interbase) to .sql scripts. I wrote a little script to make it but it's very very simple, and the triggers and some code from .gdl are so difficult to me. If somebody could help me, I would very thankful.
This is my script, only change a few reserved words.
PHP Code:
if test -z "$1";
then
echo "Use : gdl2sql <script.gdl>"
exit;
fi
#cp $1 $1.back
cat $1 | sed 's/define database/CREATE DATABASE/g' | sed 's/define field/CREATE DOMAIN/g' > $1.sql
cat $1.sql | sed 's/missing_value is/DEFAULT/g' | sed 's/define relation/CREATE TABLE/g' > $1.sql
cat $1.sql | sed 's/short/INT/g' | sed 's/char /CHAR/g' | sed 's/long scale -2/NUMERIC(15,2)/g' > $1.sql
cat $1.sql | sed '/security_class/d' | sed 's/date/DATE/g' > $1.sql
cat $1.sql | sed 's/valid if/CHECK/g' | sed '/query_header/d' | sed '/edit_string/d' > $1.sql
cat $1.sql | sed 's/\[/\(/g' | sed 's/\]/\)/g' | sed 's/varying/VARCHAR/g' > $1.sql
cat $1.sql | sed 's/define index/CREATE INDEX/g' | sed 's/define trigger/CREATE TRIGGER/g' > $1.sql
cat $1.sql
This is a sample code from the .gdl script
PHP Code:
/* This is a trigger */
define trigger POSTSTOREDETREL for RELATIONS_DETAIL
post store 0:
begin
for a in RELATIONS with a.relation = new.relation
modify a using
a.import = a.import + new.import;
end_modify;
end_for;
end;
/* This is a index */
define index MOVPOLMONTHYEAR for MOVEMENTS
TICKET,
MONTH,
YEAR;
/* This is a table */
define relation REINGRESO_TICKES
TICKET position 1,
DATE_TICKET position 2,
REFERENCE position 3,
CAPTURE_DATE position 4,
USER position 5;
/* This is a domain */
define field IMPORT long scale -2;