Details
-
Type:
Task
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.1.M3
-
Fix Version/s: 2.1.M4
-
Component/s: referencing
-
Labels:None
Description
EPSG primary database is in MS-Access format. The EPSG organisation (http://www.epsg.org) also provides some scripts in standard SQL for generating EPSG database on other platforms (PostgreSQL, MySQL, etc.). Unfortunatly, there is two differences:
1) SQL statements for Access required some special syntax
like the bracket for table name, as in [Coordinate Operation]
(the standard SQL syntax would be to use quotes instead of
brackets: "Coordinate Operation").
2) The table names are not the same. They are all lower-cases
in SQL scripts, with all blank removed. Furthermore, an
"epsg_" prefix were added. The example above gives something
like "epsg-coordinateoperation".
Fortunatly, it seems to be possible to modify the SQL statements in an automatic way (no need to rewrite them all). In the MS-Access EPSGFactory implementation, we made sure that all table names and only table names are between brackets. Concequently, SQL translations could be performed automatically in an automatic maner (EPSGFactory already provides a hook for that, the 'adaptSQL' method to be overriden):
public class FactoryForSQL extends EPSGFactory {
protected String adaptSQL(String sql) {
// Search for brackets.
// Inside brackets, remove spaces. Append the "epsg_"
// prefix and finally removes the brackets. Returns the
// result.
}
}
And test. Hopefully, it should work.