[mapserver-users] Oracle Layer: how to set context prior to fetching the data

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu Mar 24 06:16:18 PDT 2016


Hi Martin,

Have you tried using a virtual spatial layer (.ovf) file to manage this? 
  You can include a "<SrcSQL>" tag to run your stored procedure.  See 
examples at http://mapserver.org/input/vector/VirtualSpatialData.html 
More details of that driver at: http://www.gdal.org/drv_vrt.html

Otherwise, I have seen others on this mailing list use stored procedures 
in the DATA statement of the mapfile, such as:

DATA "the_geom from (select the_geom, id, name, myprocedure() as style 
from states) as foo using srid=4326 using unique id"

Maybe the ovf is the way to go for your case, not sure.

-jeff

-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




On 2016-03-24 6:59 AM, Martin Icking wrote:
> One of the Oracle based sources we are publishing is using Oracle context
> variables to enable Oracle's fine grained access control.
> So we are in the need to set these context variables (e.g. current username)
> prior to doing the select defined by MapServer's DATA statement. In other
> applications we do that by calling a set_context (...) stored procedure
> prior to any data requests.
> Is there any possibility in MapServer to send a pre-request statement to the
> database? A current work-around is to set the context at logon time but that
> means that we need a new logon for every request that needs a different user
> context, not optimal for websites with many users. We'd prefer to have a
> single logon that can be re-used for all requests.
> If there is currently no way to handle this in MapServer we'd like to extend
> the Oracle layer's capabilities. Any suggestion by the MS developers on
> where we should place the needed extension in the mapfile (e.g. adding an
> additional keyword at the USING part of the data statement or using new
> layer metadata)?
> Any interest in generalizing this approach?
>
> Tx
> Martin
>



More information about the mapserver-users mailing list