Addons/data/sqlite/zFns

From J Wiki
Jump to navigation Jump to search
Overview | Basic Usage | Create | Definitions | zFns | Installation | Nulls | Examples | Quirks

Usually only one sqlite database is accessed at a time. In this case, it is convenient to use cover functions in the z locale that reference a global locDB with the sqlite instance.

To read in sqlite and the cover functions:

   load 'data/sqlite/sqlitez'

The cover functions are named with a db prefix as in dbreads for sqlreads__db. For example:

   dbopen '~addons/data/sqlite/db/sandp.db'

   dbtables''
β”Œβ”€β”¬β”€β”¬β”€β”€β”
β”‚pβ”‚sβ”‚spβ”‚
β””β”€β”΄β”€β”΄β”€β”€β”˜

   dbreads 'p where city="london" order by name'
β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”
β”‚pidβ”‚name β”‚colorβ”‚weightβ”‚city  β”‚
β”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€
β”‚p6 β”‚cog  β”‚red  β”‚19    β”‚londonβ”‚
β”‚p1 β”‚nut  β”‚red  β”‚12    β”‚londonβ”‚
β”‚p4 β”‚screwβ”‚red  β”‚14    β”‚londonβ”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”˜