Bug report #2766

Query failed if field value contains apostrophe

Added by dr - over 14 years ago. Updated over 12 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:12826

Description

For example: instead "nam" = 'ARKHANGEL'SKAYA OBLAST_ I need to print manually "nam" = 'ARKHANGEL\\'SKAYA OBLAST\\_. Is it possible escaping this symbols automatically?

Associated revisions

History

#1 Updated by Martin Dobias over 14 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

fixed in fdecdf92 (SVN r13756) - query builder now escapes the single quotes.

#2 Updated by maning sambale over 12 years ago

  • Affected QGIS version set to master
  • Crashes QGIS or corrupts data set to No

Still getting SQL errors from query builder and attribute table search using QGIS 1.7.4 windows.

#3 Updated by Giovanni Manghi over 12 years ago

  • Pull Request or Patch supplied set to No
  • Assignee deleted (nobody -)

maning sambale wrote:

Still getting SQL errors from query builder and attribute table search using QGIS 1.7.4 windows.

it works fine here, what is the expression that fails?

#4 Updated by maning sambale over 12 years ago

Giovanni Manghi wrote:

maning sambale wrote:

Still getting SQL errors from query builder and attribute table search using QGIS 1.7.4 windows.

it works fine here, what is the expression that fails?

Something like below:
"NAME_2" = 'T'boli'

I'm using 1.7 now on a mac with the same error we also saw this error on 1.7.4 windows.

#5 Updated by Giovanni Manghi over 12 years ago

  • Status changed from Closed to Reopened
  • Resolution deleted (fixed)
  • Status info deleted (0)
  • Operating System deleted (All)
  • Target version changed from Version 1.5.0 to 35
  • Priority changed from Low to Normal

Something like below:
"NAME_2" = 'T'boli'

I'm using 1.7 now on a mac with the same error we also saw this error on 1.7.4 windows.

Confirmed, the above expression fails on both qgis 1.7.4 and master. Manually escaping the single quote ("NAME_2" = 'T\\'boli') it works. Message is:

An error occurred when executing the query.
The data provider said:
OGR[3] error 1: SQL: Syntax error, 2 extra tokens

#6 Updated by Jürgen Fischer over 12 years ago

  • Status changed from Reopened to Closed

#7 Updated by Giovanni Manghi over 12 years ago

  • Target version changed from 35 to Version 1.8.0

#8 Updated by Jürgen Fischer over 12 years ago

  • Resolution set to fixed

Also available in: Atom PDF