1.. _rfc-42:
2
3=======================================================================================
4RFC 42: OGR Layer laundered field lookup
5=======================================================================================
6
7Author: Jürgen Fischer
8
9Contact: jef at norbit dot de
10
11Summary
12-------
13
14This (mini)RFC proposes a new method in the OGR layer class (and a C
15API) to lookup the field index of fields, whose names have been altered
16by drivers (eg. by LAUNDER in OCI or Pg).
17
18Implementation
19--------------
20
21There is already a pull request on github
22(`https://github.com/OSGeo/gdal/pull/23 <https://github.com/OSGeo/gdal/pull/23>`__)
23that implements this RFC. It adds the virtual method
24OGRLayer::FindFieldIndex(), that implements the usual mapping, which can
25be overloaded by drivers. The OCI driver does this to optionally return
26the index of the LAUNDERed field in case the original field does not
27exists. The pull request also modifies ogr2ogr to make use of that
28method and offers a switch -relaxedFieldNameMatch to enable it.
29
30Background
31----------
32
33This is a particular problem when using NAS as that usually operates on
34a pre-existing schema. This schema had to be adapted for Oracle as
35Oracle has a identifier length restrictions that quite a number of
36identifiers in NAS exceed. Hence ogr2ogr failed to make the mapping
37between the short names and their long counter parts and leaves those
38fields empty.
39
40References
41----------
42
43-  `https://github.com/OSGeo/gdal/pull/23 <https://github.com/OSGeo/gdal/pull/23>`__
44-  PostgreSQL NAS schema:
45   `http://trac.wheregroup.com/PostNAS/browser/trunk/import/alkis_PostNAS_schema.sql <http://trac.wheregroup.com/PostNAS/browser/trunk/import/alkis_PostNAS_schema.sql>`__
46-  Oracle NAS schema:
47   `http://trac.wheregroup.com/PostNAS/browser/trunk/import/alkis_PostNAS_ORACLE_schema.sql <http://trac.wheregroup.com/PostNAS/browser/trunk/import/alkis_PostNAS_ORACLE_schema.sql>`__
48-  conversion script from Pg to OCI:
49   `http://trac.wheregroup.com/PostNAS/browser/trunk/import/pg-to-oci.pl <http://trac.wheregroup.com/PostNAS/browser/trunk/import/pg-to-oci.pl>`__
50
51Voting history
52--------------
53
54+1 from DanielM, EvenR, FrankW, TamasS, JukkaR and jef
55
56Commits
57-------
58
59r26572 & r26573
60