Connection
A connection to one database, dbName.
A query and a transaction run through the same connection resolve table names differently, and nothing in the SQL text distinguishes the two.
A query may reach any attached database:
db.schema.table— that table, in that database.a.b— matched against both readings: schemaaof dbName, and tablebin thepublicschema of a databasea. It resolves to whichever exists, and is anAmbiguous table referencewhen both do. The database reading only reachespublic, so another schema of another database needs all three parts.b— tablebin thepublicschema of dbName.
A transaction resolves only its own database:
a.b— schemaaof that database, never a database. SoINSERT INTO other_db.foocreatesfooin schemaother_dbof the transaction's own database.b— tablebin thepublicschema of that database.A table in another database is unreachable, and referring to one reports that the table was not found, naming the transaction's database.
The transaction's database is:
dbName — for SQL DML through a Statement, and for a
BEGIN…COMMITblock. Neither can address another database.TxOpts.dbName, defaulting to dbName — for submitTx and executeTx.
The narrowing is deliberate: XTDB guarantees serializability within a database and not between databases, so a transaction that read across them would have no consistent basis to read at.
Types
Properties
The authenticated user this connection's writes are attributed to; null for an unauthenticated Xtdb.connect.
Functions
Opens a transaction with the session's default access mode (SET SESSION CHARACTERISTICS), or none. setTransactionReadOnly and setTransactionReadWrite shape it until its first query or write.
The transaction goes to TxOpts.dbName (default dbName) and may only refer to tables within it — see Connection.
Makes the open transaction read-only, as SET TRANSACTION READ ONLY, … does.
Makes the open transaction read-write, as SET TRANSACTION READ WRITE, … does.
Sets the open transaction's time zone, as SET TRANSACTION TIMEZONE = … does, for this transaction only. It's kept when the access mode changes.
The transaction goes to TxOpts.dbName (default dbName) and may only refer to tables within it — see Connection.