Bug report #4911

Query Builder + MySQL syntax error

Added by bradypus - almost 13 years ago. Updated over 12 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
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 #:14718

Description

Trying to build a query on a MySQL (vector) layer an error is generated.
This is because QGis double-quotes the table name in the SQL statement, and this is generates an MySQL syntax error.
Follows an example:
Query builder entry: cat = 5 (I can manually delete double quotes from column name in query builder interface)
produces the following error:
An error occurred when executing the query.
The data provider said:
OGR3 error 1: MySQL error message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"roads" WHERE cat = 5' at line 1 Description: SELECT * FROM "roads" WHERE cat = 5

As you can see the table name (roads) is double quoted, and I can not change this.
Actually quiery builder is useless with MySQL vector and table data.

History

#1 Updated by Jürgen Fischer almost 13 years ago

  • Status changed from Open to Closed
  • Priority changed from High to Normal
  • Resolution set to fixed

fixed in 93266aca

#2 Updated by bradypus - over 12 years ago

Hello,
I just installed v 1.7.4 and I'm still having the same problem.
What does "fixed in 93266aca" mean? Where can I find in which version '93266aca' will be integrated?
Thank you

#3 Updated by Giovanni Manghi over 12 years ago

jbogdani - wrote:

Hello,
I just installed v 1.7.4 and I'm still having the same problem.
What does "fixed in 93266aca" mean? Where can I find in which version '93266aca' will be integrated?
Thank you

if you are on Windows install the "qgis-dev" package using the "osgeo4w" installer (use the "advanced install")

#4 Updated by bradypus - over 12 years ago

I'm on a MacOS!
Just updated from 1.7.3 to 1.7.4 using KyngChaos build.
I'm afraid I've to wait for 1.7.5 or 1.8....
Thank you

#5 Updated by Giovanni Manghi over 12 years ago

jbogdani - wrote:

I'm on a MacOS!
Just updated from 1.7.3 to 1.7.4 using KyngChaos build.
I'm afraid I've to wait for 1.7.5 or 1.8....
Thank you

In the KyngChaos you have also qgis-dev packages.

#6 Updated by bradypus - over 12 years ago

Giovanni Manghi wrote:

In the KyngChaos you have also qgis-dev packages.

You're right. I tried to install it but it did not work. It crashes as soon as I open it. I have to wait for e new buid :)

#7 Updated by bradypus - over 12 years ago

It's working fine now that a new dev build is released.
One have still to remove double quotes from field name, but it works!

Also available in: Atom PDF