sqlsqlitegdaldialectogr2ogr

ogrinfo issues when updating row record with sqlite dialect


I am using the following ogrinfo call to update a row record (where name is "50mn_R9_R10"):

ogrinfo tmp.shp -dialect sqlite -sql 'update tmp set iacolor=case when name="50mn_R9_10" then "amber" end'

The problem appears when I update the next record (ie. name is "50mn_R10_R11" and iacolor is 'red') because it deletes the previous updated row record (ie. 'amber' is deleted where name is "50mn_R9_R10"):

ogrinfo tmp.shp -dialect sqlite -sql 'update tmp set iacolor=case when name="50mn_R10_11" then "red" end'

What am I doing wrong here? Any hints are much appreciated.


Solution

  • Thanks to @jarlh, the right ogrinfo call is as follows:

    ogrinfo tmp.shp -dialect sqlite -sql 'update tmp set iacolor="amber" where name="50mn_R9_10"'
    

    So, other row records can be updated programmatically once the desired field (in this case "iacolor") is changed based on another field (in this case "name").