SQLite - no database server

The application database is MySQL by default. One setting makes it SQLite: a single file, no server to install, which is all a small application or a test needs.

# apps/myapp/.env - read with padEnv, as every database setting is

padSqlDriver=sqlite
padSqlDatabase=myapp/myapp.sqlite          # under DATA/
padSqlSetup=_install/schema.sql            # builds it the first time

$padSqlDatabase is the file - a relative name lives under DATA/. $padSqlSetup is optional: a .sql file in the application that is run once, when the database file does not exist yet, so the first request builds the database from text kept with the application.

Nothing else changes. The page below is one of the database examples, which this manual runs on MySQL - with the settings above it runs unchanged on SQLite:

PHP
fragments/database_1.php
HTML
fragments/database_1.pad
Result
<?php

$phone
= db ( "field phone from staff where name = 'jim'" );

?>
<p>Jim's phone number is {$phone}</p>

Jim's phone number is 555-4364