SQLite and ALS Prolog
Home

During 2023-24, ALS Prolog was extended to support interfaces to external databases implemented in SQLite. The machinery for creating the interface tools is contained at ALSProlog/extensions/sqlite in the ALS build tree. One must execute a few steps to generate the necessary files:

  1. Enable the general ALS Prolog foreign interface [Instructions for linux and MacOS]:
    1. In the top level of the ALS Prolog build tree, ALSPRO, execute
      > cd foreign_sdk/unix
      	
    2. Then execute
      sh build.sh
      	
  2. Generate the lowlevel interface file sqlite3_intf.psl:
    1. In the top level of the ALS Prolog build tree, ALSPRO, execute
      > cd extensions/sqlite
      	
    2. Then execute
      make sqlite3_intf.psl
      	

After carrying out thesee steps, in extensions/sqlite, you will find the files:

	doc_examples.pro  prolog_sqlite3_doc.txt  sqlite3_intf.pro   
	README.md         sqlite3_intf.c          sqlite3_intf.psl
	tests_sqlite3_intf.pro
The file sqlite3_intf.psl implements the low-level interface between ALS Prolog and SQLite3. The companion file sqlite3_intf.pro implements a more convenient prolog api over that file. The file prolog_sqlite3_doc.txt documents the interface presented by sqlite3_intf.pro; code for examples discussed in this file is contained in doc_examples.pro. The file tests_sqlite3_intf.pro contains various tests which can be run to display functionality.

sqlite3_intf.pro and sqlite3_intf.psl both need to be consulted together into any ALS Prolog image intending to utilize the SQLite3 interface. The page Pseudo Haiku utilizes this interface with an SQLite3 database.