Project

General

Profile

Actions

Support #8050

closed
TS

Wt::Dbo - where changes clause

Support #8050: Wt::Dbo - where changes clause

Added by Torsten Schulz over 5 years ago. Updated about 5 years 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.

RS Updated by Roel Standaert over 5 years ago Actions #1

  • 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.

TS Updated by Torsten Schulz over 5 years ago Actions #2

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.

TS Updated by Torsten Schulz about 5 years ago Actions #3

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.

RS Updated by Roel Standaert about 5 years ago Actions #4

  • Status changed from New to Closed
Actions

Also available in: PDF Atom