Thanks Martin for the info. Now how what are the parameters for the 
If I have a table named Trips and I want to add data to the three columns
i,j,v it contains. 
I set the datasource as like this? But I get error message when I try to
query the fields from the provider. 

        QgsDataSource uri;
        QgsDataSourceURI splUri = QgsDataSourceURI( uri );
        splUri.setDatabase(spliteDBName);
        splUri.setDataSource("","Trips", ""); // I set the schema and the
geometry to empty? 
        QgsVectorLayer* tripLayer = new QgsVectorLayer(splUri.uri(), "Trips",
"spatialite");
        QgsVectorDataProvider* triProv = tripLayer->dataProvider();
        QgsFeature tripFeat;
        QgsFeatureList tripFeats ;
        QgsAttributeMap tripAttMaps;
        QgsFieldMap tripFldsrc = triProv->fields();  ***************  Error at 
this
location!
        if (tripFldsrc.count()>0)
        {
                i=0;
                for (QgsFieldMap::iterator it = tripFldsrc.begin(); it !=
tripFldsrc.end();it++)
                {
                        tripAttMaps.insert(i++,it->type());
                }

        }
        for (maptrit = maptrip.begin();maptrit != maptrip.end();maptrit++)
        {
                trip = maptrit->second;
                tripFeat.addAttribute(0,trip.get_i());
                tripFeat.addAttribute(1,trip.get_j());
                tripFeat.addAttribute(2,trip.get_v());
                tripFeats.append(tripFeat);
        }
        tripLayer->addFeatures(tripFeats);
        bool blnFeat = tripLayer->commitChanges();
        if (!blnFeat)
        {
                txtStream<<"Failed to commit to Layer
\t"<<tripLayer->name().toStdString()<<endl;
                return;
        }


I also wanted to know if it was possible to string the sql commands to
insert into the table.

Thank you,

Maaza


--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Load-SQLite-table-into-QGIS-tp6876536p6893672.html
Sent from the qgis-developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to