Project

General

Profile

Support #8050

Wt::Dbo - where changes clause

Added by Torsten Schulz 5 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/10/2021
Due date:
% Done:

0%

Estimated time:

Description

Following example is generating a different query then expected
session.query("select ""id"" from ""tbl"").where("""name"" = ?").bind("test")

Expected query:
select "id" from "tbl" where "name" = ?

Generated query:
select "id" from "tbl" where name = ?

So in where clause, the quotes get lost.

#1

Updated by Roel Standaert 5 months ago

  • Tracker changed from Bug to Support

"" is not how you escape double quotes in C++. You've just got separate string literals "select ", "id", " from ", "tbl" that are being concatenated to "select id from tbl", and "", "name" and " = ?" being concatenated to "name = ?".

You can escape the double quotes with a backslash, or use a raw string literal.

#2

Updated by Torsten Schulz 5 months ago

Roel Standaert wrote in #note-1:

You can escape the double quotes with a backslash, or use a raw string literal.

Thank you for the answer, and you're of course right that double quotes not officialy. But some compilers accept it.
But even with .where("\"name\" = ?") it is the same result. I just get where name = ?
Maybe you'll say, it doesn't matter. But for DB2 it does. In DB2 a where name='' will be changed to where NAME='', what's not working. But a where "name"='' is working.

#3

Updated by Torsten Schulz about 1 month ago

Seems to work with 4.5.0 - or I made I change in Wt I can't remember. But for me the ticket can be closed.

#4

Updated by Roel Standaert about 1 month ago

  • Status changed from New to Closed

Also available in: Atom PDF