Drivers
drivers/
Ez az oldal a nucleus saját dokumentációjából készül, ezért angol nyelvű.
Rust: nucleus-client (crates/client, no dependencies).
It speaks protocol version 15: Client::replicate(slot, start) turns a
connection into a replica’s ReplicationStream (receive, applied),
which the server’s replicas use (§9 “Read replicas”; 13 adds the routes
r to the stream, 14 the branches b, 15 each branch’s own n); the
other drivers need nothing of 11, 13, 14 or 15.
Client::connect(Config) (defaults: 127.0.0.1:20035, user, password and
database nucleus), execute(sql, params) -> Reply (columns, rows,
command, count), rows(sql, params), query(sql, params, Format) for
several statements or text results, cursor(sql, params, fetch) — an
iterator over a result as it arrives, fetch rows at a time (0: 1000);
columns(), command(), close(), and dropped early it stops the
statement — batches(sql, params, rows), the same in columnar batches
(Batch: rows(), column(i) — a ColumnBatch with its validity
bitmap and ColumnData, typed vectors I32, I64, F64, …, or offsets
and bytes; i32s(), i64s(), f64s(), str(row), is_null(row) —
and value(row, col)), copy_in(sql, reader) (COPY … FROM STDIN
with text or CSV from any Read) and copy_rows(sql, rows) (rows sent
as columnar batches, each value fitted to its column’s type; a value
that does not fit is Error::Value), pipeline(&[(sql, params)]) —
statements sent without waiting for each reply (§10, Pipelining), each
one’s result or error in its place —, status(), close(). Value covers
every nucleus type (SmallInt(i16), Integer(i32), Int(i64),
Real(f32), Float(f64), numeric as mantissa and scale, Bytes,
dates and timestamps as days and µs since 2000-01-01, Time as µs since
midnight, intervals, Inet / Cidr { addr: IpAddr, bits }, arrays,
Uuid([u8; 16]), Vector(Vec<f32>) (also from Vec<f32> and
&[f32]), SparseVector { dims, indices, values } (positions from 0,
ascending; every driver has a type of its own for it), Json(String)
(its text; columns Type::Json), Other { type_name, bytes } for another registered type; char(n) and enum values as text, their columns typed Char and
Enum(name)) with From conversions for parameters.
collection(name) (version 9, §10 Documents): a collection’s
documents by MongoDB’s requests, in the session’s transaction —
find(filter, &FindOptions { projection, sort, skip, limit }) and
find_one(filter) (documents as JSON texts), count(filter),
insert_one(doc) / insert_many(&[doc]) (their _ids),
update_one / update_many(filter, update, upsert) and
replace_one(filter, doc, upsert) (UpdateResult { matched, modified, upserted_id }), delete_one / delete_many(filter) (the count); JSON
texts in, "" an empty filter. Every driver has it, a thin layer
over O with the same names in its language’s case (Python
Collection, dicts in and out, a sort as (field, 1 | -1) pairs too;
JavaScript Collection, objects; Java and Swift DocumentCollection —
Collection is the standard library’s —, C++ nucleus::Collection,
JSON texts; C nc_document with an nc_document_request), and the
same conformance case (documents: every request, the 22023s, a
transaction with a table rolled back and committed).
stream_of(name) (version 10, §8.43): a stream’s entries — append
(an INSERT of the columns given), consume(group, limit) (CONSUME,
in the session’s transaction), position(group), wait(after, timeout_ms) (the w message; Client::wait_stream for a stream by
name), and process(group, limit, timeout_ms, work): one batch exactly
once — BEGIN, the group’s next entries (waiting for one when there is
none), work doing its writes on the same connection, COMMIT with
the position; a 40001 (another consumer of the group took the same
entries) runs it again, work‘s error rolls all back and is returned;
the entries processed (0: none in time). Every driver has it with the
same names in its language’s case (Python and JavaScript stream_of /
streamOf — stream is their streamed results’ —, entries as dicts and
objects; Java streamOf, its wait await; C nc_wait_stream and
nc_stream_process, the work a callback returning 0 to commit; C++
and Swift stream_of / streamOf), and the same conformance case
(streams: appends, three batches, a wait run out, the work failing,
another group, a stream not there). Every driver
speaks protocol version 7 — results read as they arrive, a batch at a
time (Rust Client::cursor, Python Connection.stream and a lazy DB-API
cursor, JavaScript Client.stream with for await, Java
NucleusClient.cursor, C nc_cursor_open / nc_cursor_next, C++
Connection::cursor; closing one early, or the next query, stops the
statement), and columnar, a buffer per column read in place (batches
in each: Rust typed vectors; Python numpy arrays — to_numpy(), fixed
widths without a copy, NULLs masked, a vector column an (n, d)
float32 array when its vectors share a dimension — Arrow arrays
(vector as fixed_size_list<float32>), and whole results
as numpy, arrow, pandas, polars; JavaScript typed arrays; Java
IntBuffer, LongBuffer, DoubleBuffer views; C and C++ pointers into
the batch), and bulk load through COPY … FROM STDIN (§8.7): text or
CSV in each (Rust copy_in, Python Connection.copy, JavaScript
Client.copy, Java copy, C nc_copy / nc_copy_start /
nc_copy_write / nc_copy_end, C++ Connection::copy) and rows or
columns as columnar batches (Rust copy_rows; Python
Connection.load — a pandas DataFrame, a pyarrow Table, a dict of
columns or rows, numpy columns without a Python object per value;
JavaScript Client.load — typed arrays sent as they are; Java load —
primitive arrays likewise), pipelines (§10, Pipelining: Rust
Client::pipeline, Python Connection.pipeline, JavaScript
Client.pipeline, Java pipeline, C nc_pipeline, C++
Connection::pipeline — each statement’s result or error in its place)
and a statement for many rows of parameters (execute_many; JavaScript
and Java executeMany; Python’s DB-API executemany): pipelined, all or
none — outside a transaction block in one of their own, so one commit
for all — errors with their hint (ServerError::hint,
Python’s .hint, JavaScript’s hint, Java’s hint(), C’s
nc_error.hint, C++’s hint()) — and logs in by SCRAM-SHA-256 (the C driver with
its own SHA-256, HMAC, PBKDF2 and base64; the others with their
platform’s). TLS in each: the server’s certificate checked against
the platform’s CA certificates (Rust: Mozilla’s, through the tls
module) or a CA file of one’s own, and the host name; or unverified
(encrypted, not authenticated). Rust: Config::tls with
nucleus_tls::ClientTls::{new, with_ca_file, without_verification}
(the client crate names only the nucleus_client::Tls interface); C:
cfg.tls, cfg.tls_ca, cfg.tls_no_verify in a build with
NC_WITH_OPENSSL (make TLS=openssl; nc_tls_supported()), C++ the
same fields on nucleus::Config; Python connect(tls=True, tls_ca=…, tls_verify=False) (ssl); JavaScript { tls, tlsCa, tlsVerify }
(node:tls); Java Config.tls(true), tlsCa(path), tlsVerify(false)
(JSSE). A client certificate (mutual TLS): Rust
ClientTls::with_client_certificate_files, C / C++ tls_cert,
tls_key, Python tls_cert=, tls_key=, JavaScript tlsCert,
tlsKey, Java tlsCertificate(cert, key) (a PKCS #8 key); ncsql --tls-cert <pem> --tls-key <pem>. An identity token (OAUTHBEARER) instead
of the password: Rust Config::token, C / C++ token, Python token=,
JavaScript token, Java Config.token(…), ncsql --token or NCTOKEN.
Every driver answers PLAIN (a directory’s password) and only over TLS.
C: drivers/c (nucleus.h, nucleus.c; C99, POSIX sockets or
Winsock). nc_connect(&cfg, &err), nc_query(conn, sql, params, n, &err)
(the last statement’s result, or NULL with the SQLSTATE in err),
accessors (nc_rows, nc_value_at, nc_column_type, nc_command,
nc_count), nc_format (text as ncsql prints it), value constructors
(nc_int, nc_text, nc_numeric, nc_date, nc_array, nc_uuid_value,
nc_vector, nc_sparsevec, nc_ext, nc_smallint, nc_integer, nc_real, nc_bytea, nc_time,
nc_inet, nc_cidr, …), nc_uuid_parse, nc_inet_parse,
nc_result_free, nc_close; nc_connect_io(&cfg, &io, &err) logs in
over a transport of the caller’s (nc_io: send, recv, close and
their context) — the embedded edition’s session on iOS. uuid is NC_UUID (an nc_uuid of 16
bytes), vector NC_VECTOR (as.vector: a float pointer and the
dimensions; in a batch the column’s bytes are the floats), sparsevec
NC_SPARSEVEC (as.sparse: the dimensions, the positions from 0 and
the values, their count), json NC_JSON (its text in as.text;
nc_json(text) sends one), another registered type NC_EXT (name and bytes;
nc_column_type_name); NC_SMALLINT / NC_INTEGER in as.integer,
NC_REAL in as.real4, NC_BYTEA a pointer and length, NC_TIME µs
since midnight, NC_INET / NC_CIDR a family, mask length and address;
NC_CHAR and NC_ENUM columns (an enum’s name by
nc_column_type_name) hold NC_TEXT values. Results own their values.
C++: drivers/cpp/nucleus.hpp, header-only C++17 over the C driver:
nucleus::Connection (RAII, movable), query(sql, {params}) → Result,
transaction(fn), nucleus::Error with code(); nucleus::Value is a
std::variant (NULL, bool, int64, double, string, Numeric, Date,
Timestamp, TimestampTz, Interval, Array, Uuid, Ext,
SmallInt, Integer, Real, Bytes, Time, Inet, Cidr — the last
seven wrappers, so an int literal stays a bigint parameter —, and
Vector, a std::vector<float>, SparseVector — dimensions,
positions from 0, values — and Json, its text).
Python: drivers/python, package nucleus (pure Python 3.8+).
nucleus.connect(), conn.execute(sql, params) → Result (rows,
records(), columns, command, count), conn.query for several
statements, with conn.transaction():, DB-API cursors; values as bool,
int, float (a real by its shortest digits), Decimal, str, bytes,
date, time (24:00:00 as time.max), datetime (naive / UTC),
Interval, ipaddress interfaces (inet) and networks (cidr),
uuid.UUID, list, a vector as an array('f') (sent from one or from
a one-dimensional float32 numpy array), nucleus.SparseVector (dims,
indices from 0, values; SparseVector.of(dict, dims)), json as
what json.loads makes (a dict parameter is json; nucleus.Json(x)
sends a list or a string as json; Arrow: string), nucleus.Ext
(another registered type); errors are nucleus.Error subclasses by SQLSTATE class
(IntegrityError for 23, ProgrammingError for 42, …).
JavaScript / TypeScript: drivers/js, package nucleus-db (Node;
TypeScript source that Node 22.6+ runs directly, npm run build for
dist/). await connect(), query(sql, params) → Result, queryAll,
transaction(fn); queries on one connection are queued. Values: integers
and reals as number (bigint beyond 2^53; a real by its shortest
digits), Decimal (exact, with parse / toString), Buffer (bytea),
Date for dates and timestamps (UTC; millisecond precision when read),
Time, Interval, Inet / Cidr, uuid as its canonical string, a
vector as a Float32Array, SparseVector (dims, indices from 0,
values; SparseVector.of(map, dims)), json as what JSON.parse
makes (a plain object parameter is json; new Json(x) sends an array or
a string as json), Ext (another registered type), arrays, null; errors are NucleusError with code.
Java: drivers/java, package io.github.davidsarosi92.nucleus (Java
17+, javac or Maven). NucleusClient.connect(new Config()),
query(sql, params...) → Result (rows(), records()), queryAll,
transaction(fn), NucleusException with code(); values as Boolean,
Short, Integer, Long, Float, Double, BigDecimal, String,
byte[], LocalDate, LocalTime, LocalDateTime, OffsetDateTime
(UTC), Interval, Inet / Cidr (over InetAddress), UUID,
float[] (a vector; a column of them in load as float[][]),
SparseVector (dimensions, positions from 0, values;
SparseVector.of(map, dims)), Json (its text: the driver brings no
JSON library), Ext (another registered type), List.
NucleusClient.connect(in, out, transport, config) logs in over a pair
of streams of the caller’s (the embedded edition’s session on Android).
The driver uses no API newer than Android 8 (API 26) has.
Swift: drivers/swift, a Swift package (iOS 15+, macOS 12+; Linux)
over the C driver, compiled as it is (CNucleus). Product Nucleus:
Connection.connect(host:port:user:password:database:clientName:token:),
query(sql, params) → QueryResult (columns, rows — a Row by
position or by name —, command, count), execute, executeMany,
pipeline([Statement]) (each a Result<QueryResult, NucleusError>),
cursor(sql, params, fetch:) (next(), all(), close()),
copy(sql, data:) / copy(sql, text:), transaction { … }, status,
serverVersion, close(); NucleusError with code, message,
hint. Value is an enum (with literals): null, bool, int
(Int64), int32, int16, double, float, text, numeric
(Numeric, its exact text), bytes (Data), date(year:month:day:),
time (µs), timestamp / timestamptz (Date), interval(months:days:micros:),
uuid (UUID), inet, cidr, array, vector ([Float]),
sparsevec(dimensions:indices:values:), json (its text, for
JSONDecoder), ext(type:data:). No TLS in
this build of the C driver. Product NucleusEmbedded (when
NucleusEmbedded.xcframework is there): see On phones below.
In the process (the embedded edition, §M14.23). editions/embedded
(nucleus-embedded) is the engine as a library: Database::open(path, options) opens a database in directory path (made if missing) or, for
":memory:", a new one on MemoryPlatform (§3.6); options is
"cache=64MB; sync=full; wal=minimal" (cache, sync ordered /
full, wal minimal / full, history — how long every snapshot
stays readable for AS OF and branches of the past, 1h, none by
default, as the server’s --history; in memory the page cache keeps the
file’s default, 128 MiB, and checkpoints come after 16 MiB of WAL). It
runs what nucleus server runs beside the sessions — the maintenance
thread (nucleus_server::maintain_until) and the embedding columns’
worker — and connect() starts a session: the nucleus protocol’s own
server (handle_native_stream, with Trust: no login, the session is
the user its Hello names; the directory’s permissions guard the data)
on a thread of its own, its bytes through two pipes in the process
(each holds 4 MiB before its writer waits; a reader spins 50 µs before
it sleeps). So every driver’s protocol code runs unchanged over it:
one API for a server and for a database in the process. A directory
this process has open already is shared (open again returns it; the
last close closes it); another process’s is refused by its lock.
close ends the sessions (each after its statement), stops the
background threads (Stop, embedding::stop), checkpoints and frees
the directory. The registry is the engine’s plus the embeddings and
local-models modules (features of the same names, on by default).
The C API (include/nucleus_embedded.h): nce_open(path, options, &error), nce_connect(db, &error), nce_send(c, buf, len),
nce_recv(c, buf, cap, timeout_ms) (bytes; 0 at the end; -1 when the
time ran out), nce_end(c) (ends the session without freeing it — the
one call another thread may make on a connection while one reads),
nce_disconnect(c), nce_close(db, &error), nce_free_error,
nce_version. Rust programs use Database directly, or
nucleus_client::Client::over(Box::new(db.connect()?), config).
Python: nucleus.connect("file:app.db") (options as parameters,
file:app.db?cache=64MB, or options=), nucleus.connect(":memory:")
or nucleus.open(path, options) — a Connection that closes its
database with it — and nucleus.Database(path, options) with
connect(user=…) for several sessions on one (a :memory: database is
one per Database). The library is loaded with ctypes (each call
releases the GIL) from NUCLEUS_EMBEDDED_LIB or beside the package;
drivers/python/build_wheel.py <library> makes the wheel for this
platform, py3-none-<platform>, one for every Python 3. JavaScript:
await connect("file:app.db"), connect(":memory:"), or
Database.open(path, options) with connect({ user }) and close();
the session is a Duplex over the Node-API addon native/addon.c
(linked with the engine into one nucleus.node by native/build.sh),
which reads each session on a thread of its own and hands its bytes to
the event loop through a thread-safe function (16 chunks queued at
most: then the session waits, a socket’s backpressure). The addon is
looked for in NUCLEUS_EMBEDDED_ADDON, the package
nucleus-db-<platform>-<arch>, then native/<platform>-<arch>/. Bun
and Deno load Node-API addons too (CI runs the example under both). Both drivers also take
"nucleus://user:password@host:port/database?tls=true&tls_ca=…" for a
server, so a program moves between the two by its connection string
alone (examples/python/anywhere.py, examples/js/anywhere.ts).
JavaScript also takes "ws://user:password@host:20039/ncp?database=…"
(or wss://): a server’s web front end over the platform’s WebSocket
(§9; openWebSocket, ConnectOptions.webSocket) — in Node 22+, Deno,
Bun, and through the browser’s entry, where it is the only way to a
server — and "http://user:password@host:20039/ncp" (or https://), a
request at a time with fetch (openHttp, ConnectOptions.http): what
the client sends in one turn of the event loop is one request (a
pipeline, executeMany, BEGIN; …; COMMIT in one query each one), and
connect makes an empty one to check the login. Each request is a
session of its own, so a transaction cannot span two: after a request
that left one open (rolled back with it), the next is refused (25000)
rather than run outside it; subscribe is refused (0A000: a live query
needs a connection that stays open).
In the browser (the edition in WebAssembly, §M14.23). The embedded
edition builds for wasm32-wasip1 without the model modules
(drivers/js/wasm/build.sh → drivers/js/wasm/nucleus.wasm). There are
no threads there: a statement’s workers are 1 (budget::workers), the
engine starts no background thread, and sessions are stepped —
nucleus_server::Exchange, the nucleus protocol’s server driven by the
bytes given to it (Database::exchange; C nce_exchange, nce_feed,
nce_exchange_ended, nce_exchange_free): each feed runs the whole
messages it has and returns the reply. Nothing can wait mid-statement,
so in a stepped session a COPY‘s data comes with the COPY (one
without fails, 57014; data after it is dropped), a fetch’s batches
follow one another without an S to answer, and one statement’s reply
holds at most 256 MB (54000). A directory is kept in a pool of slots
(§3.7) that the host provides as imports (nucleus_slots), one pool per
instance; besides those the module imports fifteen WASI functions
(clocks, randomness, the console; no files). The JavaScript driver’s
browser entry, drivers/js/src/browser.ts (the package’s browser
export), has the same connect and Client: connect("file:app.db")
keeps the database in OPFS (directory .nucleus of the origin’s,
OpfsSlots), connect(":memory:") in memory; nucleus:// is refused.
In a page the engine runs in a module worker (worker.js), reached by
messages; in a worker, and in Node, Bun and Deno, on the calling thread
(LocalBackend; in Node the pool is a directory of files, NUCLEUS_POOL
or .nucleus). Its socket (Session) sends what the client wrote in
one turn of the event loop as one feed, and the client is eager
there: copy and load send the data with the COPY (load learns
the columns’ types from a LIMIT 0 query first), and no F answers a
batch. The driver’s protocol code has no Node imports (core.ts;
bytes.ts is Node’s Buffer or, without one, a Uint8Array with the
part of its interface the driver uses; SCRAM is WebCrypto’s), so
index.ts (Node’s sockets, the addon) and browser.ts share it.
queryText(sql) (every edition) runs a script of statements with the
values as the server writes them (query’s text format) — every
statement’s Result and the first error beside them, not thrown — for
tools that show what a database says, as the console does.
The playground (playground/, §M14.17 E4): the web console’s page
(its HTML, style and script from modules/console/src/web/, not a copy)
on the browser edition — start.js opens connect(":memory:", {options: "history=1h"}) (?keep: file:playground, kept in OPFS) and gives the
page a backend answering as the server’s console API would, through
queryText. Its tour is the tutorial (§M14.17 E5, below). Served from
the repository’s root it works as is (node playground/test.mjs --serve); playground/build.sh <out> copies what it loads, in the same
layout, for any static host (8 MB, nearly all the engine).
playground/test.mjs runs it in headless Chrome — the engine started, a
query, every step of the tour through its button — in
driver-tests.sh js-wasm.
The tutorial (docs/tutorial.sql, §M14.17 E5): a guided tour of 14
steps — a table and its constraints, rows from generate_series, joins
and aggregates, EXPLAIN ANALYZE, ANALYZE QUERY’s findings, the index
they ask for and the plan again, JSON, vectors and hnsw, text search,
a transaction, time travel, a branch, the catalog. A step is a line
-- ## Title, its text in the comment lines after it (-- alone between
paragraphs) and then its SQL; the file also runs whole (nucleus sql :memory: < docs/tutorial.sql, the time-travel step aside: it needs a
history). the_tutorial_runs (editions/embedded/tests) runs every
step on a database in memory with an hour of history; the playground
test runs them in the page.
On phones (iOS and Android, §M14.23). The embedded edition without
the model modules, linked into the app (whole-program optimization, one
codegen unit), its sessions over the C API’s nce_send / nce_recv on a
thread each, as in Python and Node. iOS:
drivers/swift/build-xcframework.sh (ARCHS, default arm64 x86_64)
builds the static library for aarch64-apple-ios, the simulator and
macOS into NucleusEmbedded.xcframework (headers as module
NucleusEmbeddedC, which links iconv), and the Swift package then has
product NucleusEmbedded: Database.open(path, options:) (a directory,
or ":memory:"), Database.open(named:) (directory
Application Support/nucleus/<name> — kept and backed up, unlike
Caches), connect(user:database:clientName:) → the same Connection
(the C driver’s nc_connect_io over the session), close(),
Database.engineVersion. Syncs flush the drive’s cache
(F_FULLFSYNC, §3). Android: drivers/android/build-native.sh
(ABIS, default arm64-v8a x86_64; the NDK’s clang, API 26) links the
static library with the JNI glue (nucleus/src/main/cpp/nucleus_android.c,
which throws IOException on a failure) into
libnucleus_android.so, exporting only the Java_* functions (the
linker drops what they do not reach) and aligned for 16 KB pages; the
Gradle project drivers/android builds the library :nucleus (an AAR:
the Java driver’s sources and Kotlin’s Database) from them.
Database.open(path, options), Database.open(context, name)
(directory files/nucleus/<name> of the app’s), connect(user, database) → the Java driver’s NucleusClient over the session’s
streams, close() (AutoCloseable), Database.engineVersion. Each
build checks the size budget (arm64: 12 MiB on Android, 11 MiB on iOS; what the engine adds to
an app: on iOS a program using the C API linked as an app is and
stripped; on Android the .so).
Client-side encrypted columns (§M14.30 K5, columns.rs). A
column the driver encrypts before sending and decrypts after reading:
the server stores bytea ciphertext and never holds the key. One
format, every driver’s (format 1; drivers/encrypted-columns.txt holds
its test vectors, which each driver’s tests check):
- keys — from a 32-byte master key the application keeps (a KMS’s, a
keychain’s: never the database’s) and a name it gives the column
(
users.email):HMAC-SHA-256(master, "nucleus column 1 encrypt\0" ‖ name)encrypts,HMAC-SHA-256(master, "nucleus column 1 index\0" ‖ name)makes blind indexes; - a value — a type byte (0 bytes, 1 text in UTF-8, 2 an integer: 8 bytes little-endian) and its bytes;
- ciphertext — the byte 1, a random 24-byte nonce, XChaCha20-Poly1305 (draft-irtf-cfrg-xchacha: HChaCha20 then RFC 8439’s AEAD) of the value with the byte 1 authenticated beside it: 41 bytes more than the value;
- blind index — the first 16 bytes of HMAC-SHA-256 of the value under
the index key: stored in a column of its own (
email_index bytea, indexed), soWHERE email_index = $1with the value’s index finds its rows. Equality is all that can be asked; nothing else is, by design.
XChaCha20-Poly1305 because every driver carries it without a library,
constant-time in plain code, and its nonce is long enough to draw at
random for every value under one key. What stays visible: a value’s
length, and through the blind index which rows hold equal values and how
often — a column of few distinct values (a flag, a country) is given
away by its frequencies, so such a column gets no index. A vector the
server computes from a text (embed, §8.26) gives much of the text away
(inversion attacks): such a column is not zero-knowledge. Each driver
carries it, written in its own language (drivers/README.md lists the
calls): Rust ColumnKey::new(&master, "users.email"), then encrypt(v)
(a Value::Bytes to send), blind_index(v), decrypt_value(&row[i])
(a Plain: Bytes, Text, Int); C nc_column_key_init,
nc_encrypt, nc_blind_index, nc_decrypt (C++ and Swift over them);
Python nucleus.columns.ColumnKey; JavaScript await ColumnKey.create(…) (blindIndex async: WebCrypto’s HMAC); Java
ColumnKey. Each one’s tests check the vectors, send a column through
the server and find it by its blind index; the Rust test also searches
the server’s files for the planted plaintext. Every driver speaks
protocol version 8: present_subject_key / hold_subject_key (§8.40)
in each, tested with a sealed table on the test server.
Tests and examples. Every driver has the same conformance cases
(each type both ways, NULL and arrays, text parameters, errors and their
SQLSTATE, transactions, a wrong password, TLS verified, unverified and
refused for an unknown CA, a login by client certificate, and one by a
test issuer’s token — scripts/fixtures/oidc, whose key was thrown away
once the token was made — and by a directory’s password,
scripts/fake-ldap.py, over TLS and refused without), and examples/<language>/ has the same
quickstart in each. scripts/driver-tests.sh <nucleus binary> [languages] starts a server on a free port — with TLS, from a CA and a
certificate it makes with openssl, when that is installed — and runs
them all; the CI job drivers does so on Linux. python-embedded
and js-embedded run the Python and JavaScript suites again on a
database in their own process (NUCLEUS_URL=file:…; the login tests
skipped) and the anywhere examples in a directory, in memory and
against the server; editions/embedded/tests runs the slt suite there
(each script on a new :memory: database through Client::over).
swift runs the Swift package’s suite and its quickstart. CI’s ios
job builds the XCFramework, runs the Swift suite on macOS and on the iOS
simulator (the conformance cases on a database in the process, in
memory and in a directory) and examples/ios/run.sh (the Notes app
launched twice: the second finds the first one’s notes); its android
job builds the native libraries and on an emulator runs the library’s
tests (the Java driver’s conformance cases on a database in the app) and
examples/android/run.sh likewise. The engine’s own suites run on the
phones’ targets too, with a runner: xcrun simctl spawn <device> for
aarch64-apple-ios-sim, scripts/adb-run.sh for Android. scripts/psql-smoke.sh
checks psql with and without TLS.