Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

querying sqlite3 database

Featured Replies

Have been investigating alternative method to query a sqlite3 database using tclsh84 ...

 

Initially, I have installed on my PC(s) - tcl/tk(8.4.12.0). Also, have installed the

tclsqlite3 dll. I have multiple (simple) sqlite3 databases which I maintain on my PC(s)

and one on the USB stick. The premise was not to rewrite code in PHP (not a PHP guru)

and to utilize and modify existing tcl code to query several simple sqlite3 databases...

I was not prepared to download more extensions/update PHP etc. at this time.

 

Here is synopsis of this investigation (after various iterations):

 

1. Created a searchit.html file with a form (action=post) to pass information to searchit.php:

note: pass the database name/table/field to query and the search string.

 

2. With searchit.php I utilized the $_POST[""] (PHP array?) to make the variables that I wanted to

pass to the tclsh84 (tcl shell).

ie. $searchstring =$_POST["searchstring"]; etc.

 

Built and printed initial HTML code (headers etc.)

 

I then made a call to "tclsh84" and passed (script name: searchit.tcl) and variables to

query a database:

ie. $output = exec("tclsh84 searchit.tcl $database $table $entry $searchstring");

 

3. tclsh84 opens the script (searchit.tcl) and reads in the variables - loads tclsqlite3 and performs

the query (as coded in searchit.tcl script). This builds a variable that I called "page" to return to

searchit.php.

note: variable "page" is 1 string (containing results with HTML code in order to build a table as

well as highlight the search string(color red) in textual results etc. )

 

4. The searchit.php script then prints the information received ($output) from tclsh84

ie. print $output;

 

The searchit.php script then prints out final HTML code and new html page produced.

 

Lessons learned:

1. PHP - likes 1 string (with no breaks/newlines) returned from calls

and remember those ";'s" in PHP.

2. I thought this approach would bog down; but Uniform Server proved to be pretty

quick. I am impressed with speed on this old PC.

3. Unfortunately this would limit sqlite3 queries to those systems with tcl/tk installed;

however, for my purposes this works well....

4. Considering using this same approach using Python......

 

Cheers!

wjk

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.