ODBC_META Function

Searches for data source objects.

Restriction: See "Supported Platforms Guide" on the PV-WAVE Documentation website to check if this function is available on your operating system.

Usage

table = ODBC_META( connect_handle, option [, qualifier [, owner [, table_name [, col_name | table_type]]]]) 

Input Parameters

connect_handle—The handle returned by ODBC_CONNECT.

option—An integer specifying the information to retrieve, as follows:

1—Get the objects (tables, views, queries, etc. ) in the data source.

2—Get the columns for one or more objects.

3—Get the permission information on the objects in the data source.

4—Get permission information on the columns of one or more objects.

qualifier—A string describing a subset of the data on the server. This could be a database, a schema, or something else, depending upon the DBMS. If this parameter is missing or a null string ('') is specified, the query returns information on all objects in the current domain. Support of SQL wildcards in this field is implementation dependent.

owner—A string describing the owner of the data on the server. If specified, only the objects or columns belonging to owners that match this parameter will be returned. If this parameter is missing or a null string ('') is specified, the query returns information on all owners. SQL wildcards (such as '%') are supported in this field.

table_name—A string describing an object name on the server. In most cases, this will be a the name of a table object, but for some DBMS, it could also be a view or a query. If specified, only the object names that match this parameter will be returned. If this parameter is missing or a null string ('') is specified, the query returns information on all objects. SQL wildcards (such as '%') are supported in this field.

col_name or table_type—A string describing a column name or table type. For option 1, this parameter represents the table type (TABLE, VIEW, and so on.). For options 2 and 4, this parameter represents the column name. For option 3, this parameter is ignored. If this parameter is specified, only the object information that matches this parameter will be returned. If this parameter is missing or a null string ('') is specified, the query returns information on all appropriate objects. SQL wildcards (such as '%') are supported in this field.

Returned Value

table—A PV‑WAVE table containing meta-information for each object. If the function fails, –1 is returned.

Discussion

Not all drivers support all of the meta-information types. Not all drivers support searching on all of the string parameters; submit such parameters as empty strings.

Examples

table_info = ODBC_META( oracle_id, 1) 
; Returns PV-WAVE table of information on all objects (tables).
table_info = ODBC_META( oracle_id, 2) 
; Returns a PV-WAVE table of information on all columns of all 
; objects (tables) in the data source.
table_info = ODBC_META( oracle_id, 1, '', '', 'T%') 
; Returns a PV-WAVE table of information on all objects (tables) 
; in the data source with names that begin with T. If no such 
; objects exist, a value of 0L is returned. 
table_info = ODBC_META( oracle_id, 3) 
;Returns a PV-WAVE table of information on the privileges 
; associated with all objects (tables) in the data source.
table_info = ODBC_META( oracle_id, 4, '', 'Bob', 'Recordings') 
; Returns a PV-WAVE table of information on the privileges 
; associated with all columns in the table Recordings, owned by
; user Bob. If no such objects exist, a value of 0L is returned.