![]() | ![]() |
Home |
|
|
Access Service User's Guide DirectConnect Anywhere |
|
| Chapter 13 Retrieving information with System Procedures |
Chapter 13
This chapter describes how to use system procedures to retrieve information. It covers the following topics:
System procedures are Sybase-supplied stored procedures that return information about the access service and the target database.
ODBC and ASE/CIS use system procedures to obtain information about DirectConnect Anywhere capabilities.
If the access service cannot support one of these procedures, the procedure returns a correctly formatted result set containing zero rows.
Several procedures either are not supported by Adaptive Server or are defined differently from Adaptive Server. The defined procedures are as follows:
sp_configure (read only)
sp_groups
sp_helpserver
sp_password
sp_sqlgetingo
The following procedures have been defined to support ASE/CIS products:
sp_capabilities
sp_char_length
sp_datalength
sp_patindex
sp_textvalid
sp_thread_props
Returns the SQL capabilities of an access service.
sp_capabilities
The result set contains information that allows applications to successfully interact with an access service during normal query processing.
For information about the requirements for sp_capabilities, see the OmniConnect Interface Programmer's Guide.
The following table shows the result set:
Column | Datatype | Description |
ID | int | Capability ID |
CAPABILITY_NAME | char(30) | Capability name |
VALUE | int | Capability value |
DESCRIPTION | char(128) | Capability description |
The following table shows values for the capabilities.
Capability Number | Capability | Description |
101 | SQL syntax |
|
102 | join handling |
|
103 | aggregate handling |
|
104 | AND predicates |
|
105 | OR predicates |
|
106 | LIKE predicates |
|
107 | bulk insert handling |
|
108 | text/image handling |
|
109 | transaction handling |
|
110 | text pattern handling |
|
111 | order by |
|
112 | group by |
|
113 | net password encryption |
|
114 | object case sensitivity |
|
115 | distinct |
|
116 | wildcard escape |
|
117 | union handling |
|
118 | string functions |
|
119 | expression handling |
|
120 | truncate trailing spaces on varchar parameters |
|
121 | language events |
|
122 | date functions |
|
123 | math functions |
|
124 | T-SQL convert function |
|
125 | T-SQL delete/update |
|
126 | insert/update handling |
|
127 | subquery handling |
|
128 | in/not in clause |
|
129 | case expression in a SQL statement |
|
Determines the number of characters in the text data associated with the text pointer.
sp_char_length table_qualifier, table_owner, table_name, column_name, text_ptr, ret_value
The number returned by this procedure may differ from that returned by sp_datalength if multibyte characters are in use.
Provides a complete list of configuration names, minimum and maximum values, configured values, and current run values for each item.
sp_configure
This procedure returns an empty result set since none of the configuration information is supported.
Obtains the length of the text data, in bytes, referenced by the text pointer.
sp_datalength table_qualifier, table_owner, table_name, column_name, text_ptr, ret_value
This procedure does not allow parameters.
The number returned by this procedure may differ from that returned by sp_char_length if multibyte characters are in use.
Returns the current user name as the sole user group.
sp_groups
This procedure does not allow parameters.
This procedure was created for DirectConnect. It is not documented in any Adaptive Server or ODBC manuals.
ResultsThe following table shows the result set:
Column | Datatype | Description |
GROUP_NAME | char(8) | Group Name (Authorization ID) |
Returns the following information:
The service name of the service in use
The version of Open Server in use
The version of the DirectConnect Server in use
The version of the DirectConnect Access Service Library in use
The version of the DBMS with which the access service is associated
sp_helpserver
This procedure does not allow parameters.
not defined
Changes or queries the current status of the user's password.
sp_password your_password, new_password,[, login_name]
is the password for the user of this procedure.
new_passwordis the new password for the user. It must conform to the rules required on the DBMS in which the password change is to take effect.
login_nameis the login name of the user whose password is to be changed. Security is maintained by the DBMS, which should reject the request if the user is not logged in as the System Administrator.
The behavior of this procedure depends upon the capabilities of each DBMS.
If the procedure is not supported, the access service issues an error message.
The DirectConnect Anywhere Access Service does not support this procedure.
Finds the character position in a text column that contains the supplied pattern.
sp_patindex table_qualifier, table_owner, table_name, column_name, text_ptr, ret_value
This procedure does not allow parameters.
Not defined
Provides information about SQL grammar, syntax, and capabilities that the target DBMS supports.
sp_sqlgetinfo [attribute_name]
is the name of a particular SQL option.
This function corresponds to the ODBC function SQLGetInfo.
If this procedure is called, but no option is specified, the result set includes all SQL options.
If the attribute is not found in the internal table, the access service returns an error.
If the parameter is not provided, the access service returns a result set of all supported SQL options.
Result set information is described in the following sections.
FormatThe format is shown in the following table.
sql_option | varchar(30) | not null |
sql_value | varchar(255) | null |
If the sql_value column is NULL, this option is not supported for the target DBMS.
Common VariablesThe return string for some options includes embedded variable information. These variables have the same meaning for all access service DBMS targets. The stored procedure describes when and how to use the variables. Common variables embedded in a return string are prefixed with the "&" character.
Common variables are shown in the following table. The value returned for each option can vary depending upon the ODBC driver.
Variable | Description |
&QualifierName | Required in the SQL statement. Use "sp_sqlgetinfo SQL_Max_Qualifier_Name_Len" to determine the maximum length. |
&LocationName | Used in the "SQL_CREATE_TABLE_SUFFIX" or "SQL_Alt_Create_Table_Suffix" sql_option return strings. A location name is required in the SQL statement at the location indicated. Use "sp_sqlgetinfo SQL_Location_Name_Format" and "sp_sqlgetinfo SQL_Location_Name_Len" to determine the format and maximum length, respectively. |
SQL options are shown in the following two tables. The first table lists DirectConnect options and SQL options A through L.
SQL Options | Description |
ICD_Cursor_Support | Bitmask indicating cursor support. |
ICD_Dynamic_Support | Bitmask indicating dynamic statement support. |
ICD_Execdirect | Bitmask indicating how dynamic execdirect statement is supported. |
ICD_Language_Support | Bitmask indicating language statement support. No parameter marker support. |
ICD_Longtypes_Supported | Support for long types as parameters. |
ICD_Modify_Groupby | Intersolv driver insures GROUP BY clause when aggregate functions are used as part of the select list. |
SQL_Accessible_Procedures | User can execute all procedures returned by sp_stored_procedures. |
SQL_Accessible_Tables | User is guaranteed SELECT privileges to tables returned by sp_tables. |
SQL_Active_Connections | No known limit to the number of connections. |
SQL_Active_Statements | No known limit to the number of statements for a connection. |
SQL_Alter_Table | Bitmask indicating which clauses in ALTER TABLE are supported. |
SQL_Bookmark_Persistence | Bitmask enumerating through which bookmarks persist. None supported. |
SQL_Column_Alias | Support for column alias. |
SQL_Concat_Null_Behavior | Bitmask indicating how the DBMS handles concatenations with NULLS. |
SQL_Convert_Bigint SQL_Convert_Binary SQL_Convert_Bit SQL_Convert_Char SQL_Convert_Date SQL_Convert_Decimal SQL_Convert_Double SQL_Convert_Float SQL_Convert_Integer SQL_Convert_Longvarbinary SQL_Convert_Longvarchar SQL_Convert_Numeric SQL_Convert_Real SQL_Convert_Smallint SQL_Convert_Time SQL_Convert_Timestamp SQL_Convert_Tinyint SQL_Convert_Varbinary SQL_Convert_Varchar | Bitmask indicating conversions "to type" supported. |
SQL_Convert_Functions | Bitmask indicating conversion functions supported. |
SQL_Correlation_Name | Table correlation names supported. |
SQL_CSP_Support | Sybase/Intersolv extension for supporting CSPs. Value = 16383. |
SQL_Cursor_Commit_Behavior | Bitmask indicating how a COMMIT operation affects a cursor. |
SQL_Cursor_Rollback_Behavior | Bitmask indicating how a ROLLBACK operation affects a cursor. |
SQL_Database_Name | Value provided by the DirectConnect Server. |
SQL_Date_Source_Read_Only | The data source is read/write. |
SQL_DBMS_Name | The target DBMS name. A maximum of 30 characters is returned. |
SQL_DBMS_Ver | The target DBMS version in the form ##.##.####. A maximum of 30 characters is returned. The version string may have target-specific information that follows. |
SQL_Default_TXN_Isolation | Bitmask indicating the default transaction level supported by the DBMS. |
SQL_Expressions_In_Orderby | Support for expressions in ORDER BY clause. |
SQL_Fetch_Direction | Bitmask enumerating supported options. |
SQL_File_Usage | Files treated in data source. |
SQL_Getdata_Extensions | Bitmask enumerating extensions to SQLGetData. |
SQL_Group_By | Bitmask indicating the relationship between GROUP BY columns supported in the DBMS. |
SQL_Identifier_Case | Defines whether identifiers are case-sensitive. |
SQL_Identifier_Quote_Char | Character used to delimit quoted identifiers. |
SQL_Keywords | See the Microsoft ODBC 3.5 Programmer's Reference and SDK Guide for information. |
SQL_Like_Escape_Clause | Support of "%" character and "_" character as escape characters in LIKE clause. |
SQL_Lock_Types | Bitmask enumerating supported lock types. |
The second table lists SQL options M through Z.
SQL Option | Description |
SQL_Max_Binary_Literal_Len | Maximum length of binary literal is either unknown or unlimited. |
SQL_Max_Char_Literal_Len | Maximum length of character literal is either unknown or unlimited. |
SQL_Max_Column_Name_Len | Maximum length for a column name. Convert this string to an integer. A value of 0 means not supported. |
SQL_Max_Columns_In_Group_By | Maximum number of columns allowed in a SQL GROUP BY clause. Convert this string to an integer. A value of 0 means that the limit is unknown or unlimited. |
SQL_Max_Columns_In_Index | Maximum number of columns allowed in a SQL CREATE INDEX. Convert this string to an integer. A value of 0 means that the limit is unknown. |
SQL_Max_Columns_In_Order_By | Maximum number of columns allowed in a SQL ORDER BY clause. Convert this string to an integer. A value of 0 means that the limit is unknown. |
SQL_Max_Columns_In_Select | Maximum number of columns allowed in a SQL SELECT column list. Convert this string to an integer. A value of 0 means that the limit is unknown. |
SQL_Max_Columns_In_Table | Maximum number of columns allowed in a SQL CREATE TABLE. Convert this string to an integer. A value of 0 means that the limit is unknown. |
SQL_Max_Cursor_Name_Len | Maximum length for a cursor name. Convert this string to an integer. A value of 0 means not supported. |
SQL_Max_Index_Size | Maximum number of characters allowed in the combined column length of an index. Convert this string to an integer. A value of 0 indicates that the limit is unknown. |
SQL_Max_Owner_Name_Len | Maximum length for an owner name. Convert this string to an integer. A value of 0 means not supported. |
SQL_Max_Procedure_Name_Len | Maximum length for a procedure name. Convert this string to an integer. A value of 0 means not supported. |
SQL_Max_Qualifier_Name_Len | Maximum length for a qualifier name. Convert this string to an integer. A value of 0 means not supported. |
SQL_Max_Row_Size | Maximum number of characters allowed in the combined column length of a row in a table. Convert this string to an integer. A value of 0 means that the limit is unknown. |
SQL_Max_Row_Size_Includes_Long | SQL_MAX_ROW_SIZE includes the length of all long datatypes. |
SQL_Max_Statement_Len | Maximum length allowed for a SQL statement. Convert this string to an integer. A value of 0 means that the limit is unknown. |
SQL_Max_Table_Name_Len | Maximum length allowed for a table name. Convert this string to an integer. A value of 0 means not supported. |
SQL_Max_Tables_In_Select | Maximum number of columns allowed in a SQL SELECT FROM clause. Convert this string to an integer. A value of 0 means that the limit is unknown. |
SQL_Max_User_Name_Len | Maximum length for the user name. Convert this string to an integer. A value of 0 means not supported. |
SQL_Mult_Result_Sets | Driver does not support multiple result sets in a given language event. |
SQL_Multiple_Active_TXN | Only one connection can have an active transaction. |
SQL_Need_Long_Data_Len | Need the length of the long datatypes. |
SQL_Non_Nullable_Columns | Bitmask indicating whether the DBMS supports non-nullable columns. |
SQL_Null_Collation | Bitmask indicating how the DBMS collates NULL values. |
SQL_Numeric_Functions | Bitmask indicating the supported scalar numeric functions. |
SQL_ODBC_API_Conformance | Bitmask enumerating ODBC level. |
SQL_ODBC_SAG_CLI_Conformance | Bitmask enumerating compliance to functions of the SAG specification. |
SQL_ODBC_SQL_Conformance | Bitmask indicating supported SQL grammar. |
SQL_ODBC_SQL_Opt_IEF | Support for Integrity Enhancement Facility |
SQL_Order_By_Columns_In_Select | Columns in ORDER BY clause must be in select list. |
SQL_Outer_Joins | Support for outer joins. |
SQL_Owner_Term | The DBMS term for an owner name. A maximum of 30 characters is returned. A null value means not supported. |
SQL_Owner_Usage | Bitmask indicating statements in which owners can be used. |
SQL_Pos_Operations | Bitmask enumerating the operations in SQLSetPos. |
SQL_Positioned_Statements | Bitmask indicating supported positioned SQL statements. |
SQL_Procedure_Term | DBMS term for a procedure name. A maximum of 30 characters is returned. A null value means not supported. |
SQL_Procedures | Support for procedures. |
SQL_Qualifier_Location | Bitmask indicating the position of the qualifier in a qualified table name. |
SQL_Qualifier_Name_Separator | Character or string separator between the qualifier and the name element. A maximum of five characters is returned. |
SQL_Qualifier_Term | DBMS term for a qualifier name. A maximum of 30 characters is returned. |
SQL_Qualifier_Usage | Bitmask indicating in which statements a qualifier can be used. |
SQL_Quoted_Identifier_Case | Bitmask describing SQL identifier case and storage in system tables when used in SQL statements. |
SQL_Row_Updates | See the Microsoft ODBC 3.5 Programmer's Reference and SDK Guide for information. |
SQL_Scroll_Concurrency | Bitmask identifying concurrency control options for scrollable cursors. |
SQL_Scroll_Options | Bitmask indicating scroll options for scrollable cursors. |
SQL_Search_Pattern_Escape | See the Microsoft ODBC 3.5Programmer's Reference and SDK Guide for information. |
SQL_Set_Database_Context | Sybase/Intersolv extension for supporting CSPs. If value = Y, the driver issues use_database_name to the configured database name and is sensitive to three-part names. |
SQL_Special_Characters | Special characters used in object names. All characters except a-z, A-Z, 0-9, and the underscore character. |
SQL_String_Functions | Bitmask indicating supported scalar string functions. |
SQL_Subqueries | Bitmask indicating predicates that support subqueries. |
SQL_System_Functions | Bitmask indicating supported scalar system functions. |
SQL_Table_Term | DBMS term for a table name. A maximum of 30 characters is returned. |
SQL_TimeDate_Add_Intervals | Bitmask indicating supported timestamp intervals associated with TIMESTAMPADD function. |
SQL_TimeDate_Diff_Intervals | Bitmask indicating supported timestamp intervals associated with TIMESTAMPDIFF function. |
SQL_TimeDate_Functions | Bitmask indicating supported timestamp intervals. |
SQL_TXN_Capable | Indicates the transaction support in the DBMS. |
SQL_TXN_Isolation_Option | Bitmask indicating transaction isolation levels. |
SQL_Union | Bitmask indicating support for UNION clause. |
SQL_User_Name | Current user name. A maximum of SQL_Max_User_Name_Len characters are returned. A null value means not supported. |
Determines whether a given text pointer is valid.
The DirectConnect Anywhere Access Service does not support this procedure.
sp_textvalid table_qualifier, table_owner, table_name, column_name, text_ptr, ret_value
This procedure does not allow parameters.
not defined
Enables the client to retrieve and set various thread properties.
sp_thread_props [ property_name [, property_value ]]
is the name of the property to be set or shown.
property_valueis the value to which the property is to be set.
If you do not provide any parameters, or if you provide only property_name, the access service returns a single result set consisting of every instance of property_name and the value for each.
Returns information about all current on-line users and processes, or about a particular user or process.
The DirectConnect for Anywhere Access Service does not support this procedure.
sp_who returns the following information:
Server process ID
Null for the process status
User name
Host computer name
Null for the blocking process
Current database name
Current command
sp_who [ username | "spid "]
This procedure does not allow parameters.
Example 1
Not defined
|
|