Name

sql_primary_keys — get primary key information about a table on a remote DSN

Synopsis

vector sql_primary_keys ( in dsn varchar ,
in qualifier varchar ,
in owner varchar ,
in table_name varchar );

Description

You can use the functions described here to find out information about the remote datasources that you are using. These could be especially useful in Virtuoso PL later on if you are not able to know everything about the remote tables ahead of time for the ATTACH TABLE statement. statement

These SQL functions correspond to the ODBC catalog calls of similar name. These are used to access the data dictionary of remote data sources inside the ATTACH TABLE process.

The dsn argument must refer to a dsn previously defined by vd_remote_data_source or ATTACH TABLE.

For instance, the qualifier argument corresponds to the szTableQualifier and cbTableQualifier arguments of an ODBC catalog function. A SQL NULL value corresponds to the C NULL value. The arguments can contain % signs, which are interpreted as in LIKE.

These functions return an array, with one element for each row of the result set. Each row is represented as an array with one element for each column.

Parameters

dsn

The data source name string

qualifier

Qualifier string . May contain wildcards as in 'De%'.

owner

Table owner string . May contain wildcard characters in 'Dem%'.

table_name

Table name string . May contain wildcard characters in 'Cust%'.

Return Types

As defined in ODBC API for the corresponding catalog call.

An array, with one element for each row of the result set. Each row is represented as an array with one element for each column.

Examples

Example24.395.Simple Example

dbg_obj_print (sql_primary_keys ('Local Virtuoso', 'Demo', NULL, 'Orders'));
->
(
 ("Demo" "demo" "Orders" "OrderID" 1 "Orders" "Demo" "demo" "Orders" )
)