Platforms to show: All Mac Windows Linux Cross-Platform

Back to SQLCommandMBS class.

SQLCommandMBS.CommandText as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the command text associated with the SACommand object.
Example
dim s as new SQLCommandMBS(nil, "select * from test")

MsgBox s.CommandText

Use the CommandText method to return the command text declared in SACommand constructor or setCommandText method.

All text strings sent to the plugin must have a defined encoding. Else the internal text encoding conversions will fail.
(Read and Write property)

SQLCommandMBS.CommandType as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets the command type currently associated with the SACommand object.

One of the following values from SACommandType_t enum:

  • kCommandTypeUnknown Command type is not defined. Library will detect command type automatically when needed.
  • kCommandTypeSQLStmt Command is an SQL statement.
  • kCommandTypeSQLStmtRaw Command is an SQL statement that mustn't be interpreted by SQLAPI++.
  • kCommandTypeStoredProc Command is a stored procedure or a function.
Remarks

The command type can be explicitly set in SACommand constructor and setCommandText method, but it's not necessary to do it.

The CommandTypemethod returns the command type value that was specified in SACommand constructor or setCommandText method. If you declared the command type value as kCommandTypeUnknown (the default value) then command type is detected by the Library and the CommandType method returns this detected value.
(Read only property)

SQLCommandMBS.Connection as SQLConnectionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The connection for the command.

When you set the connection on a command object that already has associated connection, the previous association will be correctly discarded (with closing opened command if needed) and new connection will be set.

If you attempt to call any method on a SACommand object that requires database access with no valid connection, an error occurs.
(Read and Write property)

SQLCommandMBS.FieldCount as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the number of fields (columns) in a result set.

FieldCount method returns the number of fields created implicitly after the command execution if a result set exists.

A field is represented by SAField object. You can get field value and description using Field method.
(Read only property)

SQLCommandMBS.Fields as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Provides dictionary with all fields.

This dictionary should help for debugging to inspect all fields and their text value.
(Read only property)

SQLCommandMBS.hasCache as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether cache is active.

(Read only property)

SQLCommandMBS.isBOF as Boolean   New in 24.0

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 24.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether we are at the beginning of the result set.

Set to true when running the query and when FetchFirst succeeds.
Otherwise false.
(Read only property)

SQLCommandMBS.isEOF as Boolean   New in 24.0

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 24.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether we are at the end of the result set.

True if we are at the end of the recordset, e.g. FetchNext failed.
Set to false by Execute.

We set it to true, when something goes wrong, so Xojo's RecordSet and RowSet end looping.
We can only know, that we are not at the last one, if FetchNext internally failed to get the next record.
(Read only property)

SQLCommandMBS.isExecuted as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether this command was already executed.

(Read only property)

Some examples using this property:

SQLCommandMBS.isExecuting as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 14.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether this command is executing.

You only see this true if you use threaded queries and look on the property from another thread.
(Read only property)

SQLCommandMBS.isOpened as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns true if the SACommand object is opened; otherwise false.

(Read only property)

Some examples using this property:

SQLCommandMBS.isResultSet as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether a result set exists after the command execution.

Returns true if the result set exists; otherwise false.
(Read only property)

Some examples using this property:

SQLCommandMBS.Options as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns a dictionary with all options.

For debugging, it may be useful to inspect options in debugger.
(Read only property)

SQLCommandMBS.ParamCount as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the number of parameters associated with the SACommand object.

ParamCount method returns the number of parameters created explicitly by using CreateParam method or (if parameters were not created before) creates them implicitly (can query native API if needed and therefore can throw exception on error) and returns the number of created parameters.

Command parameter is represented by SAParam object. You can look SAParam objects through and assign their values with Param and ParamByIndex methods.
(Read only property)

Some examples using this property:

SQLCommandMBS.Parameters as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Provides dictionary with all parameters.

This dictionary should help for debugging to inspect all parameters and their text value.
(Read only property)

SQLCommandMBS.RowsAffected as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the number of rows affected by the last insert/update/delete command execution.
Example
dim con as SQLConnectionMBS // your connection

dim sql as string = "UPDATE Test SET MyField=1"
dim c as new SQLCommandMBS(con, sql)

c.Execute

MsgBox str(c.RowsAffected)

(Read only property)

SQLCommandMBS.Tag as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
property SQL MBS SQL Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The tag property.
Example
dim c as SQLCommandMBS // your command object

// store reference to window/control, so we have it available in events
c.Tag = self

You can store here whatever you like.
(Read and Write property)

The items on this page are in the following plugins: MBS SQL Plugin.


The biggest plugin in space...