>Why does the "=" query fail and the "like" query work? There are no
>wildcards involved.
>The behavior is the same in Sqlite command line. There are no
>wildcards involved.
sqlite> create table songfiletable (
...> songfile_id integer primary key,
...> dancename text
...> );
sqlite> insert into songfiletable (dancename) values ('Waltz');
sqlite> select * from songfiletable where dancename like 'Waltz';
1|Waltz
sqlite> select * from songfiletable where dancename = 'Waltz';
1|Waltz
Works for me. Perhaps your database does not contain what you believe it does
... or you have some indexes on dancename that you are not disclosing
---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a
lot about anticipated traffic volume.
>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Doug
>Sent: Monday, 3 June, 2019 17:47
>To: sqlite-users@mailinglists.sqlite.org
>Subject: [sqlite] select * where abc like "xxx" works, ...where
>abc='xxx' fails
>
>I am using Sqlite under QT 5.12.0.
>
>
>
>
>
>
>I create the table this way:
>
>
>
>QString sqlcreate = QLatin1String(
>
> "CREATE TABLE songfiletable ("
>
>"songfile_id INTEGER PRIMARY KEY,"
>
>"dancename TEXT"
>
> ");" );
>
>
>
>I populated the table this way with dancename=QLatin1String("Waltz"):
>
>
>
>QString sqlinsert = QLatin1String(
>
>"INSERT INTO songfiletable ("
>
>"dancename"
>
>") VALUES(?);");
>
> queryinsert.prepare(sqlinsert);
>
> queryinsert.addBindValue(dancename.toUtf8());
>
>
>
>The query that works for dancename="Waltz" is this (with 'like'):
>
>QByteArray dn = d->dance_name.toUtf8();
>
>QByteArray filter = "(dancename like '" + dn + "')";
>
>
>
>The query that fails for dancename="Waltz" is this:
>
>QByteArray dn = d->dance_name.toUtf8();
>
>QByteArray filter = "(dancename='" + dn + "')";
>
>
>
>
>
>
>I have simplified the table and the queries to a single column for
>this message. The actual table has 22 columns.
>
>
>
>Why does the "=" query fail and the "like" query work?
>
>
>
>Regards, Doug
>
>
>
>
>
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users