Platforms to show: All Mac Windows Linux Cross-Platform

Previous items

SQLCommandMBS.PostgreSQLField(RecordIndex as integer, FieldIndex as integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 19.5 Yes Yes Yes Yes No
Function: Queries a field by index for the row with the RecordIndex.

See also:

Feedback, Comments & Corrections

SQLCommandMBS.PostgreSQLField(RecordIndex as integer, FieldName as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 19.5 Yes Yes Yes Yes No
Function: Queries a field by name for the row with the RecordIndex.

See also:

Feedback, Comments & Corrections

SQLCommandMBS.PostgreSQLFieldCount as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 19.5 Yes Yes Yes Yes No
Function: The number of fields in the result.

Feedback, Comments & Corrections

SQLCommandMBS.PostgreSQLRowCount as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 19.5 Yes Yes Yes Yes No
Function: The number of records in the result.

Feedback, Comments & Corrections

SQLCommandMBS.Prepare
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 9.3 Yes Yes Yes Yes No
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.

Feedback, Comments & Corrections

SQLCommandMBS.setCommandText(SQLCommand as string, CommandType as Integer = 0)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 9.3 Yes Yes Yes Yes No
Function: Sets the command text.
Example:
dim s as new SQLCommandMBS

s.setCommandText "select * from test"

MsgBox s.CommandText
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.

Feedback, Comments & Corrections

SQLCommandMBS.SetParameters(Params as dictionary)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 16.4 Yes Yes Yes Yes No
Function: Sets the parameters based on the keys and values in the dictionary.
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
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.

Feedback, Comments & Corrections

SQLCommandMBS.Value(index as Integer) as SQLValueReadMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 16.1 Yes Yes Yes Yes No
Function: Returns the value specified by its position in the result set.
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)
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.

See also:

Feedback, Comments & Corrections

SQLCommandMBS.Value(name as string) as SQLValueReadMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method SQL MBS SQL Plugin 16.1 Yes Yes Yes Yes No
Function: Returns the value specified by its name in the result set.
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)
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.

See also:

Feedback, Comments & Corrections

Previous items

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

The biggest plugin in space...




Links
MBS Xojo Plugins