Changes between Version 6 and Version 7 of FAQVector


Ignore:
Timestamp:
Jan 23, 2009, 7:21:10 AM (15 years ago)
Author:
Mateusz Łoskot
Comment:

How to quote SQL statement properly for ogr2ogr under Windows

Legend:

Unmodified
Added
Removed
Modified
  • FAQVector

    v6 v7  
    118118}}}
    119119
     120== How to quote command parameters for GDAL/OGR utilities in Microsoft Windows CLI ==
    120121
     122When working with Windows [http://en.wikipedia.org/wiki/Command_line_interface CLI], it's helpful to remember that quoting rules are different to those used on Unix.
     123Here is example of properly quoted SQL statement passed to [http://www.gdal.org/ogrinfo.html ogrinfo] (or [http://www.gdal.org/ogr2ogr.html ogr2ogr]) with ''-sql'' option:
     124{{{
     125ogrinfo . -sql "SELECT * FROM 'B_Major Cities 1' WHERE FID = 49"
     126}}}
    121127
     128The whole SQL statement is wrapped with '''double quotes''', but not single quotes.
     129The name of table (here it works against ESRI Shapefile in current directory, note the dot) includes spaces, so it must be wrapped with single quotes.
     130
     131For contrast, these two variants present ''incorrect'' command:
     132{{{
     133ogrinfo . -sql 'SELECT * FROM 'B_Major Cities 1' WHERE FID = 49'
     134ogrinfo . -sql 'SELECT * FROM "B_Major Cities 1" WHERE FID = 49'
     135}}}