• Incomplete sqlite query output

    From Luc@21:1/5 to All on Sun Dec 10 02:08:18 2023
    I am running this query on an sqlite database using an application called
    DB Browser for SQLite:

    SELECT tg FROM master WHERE sc like 'Bingo!';

    I get 9 lines of output:

    "Win!"
    "Jackpot!"
    "Jackpot!"
    "Jackpot!"
    "Jackpot!"
    "Got it!"
    "Jackpot!"
    "Jackpot!"
    "Win!"

    But in my Tcl code, I get this:

    sqlDB eval "SELECT tg FROM master WHERE sc like '$searchstring';" {
    if {$tg != ""} {lappend ::cleanlist [string trim $tg]; puts "master $tg"}
    }

    master Jackpot!
    master Jackpot!
    master Jackpot!
    master Jackpot!

    Of course there is a lot more code around it, but it is around it and
    the puts command is right where it is. There is nothing in between that
    could interfere with the output.

    I thought that maybe some invisible space or something very subtle
    could be filtering out some of the results, but the exact same query
    gives 5 more lines of output in DB Browser for SQLite.

    Why are all the other results missing when I use Tcl?

    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Luc on Sun Dec 10 05:17:24 2023
    Luc <luc@sep.invalid> wrote:
    sqlDB eval "SELECT tg FROM master WHERE sc like '$searchstring';" {
    if {$tg != ""} {lappend ::cleanlist [string trim $tg]; puts "master $tg"}
    }

    What is the exact contents of $searchstring just before this statement
    is executed?

    Why are all the other results missing when I use Tcl?

    Unknown, although one possibility is that the 'browser' app and your
    Tcl code are opening different sqlite datafiles that contain differing
    data.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to Rich on Sun Dec 10 15:27:08 2023
    On Sun, 10 Dec 2023 05:17:24 -0000 (UTC), Rich wrote:

    Luc <luc@sep.invalid> wrote:
    sqlDB eval "SELECT tg FROM master WHERE sc like '$searchstring';" {
    if {$tg != ""} {lappend ::cleanlist [string trim $tg]; puts
    "master $tg"} }

    What is the exact contents of $searchstring just before this statement
    is executed?

    Why are all the other results missing when I use Tcl?

    Unknown, although one possibility is that the 'browser' app and your
    Tcl code are opening different sqlite datafiles that contain differing
    data.
    **************************

    It was my mistake and I apologize.

    After some hours of much needed sleep and a new analysis, I discovered
    that one side was querying "Bingo!" while the other was actually querying
    "- Bingo!"

    The dash may or may not be present in many lines.

    I decided to run two queries every time. The second one parses the
    first one to detect the first alpha character and discard everything
    before it. I collect from both queries. It's a good stopgap for now.

    I will look into using the sqlite regex function to cover a wider range
    of possibilities.

    Thank you again and sorry for the trouble.

    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)