Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

SQL.SetCommandOption

Sets a string value of a specific command option.

Component Version macOS Windows Linux Server iOS SDK
SQL 2.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "SQL.SetCommandOption"; Command; Key; Value )   More

Parameters

Parameter Description Example
Command The command reference number gained with SQL.NewCommand. $Command
Key A string key of the command option. ""
Value The new value. ""

Result

Returns "OK" or error message.

Description

Sets a string value of a specific command option.

Call this method to set value(s) of server specific command options. See Server specific notes.

A command related option may be specified in either connection object or command object. If it is specified in connection object it affects all the commands on that connection.

If an option is not specially assigned to the command object the Library takes this option from related connection object (see SQL.GetCommandOption function). If an option is not specified in neither command nor connection objects, the Library takes the default option value.

SQL.SetCommandOption method is safe to use in cross-server applications. An option related to a particular server does not affect others.

see also
https://www.sqlapi.com/ApiDoc/class_s_a_command.html

Examples

Requests a scrollable record set:

MBS( "SQL.SetCommandOption"; $Command; "Scrollable"; "True" )

Store MySQL RecordSet locally:

MBS( "SQL.SetCommandOption"; $Command; "HandleResult"; "Store" )

Requests 100 rows to be prefetched:

MBS( "SQL.SetCommandOption"; $Command; "PreFetchRows"; "100" )

Set an option we may for ODBC to FileMaker:

MBS( "SQL.SetCommandOption"; $Command; "ODBCAddLongTextBufferSpace"; "false" )
// newer plugins automatically set it right when connecting to FileMaker

Allow multple connections for Microsoft SQL Server:

MBS( "SQL.SetCommandOption"; $Command; "SQL_ATTR_CURSOR_TYPE"; "SQL_CURSOR_DYNAMIC" )

Set option for concurrency on MS SQL Server:

MBS( "SQL.SetCommandOption"; $Command; "SQL_ATTR_CONCURRENCY"; "SQL_CONCUR_READONLY" )
# Sets the statement concurrency attribute. See SQNCLI documentation for an additional information.
# Valid values: "SQL_CONCUR_READONLY", "SQL_CONCUR_VALUES", "SQL_CONCUR_ROWVER", "SQL_CONCUR_LOCK".

See also

Blog Entries

This function is free to use.

Created 18th August 2014, last changed 10th January 2020


SQL.SetClient - SQL.SetCommandTag