[Qgis-developer] about ogr provider

Marco Hugentobler marco.hugentobler at karto.baug.ethz.ch
Mon Aug 13 11:10:25 EDT 2007

Hi Godofredo,

It's nice to see the progresses with the ogr database plugin!

> The ogr plugin uses a visual form to connect to
> the dataset and show a list of    available layers in the dataset, the user
> selects one and then the connection string    is sended to ogr provider
> constructor via qgis interface          mIface->addVectorLayer(URI ,
> layername, "ogr");    but only the URI is passed to ogr provider
> constructor.could it be possible to add an alternate constructor to ogr
> provider that gets URI and layernameso we could do a simple test for "PG:",
> "MYSQL:" and "OCI:" in URI and if true, use the layernameparameter?

Would it be possible that you somehow extend the URI string with the table 
name? E.g.: 'MYSQL:dbname,user=username,password=secret,table=roads' or 
similar? In the ogr provider class, you could then analyse the string and 
change it to strings that OGR understands. 

In my opinion it is better to stay with the constructor of 
QgsVectorDataProvider that takes only one string. The advantage of this is 
that you are compatible with the interface of the other providers. Is this 
possible for the ogr database plugin or did I overlook something?


Dr. Marco Hugentobler
Institute of Cartography
ETH Zurich
Technical Advisor QGIS Project Steering Committee
marco.hugentobler at karto.baug.ethz.ch

More information about the Qgis-developer mailing list