Connections
Startup SQL
Startup SQL (also called post-connection SQL) runs automatically each time DBCode connects to your database. Use it for the session setup your queries depend on, such as SET statements, search_path, pragmas, temp tables, or attached databases.
Adding startup SQL
Section titled “Adding startup SQL”- Open the connection settings and select Startup SQL
- Write the SQL inline, or choose File and pick a
.sqlfile. File paths support variables - Save the connection
Separate multiple statements with semicolons.
How it runs
Section titled “How it runs”DBCode often keeps several connections open to the same database, and reopens them after they sit idle. The script runs on each of those connections, so every query, editor, and notebook sees the same session setup.
Because the script can run many times in one session, keep it quick and safe to repeat. For example, use CREATE TEMP TABLE IF NOT EXISTS rather than CREATE TEMP TABLE.
When the script fails
Section titled “When the script fails”If a statement fails, DBCode shows the error. A failure while connecting stops the connection so you can fix the script and connect again, and a failure on a later connection is reported by the query that needed it.