Platforms to show: All Mac Windows Linux Cross-Platform
SQLCommandMBS.PostgreSQLField(RecordIndex as integer, FieldIndex as integer) as string
Function:
Queries a field by index for the row with the RecordIndex.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 19.5 | Yes | Yes | Yes | Yes | No |
See also:
SQLCommandMBS.PostgreSQLField(RecordIndex as integer, FieldName as string) as string
Function:
Queries a field by name for the row with the RecordIndex.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 19.5 | Yes | Yes | Yes | Yes | No |
See also:
SQLCommandMBS.PostgreSQLFieldCount as Integer
Function:
The number of fields in the result.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 19.5 | Yes | Yes | Yes | Yes | No |
SQLCommandMBS.PostgreSQLRowCount as Integer
Function:
The number of records in the result.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 19.5 | Yes | Yes | Yes | Yes | No |
SQLCommandMBS.Prepare
Function:
Prepares command before execution.
Notes:
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.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 9.3 | Yes | Yes | Yes | Yes | No |
Notes:
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)
Function:
Sets the command text.
Example:
Notes:
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.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 9.3 | Yes | Yes | Yes | Yes | No |
Example:
dim s as new SQLCommandMBS
s.setCommandText "select * from test"
MsgBox s.CommandText
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.
SQLCommandMBS.SetParameters(Params as dictionary)
Function:
Sets the parameters based on the keys and values in the dictionary.
Example:
Notes:
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.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 16.4 | Yes | Yes | Yes | Yes | No |
Example:
dim con as SQLConnectionMBS // your connection
dim pic as picture // some picture
// get picture data
dim jpegData as MemoryBlock = pic.GetData(Picture.FormatJPEG, 80)
// parse a SQL command
dim sql as string = "Insert into BlobTest(name, image) values (:name, :image)"
dim cmd as new SQLCommandMBS(con, sql)
dim d as new Dictionary
// set by param index
d.Value(0) = "test.jpg"
// set by param name
d.Value("image") = jpegData
// set all parameters together
cmd.SetParameters d
cmd.Execute
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.
SQLCommandMBS.Value(index as Integer) as SQLValueReadMBS
Function:
Returns the value specified by its position in the result set.
Example:
Notes:
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.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 16.1 | Yes | Yes | Yes | Yes | No |
Example:
dim c as SQLCommandMBS // your command object
// get field by name
dim f1 as SQLValueReadMBS = c.Value("FirstName")
// get field by Index
dim f2 as SQLValueReadMBS = c.Value(1)
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.
See also:
SQLCommandMBS.Value(name as string) as SQLValueReadMBS
Function:
Returns the value specified by its name in the result set.
Example:
Notes:
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.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
method | SQL | MBS SQL Plugin | 16.1 | Yes | Yes | Yes | Yes | No |
Example:
dim c as SQLCommandMBS // your command object
// get value by name
dim f1 as SQLValueReadMBS = c.Value("FirstName")
// get value by Index
dim f2 as SQLValueReadMBS = c.Value(1)
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.

Links
MBS Xojo Plugins