Skip to content

Run the statement at the cursor in the iOS query editor #3632

Closed

Description

@datlechin

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+Return on a hardware keyboard is bound to the same Run button (QueryEditorView.swift:161). On the Mac, Cmd+Enter runs 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 one SELECT beside an UPDATE asks about both, and there is no way to run just the SELECT.

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+Return runs the statement at the cursor and Cmd+Shift+Return runs 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 through TableProSQLGrammar (apple/TableProMobile/project.yml). SQL Server GO batches 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

  1. added
    enhancement
    platform-ios
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplatform-ios

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions