Home › Database
Inline queries, prepared statements, result metadata, and connection pooling.
LaiRu 0.1 includes a first-pass MySQL driver accessed through Lasso’s
inline() syntax. The DBAL boundary is defined so language-level
inline behaviour has a stable integration point while MySQL compatibility
work continues. FileMaker execution is represented at the boundary but remains parked.
db_datasource('contacts')
Datasource connection details are supplied via configuration or environment.
The runtime maps named inline parameters onto an internal
InlineRequest and dispatches to the appropriate driver.
inline( -database = 'contacts', -table = 'people', -search, -lastname = 'Lovelace' ) inline_result_row_count // rows returned inline_result_found_count // total matching rows inline_result_rows // array of row maps
inline( -database = 'contacts', -table = 'people', -search, -maxRecords = 20, -skipRecords = 40 )
inline(-database='contacts', -table='people', -findAll)
inline( -database = 'contacts', -table = 'people', -add, -firstname = 'Ada', -lastname = 'Lovelace' )
An explicit -sql parameter takes precedence over generated search SQL:
inline( -database = 'contacts', -sql = 'SELECT id, name FROM people WHERE active = 1 ORDER BY name' )
inline(
-database = 'contacts',
-sql = 'SELECT id, name FROM people WHERE lastname = ?',
-prepare,
-params = array('Lovelace')
)
Common scalar parameter and result types are supported. The binary protocol correctly handles unsigned integer column flags and TIME values (including hour-overflow and negative intervals).
inline(-database='contacts', -begin) inline( -database = 'contacts', -sql = 'UPDATE accounts SET balance = balance - 100 WHERE id = 1' ) inline( -database = 'contacts', -sql = 'UPDATE accounts SET balance = balance + 100 WHERE id = 2' ) inline(-database='contacts', -transaction='commit') // or: -transaction='rollback'
inline_context scopes default parameters so you don’t repeat them
on every inline call inside the block:
inline_context(-database='contacts', -table='people') => {
inline(-search, -lastname='Lovelace')
// inline_result_rows available here
inline(-add, -firstname='Charles', -lastname='Babbage')
}
| Method | Returns |
|---|---|
inline_result_row_count | Number of rows returned. |
inline_result_found_count | Total matching rows (for pagination). |
inline_result_column_count | Number of columns. |
inline_result_rows | Array of row maps. |
inline_result_first_row | First row map. |
inline_result_row(result, n) | 1-based row lookup. |
inline_result_column_values(result, name) | Array of values for a named column. |
inline_result_column_names | Column name array. |
inline_result_table_names | Table name array. |
inline_result_schema_names | Schema name array. |
inline_result_qualified_column_names | Fully qualified column names. |
inline_result_columns_by_table | Map of table → column list. |
inline_result_transaction_status | Transaction status map. |
inline_result_in_transaction | True if a transaction is active. |
MySQL connections support TCP, unix socket, and TLS:
| Option | Description |
|---|---|
| TCP | Hostname and port connection. |
| Unix socket | Local socket path (Linux). |
require_tls | Enforce TLS for TCP connections (OpenSSL-backed). |
SET NAMES | Charset configuration applied on connect. |
SET time_zone | Timezone applied on connect. |
mysql_native_passwordmysql_clear_password (unix socket, TLS, or explicitly allowed)caching_sha2_password (fast auth + full auth over TLS or RSA)sha256_password (TLS or RSA)
Pooling is off by default. db_pool_configure(n) enables handle reuse.
Before returning a handle to the idle pool, LaiRu sends COM_RESET_CONNECTION
and reapplies datasource session setup (charset, timezone, session variables).
Handles are discarded — not pooled — when autocommit is off, a transaction
is active, or reset fails.
db_pool_configure(8) // enable pooling with max 8 idle handles db_pool_stats // map with 'pooled_handles', etc. db_pool_config // current pool configuration
For servers that do not support COM_RESET_CONNECTION, configure
the datasource with the disconnect reset policy: handles are closed
instead of pooled, while global pooling remains enabled for other datasources.