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 subcommand | Area | Description |
|---|---|---|
| --version | Core | Print the lmclient version and exit 0. |
| --lmcode-schema [--json] | Core | Print the embedded lmclient host schema summary or exact JSON bytes. |
| --lmcode-signatures | Core | Print the 28 sorted canonical signatures of the lmclient domain bindings. |
| --lmcode FILE | Core | Execute a compiled DSLB bytecode file (optionally with --dry-run). |
| --url URL | JDBC / All | Connection URL (or use LMCLIENT_<AREA>_URL in the environment). |
| --credentials-file FILE | JDBC / All | UTF-8 properties file containing connection credentials (never printed). |
| --sql SQL / --file FILE.sql | JDBC | Execute an inline SQL statement or a UTF-8 SQL script file. |
| --explain SQL | JDBC | Return the query execution plan for SQL. |
| --metadata KIND [--table T] | JDBC | Inspect schemas, tables, views, columns, keys, foreign_keys, or indexes. |
| --diff-url URL | JDBC | Compare the primary --url schema against a reference JDBC URL. |
| --format json|csv|table | JDBC | Select output formatting (optionally written to --output FILE). |
| --max-rows N | JDBC | Maximum rows returned per query (default 10000, cap 1000000). |
| redis / mail / queue / mqtt / mongo | Protocols | Run Redis, SMTP/IMAP, AMQP, MQTT, or MongoDB operations with a JSON result envelope. |
Host functions and domain types (lmclient)
| Signature | Return type | Description |
|---|---|---|
| fn connect(url: string) | Connection | Open a JDBC connection to a SQLite, DuckDB, H2, PostgreSQL, or SQL Server URL. |
| fn connect_file(url: string, credentials_file: string) | Connection | Open a JDBC connection using credentials from a protected properties file. |
| Connection.exec(sql: string) | void | Execute DDL or DML statements. |
| Connection.query(sql: string) | Result | Execute a SQL query and return a bounded Result table. |
| Connection.schemas() / tables() / views() | Result | Return JDBC catalog metadata for schemas, tables, or views. |
| Connection.columns(t: string) / keys(t: string) / foreign_keys(t: string) / indexes(t: string) | Result | Return column, primary-key, foreign-key, or index metadata for table t. |
| Connection.explain(sql: string) | Result | Return the database engine's execution plan for sql. |
| Connection.diff(other: Connection) | Result | Compute structural schema differences against another open Connection. |
| Connection.begin() / commit() / rollback() / close() | void | Manage explicit transactions and close the connection handle. |
| Result.csv(path: string) / Result.json(path: string) | void | Write the result set to a UTF-8 CSV or JSON file. |
| Result.csv_string() / Result.json_string() / Result.table() | string | Format the result set in memory as CSV, JSON, or an aligned text table. |
| Result.rows() / Result.columns() / Result.column(col: int) | int / string | Return 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 / bool | Read typed cell values or null status at zero-based (row, col). |
Standard REST and CLI interfaces (lmcode_std_v3)
| Interface or function | Signature | Role |
|---|---|---|
| RestGet, RestPost, RestPut, RestDelete, RestPatch, RestHead, RestOptions, RestHandler | (exchange: RestExchange) -> void | SAM interfaces for HTTP route templates supporting :param and {param} placeholders. |
| CliCommand, CliOption | (exchange: RestExchange) -> void | SAM interfaces for stateless CLI commands and flags dispatched via rest_cli. |
| rest_config, rest_route, rest_serve, rest_stop, rest_cli | Standard router functions | Configure and dispatch REST routes or CLI invocations with isolated JDBC callbacks. |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Query, protocol command, or bytecode execution succeeded. |
| 2 | CLI usage error, invalid flag combination, or invalid LMCLIENT_MAX_MEMORY_MB value. |
| 3 | Runtime failure (connection error, SQL error, row cap exceeded, or memory budget breach). |