On Fri, Oct 14, 2011 at 4:33 PM, mmekuria <[email protected]> wrote:
> I have made a few changes here and I do not get a valid layer in the first
> place.
>
>
>        QgsDataSourceURI splUri;
>        splUri.setDatabase(spliteDBName);  // i give the database name as a
> fully qualified path QString
>        splUri.setDataSource("","Trips", ""); // I set the schema and the
> geometry to empty? I have a table Trips in the database.

Unfortunately currently this does not work correctly for goemetryless
tables (the produced URI is malformed), therefore I advise you to
directly create URI string as mentioned in my earlier mail:

vlayer = QgsVectorLayer('dbname="/data/gis/test.sqlite"
table="mytable"', 'mytable', 'spatialite')


>        tripLayer->addFeatures(tripFeats);
>        bool blnFeat = tripLayer->commitChanges();

Here I would suggest to use directly tripProv->addFeatures( ... )
instead of using layer's addFeatures() method. This way you will
bypass layer's in-memory editing buffer and the operation will be
faster. I would like to explain the difference in the cookbook,
hopefully it will be added soon.

Martin
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to