I am using Sqlite under QT 5.12.0. 

 

Why does the "=" query fail and the "like" query work? There are no
wildcards involved.

 

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 + "')";

 

The behavior is the same in Sqlite command line. There are no
wildcards involved.

 

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

Reply via email to