Skip to content

BUG in collate() function #1517

@siren186

Description

@siren186

student 表如下:

name age
XiaoMing 18
XiaoHong 19
DongDong 20

我用 SQL 查询没问题:SELECT name FROM student WHERE name IS 'xiaoming' COLLATE NOCASE
但我用 WCDB 查询的时候,返回空。代码如下:

int main()
{
    WCDB::Database db("E:\\test.db");

    // SELECT name FROM student WHERE name IS 'xiaoming' COLLATE NOCASE
    auto stmt = WCDB::StatementSelect()
        .select(WCDB::Column("name"))
        .from("student")
        .where(WCDB::Column("name").is("xiaoming").collate("NOCASE"));

    auto val = db.getValueFromStatement(stmt);
    if (val.hasValue())
    {
        std::cout << "success";
    }
    else
    {
        std::cout << "not found"; // 代码会执行到这里,打印 not found
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions