lmclient reference

CLI options, protocol subcommands, JDBC host schema types and methods, standard REST and CLI interfaces, and exit codes for lmclient.

CLI flags and protocol subcommands

Flag or subcommandAreaDescription
--versionCorePrint the lmclient version and exit 0.
--lmcode-schema [--json]CorePrint the embedded lmclient host schema summary or exact JSON bytes.
--lmcode-signaturesCorePrint the 28 sorted canonical signatures of the lmclient domain bindings.
--lmcode FILECoreExecute a compiled DSLB bytecode file (optionally with --dry-run).
--url URLJDBC / AllConnection URL (or use LMCLIENT_<AREA>_URL in the environment).
--credentials-file FILEJDBC / AllUTF-8 properties file containing connection credentials (never printed).
--sql SQL / --file FILE.sqlJDBCExecute an inline SQL statement or a UTF-8 SQL script file.
--explain SQLJDBCReturn the query execution plan for SQL.
--metadata KIND [--table T]JDBCInspect schemas, tables, views, columns, keys, foreign_keys, or indexes.
--diff-url URLJDBCCompare the primary --url schema against a reference JDBC URL.
--format json|csv|tableJDBCSelect output formatting (optionally written to --output FILE).
--max-rows NJDBCMaximum rows returned per query (default 10000, cap 1000000).
redis / mail / queue / mqtt / mongoProtocolsRun Redis, SMTP/IMAP, AMQP, MQTT, or MongoDB operations with a JSON result envelope.

Host functions and domain types (lmclient)

SignatureReturn typeDescription
fn connect(url: string)ConnectionOpen a JDBC connection to a SQLite, DuckDB, H2, PostgreSQL, or SQL Server URL.
fn connect_file(url: string, credentials_file: string)ConnectionOpen a JDBC connection using credentials from a protected properties file.
Connection.exec(sql: string)voidExecute DDL or DML statements.
Connection.query(sql: string)ResultExecute a SQL query and return a bounded Result table.
Connection.schemas() / tables() / views()ResultReturn JDBC catalog metadata for schemas, tables, or views.
Connection.columns(t: string) / keys(t: string) / foreign_keys(t: string) / indexes(t: string)ResultReturn column, primary-key, foreign-key, or index metadata for table t.
Connection.explain(sql: string)ResultReturn the database engine's execution plan for sql.
Connection.diff(other: Connection)ResultCompute structural schema differences against another open Connection.
Connection.begin() / commit() / rollback() / close()voidManage explicit transactions and close the connection handle.
Result.csv(path: string) / Result.json(path: string)voidWrite the result set to a UTF-8 CSV or JSON file.
Result.csv_string() / Result.json_string() / Result.table()stringFormat the result set in memory as CSV, JSON, or an aligned text table.
Result.rows() / Result.columns() / Result.column(col: int)int / stringReturn row count, column count, or zero-based column name.
Result.number(r: int, c: int) / Result.text(r: int, c: int) / Result.is_null(r: int, c: int)float / string / boolRead typed cell values or null status at zero-based (row, col).

Standard REST and CLI interfaces (lmcode_std_v3)

Interface or functionSignatureRole
RestGet, RestPost, RestPut, RestDelete, RestPatch, RestHead, RestOptions, RestHandler(exchange: RestExchange) -> voidSAM interfaces for HTTP route templates supporting :param and {param} placeholders.
CliCommand, CliOption(exchange: RestExchange) -> voidSAM interfaces for stateless CLI commands and flags dispatched via rest_cli.
rest_config, rest_route, rest_serve, rest_stop, rest_cliStandard router functionsConfigure and dispatch REST routes or CLI invocations with isolated JDBC callbacks.

Exit codes

CodeMeaning
0Query, protocol command, or bytecode execution succeeded.
2CLI usage error, invalid flag combination, or invalid LMCLIENT_MAX_MEMORY_MB value.
3Runtime failure (connection error, SQL error, row cap exceeded, or memory budget breach).