SQLite functionality different on new installation?

Clovertech Forums Cloverleaf SQLite functionality different on new installation?

  • Creator
    Topic
  • #119150
    Mike Strout
    Participant

      I’ve been using tcl procs to pull data out of SQLite for years and usually used a pattern like this…

      set db [file join “/pathToDB” “dbFileName”]
      sqlite DBCMD $db
      DBCMD timeout 10000</p>
      set query “select field1, field2 from table where primaryKey = ‘$someValue'”
      catch {DBCMD eval $query } err
      if { [ string length $field1 ] } { do something }
      if { [ string length $field2 ] } { do something }

      This has worked for literally millions of queries without a problem and is the recommended method in Max Drown’s great post here on CloverTech titled “Basic Tutorial for Using SQLite With Cloverleaf”. On Friday when I tried this on a new AIX box running 19.1, I couldn’t get any output from the DB even though I know there was data in the DB. If I executed they exact same query interactively from within sqlite3, I would get results.

      I finally launched hcitcl and entered each line of my tclproc interactively and confirmed that DBCMD was  not populating $field1 and $field2. The solution was to do the following…

      catch {set results [DBCMD eval $query] } err
      set field1 [ lindex $results 0 ]
      set field2 [ lindex $results 1 ]
      #do something with $field1 and $field2

      …or when querying for a single column, doing the following…

      catch {set field1 [DBCMD onecolumn $query] } err
      #do something with $field1

      I am fine with the change if this is the new way of doing things, but if it is caused by a server or Cloverleaf configuration that could get switched back to the old way at some point, it will likely break my code. Any idea what is causing this change?

      Mike Strout

      • This topic was modified 3 years, 3 months ago by Mike Strout.
      • This topic was modified 3 years, 3 months ago by Mike Strout.
    • You must be logged in to reply to this topic.