[Qgis-developer] about ogr provider
frdcn at hotmail.com
Mon Aug 13 21:11:32 EDT 2007
> 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.
Yes, it is possible. I made a test with a similar
approach and it seems to work with mysql and
postgres. This approach needs only small changes
to the actual constructor.
> From: marco.hugentobler at karto.baug.ethz.ch> To: frdcn at hotmail.com> Subject: Re: [Qgis-developer] about ogr provider> Date: Mon, 13 Aug 2007 17:10:25 +0200> CC: qgis-developer at lists.qgis.org> > 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?> > > Regards,> Marco> > -- > Dr. Marco Hugentobler> Institute of Cartography> ETH Zurich> Technical Advisor QGIS Project Steering Committee> marco.hugentobler at karto.baug.ethz.ch
Learn. Laugh. Share. Reallivemoms is right place!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer