Sqlite version is 3.27.1.

I have no indexes defined.

Here is a query I just ran from bash:

select songfile_id,dancename,dancegroupname from songfiletable where 
songfile_id=377;
377|Waltz|American Smooth

... and another:

select songfile_id,dancename,dancegroupname from songfiletable where dancename 
like "Waltz";
377|Waltz|American Smooth
388|Waltz|American Smooth
459|Waltz|American Smooth
647|Waltz|American Smooth
827|Waltz|American Smooth
873|Waltz|American Smooth
896|Waltz|American Smooth
1156|Waltz|American Smooth
1157|Waltz|American Smooth
1158|Waltz|American Smooth
1159|Waltz|American Smooth
1160|Waltz|American Smooth
1161|Waltz|American Smooth
1162|Waltz|American Smooth
1164|Waltz|American Smooth
1167|Waltz|American Smooth

... and yet another:

select songfile_id,dancename,dancegroupname from songfiletable where dancename 
= "Waltz";
sqlite>

Nothing selected using "=".

Also a hex dump:

select songfile_id,dancename,hex(dancename),dancegroupname from songfiletable 
where songfile_id=377;
377|Waltz|57616C747A|American Smooth

Clearly what I think is in the database is there. Is there supposed to be a 
trailing null in the database for text fields that is/is not in play here?

Doug

> -----Original Message-----
> From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org>
> On Behalf Of sqlite-users-requ...@mailinglists.sqlite.org
> Sent: Tuesday, June 04, 2019 5:00 AM
> To: sqlite-users@mailinglists.sqlite.org
> Subject: sqlite-users Digest, Vol 138, Issue 4
> 
> Send sqlite-users mailing list submissions to
>       sqlite-users@mailinglists.sqlite.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>       http://mailinglists.sqlite.org/cgi-
> bin/mailman/listinfo/sqlite-users
> or, via email, send a message with subject or body 'help' to
>       sqlite-users-requ...@mailinglists.sqlite.org
> 
> You can reach the person managing the list at
>       sqlite-users-ow...@mailinglists.sqlite.org
> 
> When replying, please edit your Subject line so it is more
> specific
> than "Re: Contents of sqlite-users digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: SQLite build on Risc-V (Carlos Eduardo de Paula)
>    2. select * where abc like "xxx" works,    ...where abc='xxx'
> fails
>       (Doug)
>    3. Re: select * where abc like "xxx" works, ...where abc='xxx'
>       fails (Simon Slavin)
>    4. Re: select * where abc like "xxx" works,        ...where abc='xxx'
>       fails (Keith Medcalf)
>    5. Re: Bug in sqlite3.c (bhandari_nikhil)
> 
> 
> ------------------------------------------------------------------
> ----
> 
> Message: 1
> Date: Sun, 2 Jun 2019 11:15:35 -0300
> From: Carlos Eduardo de Paula <m...@carlosedp.com>
> To: dcla...@blastwave.org,  "sqlite-users@mailinglists.sqlite.org"
>       <sqlite-users@mailinglists.sqlite.org>
> Subject: Re: [sqlite] SQLite build on Risc-V
> Message-ID:
>       <cadnnuqdsuwmkv9hqmlzp3pdmlfmrjhzzfeb+2onebuv+ocb...@mail.gma
> il.com>
> Content-Type: text/plain; charset="UTF-8"
> 
> I'm on a SiFive Unleashed board running Debian Linux on Kernel
> 4.19.
> --
> Sent from IPhone
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 3 Jun 2019 16:46:47 -0700
> From: "Doug" <dougf....@comcast.net>
> To: <sqlite-users@mailinglists.sqlite.org>
> Subject: [sqlite] select * where abc like "xxx" works,
>       ...where
>       abc='xxx' fails
> Message-ID: <04fc01d51a66$9c94c700$d5be5500$@comcast.net>
> Content-Type: text/plain;     charset="us-ascii"
> 
> 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
> 
> 
> 
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 4 Jun 2019 00:55:45 +0100
> From: Simon Slavin <slav...@bigfraud.org>
> To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
> Subject: Re: [sqlite] select * where abc like "xxx" works,
> ...where
>       abc='xxx' fails
> Message-ID: <73ebbe3c-dbc8-4ea2-a055-e4c160899...@bigfraud.org>
> Content-Type: text/plain;     charset=us-ascii
> 
> On 4 Jun 2019, at 12:46am, Doug <dougf....@comcast.net> wrote:
> 
> > Why does the "=" query fail and the "like" query work?
> 
> To help us investigate ...
> 
> Which version of SQLite is this ?  You can use
> 
>     SELECT sqlite_version();
> 
> to find out.
> 
> What do you mean by 'work' and 'fail' ?  Are you referring to an
> error code ?
> 
> Can you add a debug line to your code so that just before applying
> the filter it outputs the same text to a log ?  Just to check
> whether '.toUtf8()' does what you think it's doing.
> 
> ------------------------------
> 
> Message: 4
> Date: Mon, 03 Jun 2019 18:33:17 -0600
> From: "Keith Medcalf" <kmedc...@dessus.com>
> To: "SQLite mailing list" <sqlite-users@mailinglists.sqlite.org>
> Subject: Re: [sqlite] select * where abc like "xxx" works,
>       ...where
>       abc='xxx' fails
> Message-ID: <7cf3a816ceb73047bbb53a18c9906...@mail.dessus.com>
> Content-Type: text/plain; charset="utf-8"
> 
> 
> >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
> 
> 
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Mon, 3 Jun 2019 22:11:48 -0700 (MST)
> From: bhandari_nikhil <bhandari_nik...@yahoo.com>
> To: sqlite-users@mailinglists.sqlite.org
> Subject: Re: [sqlite] Bug in sqlite3.c
> Message-ID: <1559625108756-0.p...@n5.nabble.com>
> Content-Type: text/plain; charset=us-ascii
> 
> Thanks Dan. I had checked the database integrity using the
> following command:
> 
> sqlite3 myfile.db "PRAGMA integrity_check;"
> 
> And it had reported ok. I will see if I can share the database
> file here.
> Can you let me know how to check the db file (in case I am not
> able to share
> the db file here) ? And how the fts5 can get corrupted ?
> 
> To run the rebuild command, the ft refers to the db name ?
> 
> BTW, I just looked at the code, not used the latest version.
> 
> 
> 
> --
> Sent from: http://sqlite.1065341.n5.nabble.com/
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
> users
> 
> 
> ------------------------------
> 
> End of sqlite-users Digest, Vol 138, Issue 4
> ********************************************

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to