2. Editing data
Query window
The Query Window lets you create queries, as well as select and edit data. To open a new query window, select Query → New Query Window from the menu or right-click a connection and select Open Query Window.
Query area
The query area is a text field where you can write SQL queries. It supports syntax highlighting and autocompletion.
Keyboard shortcuts:
⌘/Ctrl
+Enter
- run current query⌘/Ctrl
+Space
- stop running query
Data area
The data area displays query result. Left-click any cell to enter navigation mode.
Navigation mode keyboard shortcuts:
Left
,Right
,Up
,Down
- navigate between cellsPageUp
,PageDown
- scroll by one page of rowsHome
,End
or⌘/Ctrl
+Left
,⌘/Ctrl
+Right
- move cursor to first/last columnShift
+Home
,Shift
+End
or⌘/Ctrl
+Up
,⌘/Ctrl
+Down
- move cursor to a first/last rowEnter
,F2
- enter cell edit mode⌘/Ctrl
+C
,⌘/Ctrl
+Insert
- copy cell value as text⌘/Ctrl
+V
,Shift
+Insert
- paste into current cellDelete
,Backspace
- reset cell changesMenu key
orApplication key
- open context menu for the current cell
Edit cell mode shortcuts:
Enter
- save and exit edit modeTab
- save and move to next cellEscape
- discard changes and exit edit mode
Status area
The status area is used for the fetch progress bar and result summary. On success, it displays the number of rows fetched and the fetch time. On error, it shows the exception message.
Select from table
You can open a query window directly from the Project Explorer or from a layout via the context menu:
Edit mode
There is no dedicated 'edit mode'. Once table data has appeared, you can start editing your data immediately. Simple double-click on a cell you want to edit or use Enter
or F2
in navigation mode.
There is only requirement to enter cell edit mode: fetched data must have a primary key for this column. Without it, OrmFactory can not build update statement.
You can also edit joined tables, as long as the target cell belongs to a table with primary key in fetched data.
Once you change a cell, it will be marked with an orange triangle in the top-left corner:
Editing a cell in a joined table affects all rows with the same primary key value.
After editing, three buttons will appear: Apply, Preview, and Discard.
- Apply - apply changes directly to the database (no preview)
- Preview - open a popup with generated SQL before applying
- Discard - cancel all changes
Preview example:
Foreign key tooltip
When you hover over a foreign key cell, OrmFactory will fetch and show data from the referenced object.
The Foreign key tooltip feature works with both real and virtual foreign keys.
The Foreign key tooltip is a recursive feature. You can point FK field in a tooltip to get a new tooltip with the object referenced by the field of referenced object.
Multiline edit
If a cell contains multiline text, OrmFactory opens a Multiline Editor:
You can also explicitly open it via the context menu -> Multiline Edit (for text cells only).
Multiline cells are marked with a return symbol on the right.
The Multiline Editor supports syntax highlighting for XML and JSON:
JSON Prettify-on-the-fly
Prettify-on-the-fly feature allows to edit a formatted JSON when it actually is stored as minified.
When OrmFactory detects a JSON format and recognizes it as minified, it will prettify the text and minify it back after changes. "Save minified" checkbox will appear, if OrmFactory will recognize text as JSON. This checkbox allows you to convert minified JSON to prettified and vice versa.
Insert rows
To insert a new row, simply fill in the last (empty) row. A new blank row will appear below it automatically.
Delete rows
To delete a row, right-click and choose Delete Row:
And yes, you can delete a row in a joined table the same way as you can edit a joined table cell. Marked for delete rows will be shown with red strikethrough. The delete operation can be canceled using the context menu on the marked row. OrmFactory does not care if you want to change a cell before delete the whole row. It will generate update before delete. Delete and edit can be discarded separately from context menu.
Expressions
You can enter expressions into cells. These expressions are sent as-is to the database and evaluated there. If the OrmFactory cannot recognize the date, it considers the text to be an expression and sends it to the DBMS as is. Text fields cannot be an expression.
Error handling
If an update fails, changed cells in affected row will show red triangles. Hover to see the error message.
Data reloading
After update or insert has been applied, OrmFactory will reload exact state of the changed rows. It will replace all cells of changed rows, no matter was they been edited or not. Reloading the entire row is necessary if triggers were used or, for example, current_timestamp as a default expression. Deleted row will be removed from grid.