Help Getting started and windows

The Result tab

When a query returns rows, they appear on a Result tab in the pane below the query editor. A script that returns several result sets gets one Result tab for each. The tabs in that pane are numbered, and Alt+1 to Alt+8 pick one (Alt+9 the last). Ctrl+R moves the keyboard focus to the active tab, and Ctrl+Shift+2 (Edit > Hide Result Pane) hides the whole pane.

If a query fails, the Messages tab is shown instead; see The Messages tab.

The Result tab showing the rows a query returned

The toolbar

ButtonDoes
Export as…Exports all rows to a file (Ctrl+Shift+E); see Exporting data.
Copy DataCopies rows to the clipboard; the arrow beside it lists the choices (see Copying, below).
Table listShows (Read Only), or a table the result can be edited through; see below.
Insert new rowAdds an empty row (Alt+Insert).
Duplicate Current RowAdds a copy of the current row.
Save changes / Cancel changesWrites the changed row to the server, or forgets the change.
Delete selected row(s)Deletes the ticked or current rows, after asking (Alt+Delete).
Grid View / Text ViewShows the rows as a grid or as plain text. Ctrl+L switches between them.
FilterFilters the rows; see below.
RefreshRuns the query again (Alt+F5). While it runs, the button becomes Stop.

Paging

With Enable Autopaging in Result tab ticked on the Others page of Preferences (it is on unless you change it), a SELECT without its own LIMIT fetches the first Default number of rows only, 1000 unless you change it. The bar above the grid then controls the paging:

Remember setting for each query keeps the number of rows you chose for a query and uses it the next time you run the same query.

A query with its own LIMIT is run as written, and Limit rows is greyed out. It is also greyed out, with Refresh, for a result that is one of several returned by a single statement, such as a stored procedure call.

Sorting and filtering

Click a column heading to sort the rows by that column; click again to reverse the order, and a third time to remove the sort. On the Result tab the sorting and filtering happen in bonSQL, on the rows already fetched, one column at a time; the query is not changed. On the Table Data tab they are sent to the server instead. Filtering and sorting data has the details.

Right-click a cell for quick filters on its value (Field = Value, Field <> Value, Field > Value, Field < Value, and three Field Like forms), Custom Filter and Reset Filter. Unsort returns to the order the server sent.

Editing a result

To edit a result, pick the table its rows come from in the table list on the toolbar; (Read Only) turns editing off. F8 in the query editor (Edit > Execute Query > Execute And Edit Resultset) runs the query and picks the first table for you.

With “smart” KEYWORDS/FUNCTIONS/DEFAULTS handling ticked (Others page of Preferences, on unless you change it), typing DEFAULT, a function such as NOW() or a value such as CURRENT_TIMESTAMP into a cell sends it to the server as SQL rather than as text. To store the word itself, put it in backquotes: `NOW()`. Typing NULL always stores NULL; with the option ticked, `NULL` in backquotes stores the word.

If an UPDATE or DELETE would change several identical rows, bonSQL asks first, unless Prompt if multiple rows are getting updated is unticked in Preferences.

Long text, BLOB and JSON values

Cells of TEXT, BLOB and JSON columns have a small button that opens the Insert/Update Blob/JSON Field window. It shows the whole value on a Text tab (with an Image tab too, except for JSON). Its buttons Import From File… and Save To File… load the value from a file or write it to one, and ticking Set Null stores NULL instead. OK keeps your changes; Size: at the bottom shows how big the value is.

Syntax: colours the text as JSON, XML, HTML, CSS, SQL or Markdown, or None. bonSQL guesses from the value (JSON and XML/HTML are recognised) and remembers your choice for each column. Format lays out JSON or XML neatly; if the text does not parse, it says so.

Copying

Right-click the grid and open Copy for Copy Cell Data To Clipboard, Copy All Rows To Clipboard… and Copy Selected Row(s) To Clipboard…. Duplicate Current Row is on the same menu.

Tips