Repository navigation
Closed
Labels
Description
Problem
On iPhone and iPad, Run sends the whole editor. ios/index.mdx (Querying) says: "Run sends every statement in the editor, in order, and each one commits as it runs unless your script opened a transaction."
In the code:
executeQuery()takes the full text of the editor (apple/TableProMobile/TableProMobile/Views/QueryEditorView.swift:486). The editor view binds only the text and the focus (apple/TableProMobile/TableProMobile/Views/Components/SQLHighlightTextView.swift:5), so the app never knows where the cursor is or what is selected.Cmd+Returnon a hardware keyboard is bound to the same Run button (QueryEditorView.swift:161). On the Mac,Cmd+Enterruns only the statement under the cursor (features/sql-editor.mdx), so the same keys run one statement on the Mac and the whole tab on an iPad.- New connections start at Safe Mode Off (
apple/TableProMobile/TableProMobile/Platform/AppPreferences.swift:34), where a script with writes runs with no question asked. At Confirm Writes the check covers the whole text (QueryEditorView.swift:498), so oneSELECTbeside anUPDATEasks about both, and there is no way to run just theSELECT.
A phone editor is where people keep several statements in one place and run them one at a time, often away from a desk. Sending all of them is the riskier default.
Proposed solution
- Run sends the statement the cursor is in. With text selected, it sends the selection.
- Run All sits in a menu on the Run button and keeps today's behavior.
- The statement that Run will send gets a faint band behind it, so the user can see it before tapping.
- On a hardware keyboard,
Cmd+Returnruns the statement at the cursor andCmd+Shift+Returnruns all, as on the Mac. - Safe Mode checks only the text that will run.
- The statement is found with the shared scanner,
SQLStatementScanner.statementAtCursor(in:cursorPosition:grammar:)(apple/Packages/TableProCore/Sources/TableProSQLGrammar/SQLStatementScanner.swift:242), which the iOS app already links throughTableProSQLGrammar(apple/TableProMobile/project.yml). SQL ServerGObatches follow the same rule: the batch at the cursor. - Redis reads the whole text as one command today (
apple/Packages/TableProCore/Sources/TableProQuery/QueryScript.swift:67). There, Run sends the line the cursor is on.
Done means: with three statements in the editor and the cursor in the second, Run sends only the second; the docs page ios/index.mdx describes both commands.
Alternatives considered
Today the user deletes or comments out the other statements before tapping Run, or keeps one statement per editor.
Platform
iOS
Related database type
N/A / General
Activity