Opened 21 years ago
Last modified 16 years ago
#394 closed enhancement (fixed)
Oracle OCI, support for views.
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | minor | Keywords: | |
Cc: | Mateusz Łoskot |
Description (last modified by )
I started to use the OGR OCI driver from Mapserver, and I found some things in the driver that could be better:
As far as I can tell, the driver does not give me the posibility to specify the feature_id column name. It seems that it is hardcoded to "OGR_FID" in the driver. So I created a view in Oracle with the OGR_FID column using my unique ID, but that didn't help - the driver does not support views. So I changed the ReadTableDefinition in ogrocitablelayer.cpp so that it supports views, and voila it works.
Here is the changed code from ogrocitablelayer.cpp, ReadTableDefinition:
Original code:
nStatus = OCIDescribeAny( poSession->hSvcCtx, poSession->hError, (dvoid *) pszTable, strlen(pszTable), OCI_OTYPE_NAME, OCI_DEFAULT, OCI_PTYPE_TABLE, poSession->hDescribe ); if( poSession->Failed( nStatus, "OCIDescribeAny" ) ) return poDefn;
Changed code:
nStatus = OCIDescribeAny( poSession->hSvcCtx, poSession->hError, (dvoid *) pszTable, strlen(pszTable), OCI_OTYPE_NAME, OCI_DEFAULT, OCI_PTYPE_TABLE, poSession->hDescribe ); if( poSession->Failed( nStatus, "OCIDescribeAny" ) ) { nStatus = OCIDescribeAny( poSession->hSvcCtx, poSession->hError, (dvoid *) pszTable, strlen(pszTable), OCI_OTYPE_NAME, OCI_DEFAULT, OCI_PTYPE_VIEW, poSession->hDescribe ); if( poSession->Failed( nStatus, "OCIDescribeAny" ) ) return poDefn; }
Best regards Lars Loldrup