![]() | ![]() |
Home |
|
|
Access Service User's Guide DirectConnect for AS/400 |
|
| Chapter 3 Querying and setting operating values |
Chapter 3
This chapter describes how to use global variables and set statements to query and set operating values for your client connection. The topics covered include:
A user or client application can query global variables to find the property and processing values that affect that particular client connection.
A global variable represents one of the following:
A configuration property value
Information about the processing state of the current connection
The current value for a configuration property resulting from a set statement
Global variables are preceded by two "at" (@@) symbols and are not case sensitive. To query a global variable, issue a SQL select statement in the following form:
select @@variable_name
where variable_name is the name of the relevant global variable.
The access service returns the configuration property value or the processing information for the current connection. For example, the SQL statement select @@Allocate returns the Allocate configuration property value of either connect or request.
For convenience and ease-of-use, we recommend you use DirectConnect Manager to configure the access service library.
Other guidelines for querying global variables are as follows:
All global values can be queried regardless of the SQL transformation mode in effect for the connection.
The global variable statement must be the only statement in a request.
The statement can be terminated with a semicolon.
A user or client application can issue set statements to change values that only affect the current client connection. These values remain in effect only for the duration of the client connection or until another set statement is issued.
To set an access service configuration property value or processing value for the current connection, issue a set statement in the form:
set { property_name | processing_name } valuewhere:
property_name is the name of the configuration property.
processing_name is the name of the processing option.
value is a valid value for the configuration property.
For example, the statement set Allocate request sets the Allocate configuration property value to request.
The following guidelines apply to issuing set statements:
A client can set values regardless of the SQL transformation mode in effect for the connection.
The set statement must be the only statement in a request.
set statements are not case sensitive.
Some configuration property values can be queried or set using global variables and set statements. These properties appear grouped by category in the following sections:
Configuration properties, global variables, and set statements are not case sensitive.
For explanations of configuration properties, see Chapter 2, "Configuring the DirectConnect Access Service Library"
The following table shows access service required properties and associated global variables and set statements.
Configuration Property | Global Variable and set Statement |
DefaultClientCodeset | select @@DefaultClientCodeset set DefaultClientCodeset codeset |
DefaultTargetCodeset | select @@DefaultTargetCodeset No set statement |
The following table shows target interaction properties and associated global variables and set statements.
Configuration Property | Global Variable and set Statement |
Allocate | select @@Allocate set Allocate {connect | request} |
IsolationLevel | select @@IsolationLevel No set statement |
SQLTransformation | select @@SQLTransformation set SQLTransformation {passthrough | sybase} |
StopCondition | select @@StopCondition set StopCondition {error | none | warning} |
TargetDecimalSeparator | select @@TargetDecimalSeparator No set statement |
The following table shows catalog stored procedure (CSP) properties and associated global variables and set statements.
Configuration Property | Global Variable and set Statement |
CSPCatalogQualifier | select @@CSPCatalogQualifier set CSPCatalogQualifier catalogqualifier |
CSPDBName | select @@CSPDBName set CSPDBName {NULL | dbname} |
CSPIncludeSystem | select @@CSPIncludeSystem set CSPIncludeSystem {no | yes} |
CSPIncludeTable | select @@CSPIncludeTable set CSPIncludeTable {yes | no} |
CSPIncludeView | select @@CSPIncludeView set CSPIncludeView {yes | no} |
CSPQualByDBName | select @@CSPQualByDBName set CSPQualByDBName {no | yes} |
DatatypeInfo | select @@DatatypeInfo set DatatypeInfo {transact | target} |
The following table shows client interaction properties and associated global variables and set statements.
Configuration Property | Global Variable and set Statement |
ClientDecimalSeparator | select @@ClientDecimalSeparator set ClientDecimalSeparator char |
GatewayCompatible | select @@GatewayCompatible No set statement |
MaxResultSize | select @@MaxResultSize set MaxResultSize integer |
MaxRowsReturned | select @@MaxRowsReturned set MaxRowsReturned integer |
MaxSvcConnections | select @@MaxSvcConnections No set statement |
quoted_identifier | select @@quoted_identifier set quoted_identifier {on| off} |
SendWarningMessages | select @@SendWarningMessages set SendWarningMessages {no | yes} |
ServiceDescription | select @@ServiceDescription No set statement |
SvclibDescription | select @@SvclibDescription (This global variable applies to the access service library as a whole.) No set statement |
TextSize | select @@TextSize set TextSize integer |
TransactionMode | select @@TransactionMode set TransactionMode {short | long} |
Version | select @@Version No set statement Returns the current version string in effect. To find the default version, see sp_helpserver . |
The following table shows datatype conversion properties and associated global variables and set statements.
Configuration Property | Global Variable and set Statement |
BinaryResults | select @@BinaryResults set BinaryResults {binary | char} |
DateResults | select @@DateResults set DateResults {datetime | datetime4 | char_eur | char_iso | char_jis | char_usa} |
DateTimeResults | select @@DateTimeResults set DateTimeResults {datetime | datetime4 | char_eur | char_iso | char_jis | char_usa} |
DecimalResults | select @@DecimalResults set DecimalResults {autoconvert | char | int | real | float | money | money4 | bcd} |
FloatResults | select @@FloatResults set FloatResults {float | real | char} |
GraphicResults | select @@GraphicResults set GraphicResults {binary | char} |
Int2Results | select @@Int2Results set Int2Results {smallint | char} |
Int4Results | select @@Int4Results set Int4Results {int | char} |
RealResults | select @@RealResults set RealResults {float | real | char} |
TimeResults | select @@TimeResults set TimeResults {datetime | datetime4 | char_eur | char_iso | char_jis | char_usa} |
The following table shows data conversion error properties and associated global variables and set statements.
Configuration Property | Global Variable and set Statement
|
CharConvertError | select @@CharConvertError set CharConvertError {reject | truncate} |
DateTimeConvertError | select @@DateTimeConvertError set DateTimeConvertError {reject | null | default} |
NumConvertError | select @@NumConvertError set NumConvertError {reject | null | default} |
The following table shows transfer properties and associated global variables and set statements.
Configuration Property | Global Variable and set Statement |
BulkCommitCount | select @@BulkCommitCount set BulkCommitCount integer |
TransferBatch | select @@TransferBatch set TransferBatch integer |
TransferErrorCount | select @@TransferErrorCount set TransferErrorCount integer |
The following table shows global variables and set statements used to query and set processing values for the client connection.
Global Variable and set statement | Description |
select @@AllResults set AllResults {autoconvert | char} | Returns group datatype conversions. Sets group datatype conversions:
|
select @@CloseOnEndtran set CloseOnEndtran {on | off} | Returns how cursors behave when a commit is executed. Determines how cursors behave when a commit is executed:
|
select @@Connections No set statement | Returns the current number of connections to this access service. |
select @@DefaultedRowCount No set statement | Returns the number of rows the access service returned with default values substituted for data conversion errors. |
select @@Error No set statement | Reflects the message number of each event. A successful event returns a 0 (zero). |
select @@noexec set noexec {on | off} | Returns whether metadata are returned for a select statement result set. Determines whether metadata are returned for a select statement result set:
|
select @@RejectedRowCount No set statement | Returns the number of rows rejected by the access service due to data conversion errors. |
select @@RowCount No set statement | Returns the number of rows affected by the last SQL statement processed. |
select @@ServiceName No set statement | Returns this access service name. |
select @@spid No set statement | Returns a unique positive integer identifier (server process ID) for the current client connection. |
select @@TargetError No set statement | Returns the message number of the last target database error. |
|
|