Objo.
Feedback Forum Docs Objo Studio
Feedback

Feature #1405

Parameterised SelectSQL and ExecuteSQL overloads with inline arguments

Status
Fixed
Fixed in
v26.9.2
Area
-
Source discussion
https://forum.objo.dev/d/1036-selectsql-paramarray
Last updated
2026-09-16

Upvotes

0 upvotes

Uses your Objo forum account.

Public summary

Add convenience overloads that build and execute a prepared statement in one call, binding arguments to ? placeholders in order:

  • SelectSQL(sql As String, ParamArray args() As Object) As RecordSet
  • ExecuteSQL(sql As String, ParamArray args() As Object)
  • SelectSQLAsync(sql As String, ParamArray args() As Object) As Task(Of RecordSet)
  • ExecuteSQLAsync(sql As String, ParamArray args() As Object) As Task

Available on SQLiteDatabase, MySQLDatabase, PostgreSQLDatabase, SQLServerDatabase, ODBCDatabase, and the shared Database interface. Example:

Var rs As RecordSet = db.SelectSQL("SELECT name FROM users WHERE age > ? AND city = ?", 21, "Perth")

Value types are mapped to database parameter types automatically, matching PreparedStatement.Bind: String, Integer, Double, Decimal, Boolean, MemoryBlock (binary), and Nothing (SQL NULL). Supplying a number of values that does not match the number of ? placeholders raises a DatabaseException naming both counts.

This mirrors Xojo API 2's parameterised SelectSQL/ExecuteSQL, so jacket routines around common database calls do not need to create, bind, and execute a PreparedStatement manually. No Variant type is required; the existing ParamArray args() As Object support carries heterogeneous arguments.

Objo.

Build apps visually, deploy anywhere.

Feedback is a public read-only status mirror for Objo Studio.