[gdal-dev] querry in updating attribute values using ogrdatasource

Chaitanya kumar CH chaitanya.ch at gmail.com
Thu Aug 14 09:06:57 PDT 2014


Siva,

OGR SQL dialect doesn't support updates. Use sqlite dialect. You also need
to update GDAL to version 1.10.

http://www.gdal.org/ogr_sql_sqlite.html
 On 14 Aug 2014 20:17, "SIVA RAMA KRISHNA" <s.r.kriishna at gmail.com> wrote:

> Hello,
>
> I am trying to update shape file with attribute values .I am performing
> following
>
> functionality.
>
> QFileInfo table1(_mActiveLayer); //_mActive Layer is name of file opened
> QString tablename1;
> tablename1=table1.baseName();
> reader = OGRSFDriverRegistrar::Open(_mActiveLayer.toLatin1().data(), TRUE
> );
>     if(reader==NULL)
>     {
>         exit(0);
>     }
>
>
> poLayer = reader->GetLayer(0);
> querrysatatement="UPDATE " +tablename1+" set  SAL= 500 where EMPCODE = 1"
> ;//table Name is name of the table releated to _mActiveLayer
> QByteArray bnewconn = querrysatatement.toLatin1();
> conninfonew = new char[bnewconn.length()+1];
> strcpy(conninfonew,querrysatatement.toLatin1().data());
> poLayer=reader->ExecuteSQL (conninfonew,NULL,dialect.toLatin1().data());
>
> OutPut
> syntax error in sql statement
>
> Environment:
>
> Unbuntu 12.04
>
> Gdal version -- 1.9.2
> geos version --  3.3.3
>
> Thanks in advance to all
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140814/b60d5811/attachment.html>


More information about the gdal-dev mailing list