This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A Tabularis driver plugin, written in Rust, that lets Tabularis connect to Microsoft SQL Server. Tabularis launches the compiled binary as a subprocess and talks to it over stdio using JSON-RPC (one JSON object per line in, one JSON object per line out). The plugin has no server of its own and no persistent state beyond an in-process connection-pool cache.
Full plugin contract (required RPC methods, manifest schema) lives in the upstream guide: https://github.com/TabularisDB/tabularis/blob/main/plugins/PLUGIN_GUIDE.md. The frozen contract for plugin-owned EXPLAIN parser work is docs/explain-architecture.md.
All common tasks are just recipes (see justfile); most just wrap cargo.
just build # cargo build (debug)
just release # cargo build --release
just test # cargo test (no database required)
just lint # cargo clippy --all-targets -- -D warnings
just fmt # cargo fmt --all
just repl # cargo run --bin test_plugin — local JSON-RPC sandbox
just dev-install # build + copy binary/manifest into the local Tabularis plugins dir
just uninstall # remove the installed plugin
just run-sqlserver # SQL Server 2022 in Docker (sa / Str0ng!Passw0rd)
just seed-sqlserver # create and seed the tabularis_test databaseRun a single test: cargo test <test_name>.
src/
main.rs # tokio entrypoint: stdin reader → worker pool → stdout writer
rpc.rs # JSON-RPC dispatch + response/param helpers
models.rs # serde shapes mirroring the Tabularis host's models
common.rs # query classification + JS-safe integer helpers
connection.rs # URL/keyword connection strings and canonical reconciliation
settings.rs # forgiving process settings received by initialize
pool_manager.rs # canonical-key deadpool cache and idle eviction
handlers/ # thin JSON adapters, one module per RPC area
driver/ # SQL Server logic
ops.rs # one free function per host RPC method
pool.rs # Microsoft mssql-tds bridge + deadpool Manager, TLS and reset
error.rs # categorized errors, discard policy and credential redaction
blob.rs, users.rs, introspection.rs, helpers.rs, ddl/, routines/, triggers/, types.rs
extract/ # row → JSON value extraction, including temporal types
explain.rs # raw SHOWPLAN_XML / STATISTICS XML capture
explain/ # TypeScript SHOWPLAN parser, plugin IIFE and npm package
Key invariants:
- JSON emitted by handlers must deserialize into the host's model structs —
models.rsmirrors the host's serde shapes; don't change field names or nullability casually. .tabulariumdata_typesmirrorsdriver/types.rs::get_data_types(); keep them in sync.update_record/delete_recordreceive apk_map(composite PKs supported); ordering is normalized by sorting column names.explain_queryreturns rawsqlserver-showplan-xml; compatible hosts recognize that shape as raw EXPLAIN output and dispatch its payload to the plugin-owned TypeScript parser registered fromexplain/dist/index.iife.js. Keep the raw shape, manifest declaration, parser bundle and runtime version floor aligned withdocs/explain-architecture.md.