Project

General

Profile

Support #3752

using where on the find() method in order to query database generate lower case query

Added by Hanan Natan over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
02/03/2015
Due date:
% Done:

0%

Estimated time:

Description

When i describe the database columns in the Wt::Dbo::field i am using a camel case like this:

Wt::Dbo::field(a, Test, "Test");

but when i query the database like this:

find().where("Test = ?").bind("hello");

i get an exception that says that the column name test doesn't exists (you can see that the column name is lowercase).

When i change the column name to lowercase it works.

So the but seems to be in the find<>().where() method where it lowercase the query string.

#1

Updated by Koen Deforche over 7 years ago

  • Tracker changed from Bug to Support
  • Status changed from New to Resolved

SQL is case-sensitive only when you put column names between quotes. Wt::Dbo will use column names between quotes to make sure that it works, even if they collide with SQL keywords.

The draw-back is that you need to use quotes if your column names aren't all lower-case: .where("\"Test\\" = ?\")

Koen

#2

Updated by Koen Deforche over 7 years ago

  • Assignee set to Koen Deforche
#3

Updated by Koen Deforche over 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF