Workaround to prevent table abbreviations from compiling

Posted by cverbiest on 18-Nov-2014 03:07

Unfortunately OpenEdge does not have an option to prevent table abbreviations.

In our development environment I've set up following workaround to prevent table abbreviations.

1. Create an extra database, I called it NONUNIQ

2. Add a table for each table in the real database, append an underscore to the filename

3. Connect the extra database in the development enviroment

From now on all abbreviated table references cause a compile error because they have become ambiguous due to the extra table in the nonuniq database.

I used following piece of code to create a df for the nonuniq db.

&scoped db DBNAME
def stream sdf.

output stream sdf to nonuniq.df.

for each {&db}._file where not {&db}._file._file-name begins "_" and {&db}._file._owner = "pub":
    run AddTable({&db}._file._file-name).
end.
output stream sdf close.


procedure AddTable:
def input param itable as char.
put stream sdf unformatted

subst('ADD TABLE "&1_"', itable) skip(2).

end procedure.


All Replies

Posted by Mike Fechner on 18-Nov-2014 03:12
Hi Carl,
 
great trick! I think I’ll add this ASAP to our integration tests on Jenkins.
 
See you at #PUGChallenge
 
Mike
Von: cverbiest [mailto:bounce-cverbiest@community.progress.com]
Gesendet: Dienstag, 18. November 2014 10:08
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] Workaround to prevent table abbreviations from compiling
 
Thread created by cverbiest

Unfortunately OpenEdge does not have an option to prevent table abbreviations.

In our development environment I've set up following workaround to prevent table abbreviations.

1. Create an extra database, I called it NONUNIQ

2. Add a table for each table in the real database, append an underscore to the filename

3. Connect the extra database in the development enviroment

From now on all abbreviated table references cause a compile error because they have become ambiguous due to the extra table in the nonuniq database.

I used following piece of code to create a df for the nonuniq db.

&scoped db DBNAME
def stream sdf.
 
output stream sdf to nonuniq.df.
 
for each {&db}._file where not {&db}._file._file-name begins "_" and {&db}._file._owner = "pub":
    run AddTable({&db}._file._file-name).
end.
output stream sdf close.
 
 
procedure AddTable:
def input param itable as char.
put stream sdf unformatted
 
subst('ADD TABLE "&1_"', itable) skip(2).
 
end procedure.

 

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by Lieven De Foor on 18-Nov-2014 04:58

Nice one!

This thread is closed