Platforms to show: All Mac Windows Linux Cross-Platform
Back to SQLCommandMBS class.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SQL | MBS SQL Plugin | 9.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Prepare method compiles the command, but does not execute it. The method detects syntax errors in command text and verifies the existence of database objects.
Execute method calls Prepare method implicitly if needed, therefore you don't have to call it explicitly.
SQLCommandMBS.setCommandText(SQLCommand as string, CommandType as Integer = 0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SQL | MBS SQL Plugin | 9.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
SQLCommand: A string which represents command text string (an SQL statement or a stored procedure name).
CommandType: The type of command like kCommandTypeUnknown, kCommandTypeSQLStatement, kCommandTypeSQLStatementRaw or kCommandTypeStoredProcedure.
It's not necessary to set a command type explicitly, because it is defined automatically in terms of command text string. But if you still have any reason to do it, use one of the kCommandType* constants. To get command type use CommandType method.
Some examples using this method:
SQLCommandMBS.SetParameters(Params as dictionary)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SQL | MBS SQL Plugin | 16.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Keys can be String, Text or numeric types. Text and String are used to pick parameters by name. Numeric values are used to pick parameter by index (zero based).
MemoryBlock and Strings without text encoding are converted to byte values (BLOB).
Texts and Strings with encoding are converted to text values.
Raises exceptions if you pass anything which is not recognized.
Other types are translated as good as possible.
Raises OutOfBoundsException exception if index parameter is out of range.
SQLCommandMBS.Value(index as Integer) as SQLValueReadMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SQL | MBS SQL Plugin | 16.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
You can use Value() to get values for normal or cached result sets.
index: A one-based field number in a result set.
Use Value method to access a field by its name or position in the result set.
For Cached result sets, please use Value() function to get values.
Using an index smaller than 1 and greater then the value returned by FieldCount method will result in a failed assertion.
A set of SAField objects creates implicitly after the command execution if the result set exists. SAField object contains full information about a column: name, type, size, value.
Raises OutOfBoundsException exception if index parameter is out of range.
See also:
SQLCommandMBS.Value(name as string) as SQLValueReadMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | SQL | MBS SQL Plugin | 16.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
You can use Value() to get values for normal or cached result sets.
name: A string that represents a name of the requested field.
Returns a reference to a SAValueRead object.
Use Value method to access a field by its name or position in the result set.
Using a non-existent field name will throw an exception.
A set of SAField objects creates implicitly after the command execution if the result set exists.SAField object contains full information about a column: name, type, size, value.
See also:
The items on this page are in the following plugins: MBS SQL Plugin.