Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion customization/data-settings.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Data Settings
description: Data grid font, copy format, pagination, query result cap, JSON viewer, and query history
description: Data grid font, copy format, pagination, query result cap, results kept per run, JSON viewer, and query history
---

Browsing a table pages 1,000 rows at a time, and a query that returns more than 10,000 rows stops there. Both numbers, and the rest of what the grid does before you touch anything, are on **Settings > Data**.
Expand Down Expand Up @@ -62,6 +62,14 @@ Tables with more estimated rows than the threshold show an approximate count ins

The cap limits the rows read back, not the statement: your SQL reaches the server exactly as you typed it, and a query carrying its own `LIMIT` is untouched. What a capped result offers instead is in [Query Results](/features/query-results#the-row-cap).

## Multiple Results

| Setting | Default | Options |
|---------|---------|---------|
| Results kept per run | No limit | No limit; 10; 20; 50; 100; 200; 500; 1,000 |

A run that returns more results with rows keeps only the newest ones, and each of them reads, for example, "150 earlier results were dropped." under the grid. The statements that return no rows share one result and never count, and pinned results always stay. A change leaves the results on screen as they are. On SQL Server one batch keeps at most 100 result sets whatever the setting: the first 100 when it returns more, the last 100 across its `GO 5` repeats.

## JSON Viewer

| Setting | Default | Options |
Expand Down
2 changes: 1 addition & 1 deletion databases/mssql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ SELECT * FROM serialnew WHERE [S/N] = @sn;
SELECT * FROM serial_existed WHERE sn_code = @sn;
```

Every result set a batch returns opens in its own result tab. In a batch of plain queries each tab is named after its query; a procedure call, a loop or an `IF` numbers them **Result 1**, **Result 2** instead. `PRINT` output and messages up to severity 10 appear in the **Output** view.
Every result set a batch returns opens in its own result tab, up to 100 per batch. In a batch of plain queries each tab is named after its query; a procedure call, a loop or an `IF` numbers them **Result 1**, **Result 2** instead. `PRINT` output and messages up to severity 10 appear in the **Output** view.

- Give `CREATE PROCEDURE`, `CREATE VIEW`, `CREATE FUNCTION`, `CREATE TRIGGER` and `CREATE SCHEMA` a batch of their own. The server refuses each of them after another statement in the same batch.
- `GO 5` runs the batch before it five times.
Expand Down
9 changes: 5 additions & 4 deletions developers/mcp-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,11 @@ The top-level fields describe the first result set, with `rows_affected` countin
A statement runs on the user's own session, inside any transaction it holds. `execute_query`, `confirm_destructive_operation` and [`insert_rows`](#writing-data) follow these rules about it:

- A statement that starts a transaction while one is open is refused, with or without Manual Commit.
- While a transaction is open on PostgreSQL or CockroachDB, the statement runs inside `SAVEPOINT tablepro_agent`. A failure rolls back to the savepoint and leaves the user's transaction usable. On Redshift and DuckDB, where a failure would abort it, the statement is refused.
- While a transaction is open on PostgreSQL or CockroachDB, the statement runs inside `SAVEPOINT tablepro_agent`. A failure rolls back to the savepoint and leaves the user's transaction usable. On Redshift, DuckDB and Teradata, where a failure would abort it, the statement is refused.
- With [Manual Commit](/features/sql-editor#manual-commit) on, a write stays pending until the user commits it in TablePro. It opens a transaction, or joins the one already open, and `status_message` says the change is pending. A write the connection cannot hold is refused.
- With Manual Commit on, a statement that starts, ends or could hide transaction control is refused: `BEGIN`, `COMMIT`, `ROLLBACK`, `SAVEPOINT`, `RELEASE`, a procedure call, dynamic SQL, and on SQL Server a transaction keyword anywhere in the batch.
- With Manual Commit on, a statement that starts, ends or could hide transaction control is refused: `BEGIN`, `COMMIT`, `ROLLBACK`, `SAVEPOINT`, `RELEASE`, a procedure call, dynamic SQL, `BT` and `ET` on Teradata, and on SQL Server a transaction keyword anywhere in the batch.
- When the open transaction ended while the statement ran, `status_message` says so.
- On Teradata, a write that leaves a transaction open, as every change in an ANSI session does, gets a `status_message` saying so. The statements after it are refused until it is committed or rolled back.
- An `insert_rows` call of several rows that joins an open transaction on PostgreSQL, CockroachDB, MySQL, MariaDB, SQLite, SQL Server or Oracle runs inside a savepoint, so a row that fails takes back the rows before it.

A batch that raises an error fails the call with the server's message and line number. The batches after it do not run, and the error says what stays applied. On a connection with [masking rules](#masking-rules), the whole message is withheld.
Expand All @@ -204,11 +205,11 @@ Formats are `csv`, `json` and `sql`; pass exactly one of `query` or `tables[]`.

| Tool | Arguments | Returns |
|------|-----------|---------|
| `insert_rows` | `connection_id`, `table`, `columns`, `rows` (`database`, `schema`) | `table`, `rows_submitted`, `rows_affected` |
| `insert_rows` | `connection_id`, `table`, `columns`, `rows` (`database`, `schema`) | `table`, `rows_submitted`, `rows_affected` (`status_message`) |
| `confirm_destructive_operation` | `connection_id`, `query` (`timeout_seconds`, `database`, `schema`) | A result set, plus `result_sets[]` for a SQL Server script |
| `transaction_control` | `connection_id`, `action` (`database`, `schema`) | `status`, the action that completed, and `connection_id` |

`insert_rows` binds parameters. Its confirmation shows the values that will be written, and the approved values run in the named database and schema. Each row is an array with one value per column, and a call carries at most 1,000 rows. The [transaction rules](#execute_query) of `execute_query` apply: under Manual Commit the rows stay pending until the user commits them in TablePro. The reply has no `status_message` to say so.
`insert_rows` binds parameters. Its confirmation shows the values that will be written, and the approved values run in the named database and schema. Each row is an array with one value per column, and a call carries at most 1,000 rows. The [transaction rules](#execute_query) of `execute_query` apply: under Manual Commit the rows stay pending until the user commits them in TablePro, and `status_message` says so.

`confirm_destructive_operation` runs one destructive statement, or a SQL Server script containing a destructive statement. This includes `DROP`, `TRUNCATE`, `ALTER … DROP`, and `DELETE` without `WHERE`. Other statements are rejected; use `execute_query` for those. The user approves it first, through your elicitation prompt if your client supports elicitation, otherwise through TablePro's own dialog on their Mac.

Expand Down
4 changes: 2 additions & 2 deletions features/query-results.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Choosing between results, pinning, the row cap, and what a failed o

import RowCap from "/snippets/row-cap.mdx";

Every statement you run gets its own result. The next run reuses an unpinned one rather than adding to the pile, so a result survives only as long as you leave it unpinned.
Every statement you run gets its own result. The next run reuses an unpinned one rather than adding to the pile, so a result survives only as long as you leave it unpinned. A run keeps every result that returns rows unless **Results kept per run** in [Data Settings](/customization/data-settings#multiple-results) sets a limit.

<Frame caption="Three results as tabs above the grid, the first one pinned">
<img className="block dark:hidden" src="/images/query-results.png" alt="Three SELECT statements in the editor over genre, artist and album result tabs, with the genre rows in the grid" />
Expand Down Expand Up @@ -94,7 +94,7 @@ When the cap trims a result the status bar reads **Showing N rows** and offers *

## Statements that return no rows

INSERT, UPDATE, DELETE and DDL show a success view with the affected row count and the execution time.
INSERT, UPDATE, DELETE and DDL show a success view with the affected row count and the execution time. Two or more of them in one run share one result, named after how many there were, with the row counts and times added up.

## Server output

Expand Down
2 changes: 1 addition & 1 deletion features/sql-editor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ A SQL Server script runs a batch at a time instead, cut at its `GO` lines, so a
|---|---|---|
| Ordinary statements | A transaction TablePro opens and commits | Everything rolls back |
| Ordinary statements, with [Manual Commit](#manual-commit) on | A transaction TablePro opens and leaves open for you to commit | Everything rolls back |
| One that manages its own: `BEGIN`, `START TRANSACTION`, `XA START`, `SET autocommit`, `SAVEPOINT` on SQLite, `SET TRANSACTION` on Oracle | The script's own transaction | The transaction it left open is rolled back |
| One that manages its own: `BEGIN`, `START TRANSACTION`, `XA START`, `SET autocommit`, `SAVEPOINT` on SQLite, `SET TRANSACTION` on Oracle, `BT` on Teradata | The script's own transaction | The transaction it left open is rolled back |
| One holding a [statement a transaction cannot hold](#statements-a-transaction-cannot-hold) | No transaction | Each statement that ran stays applied, and the banner counts them |
| A script on SQL Server | No transaction, unless the script opens one with `BEGIN TRAN` | What ran stays applied, and a transaction the script left open is reported |
| Anything, on a connection that already has a transaction open | That transaction | The transaction stays open and the message says so |
Expand Down
Loading