# 22. Virtuoso Functions Guide - sql_gettypeinfo

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
att_local_name
quote_dotted
rclose
rexecute
rmoreresults
rnext
rstmtexec
sql_columns
sql_config_data_sour...
sql_data_sources
sql_driver_connect
sql_get_installed_dr...
sql_get_private_prof...
sql_gettypeinfo
sql_primary_keys
sql_procedures
sql_remove_dsn_from_...
sql_special_columns
sql_statistics
sql_tables
sql_transact
sql_write_file_dsn
sql_write_private_pr...
vd_remote_data_sourc...
vd_remote_proc_wrapp...
vd_remote_table
vd_statistics
vdd_disconnect_data_...
vdd_measure_rpc_time
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## sql_gettypeinfo

return type information from a remote DSN
vector sql_gettypeinfo (in dsn varchar, in type integer);
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.

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

By default information for all the data types supported by the remote is returned. The optional type argument (defaults to SQL_ALL_TYPES) limits the information returned to cover only the ODBC type number supplied.

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.

    dbg_obj_print (sql_gettypeinfo ('Local Virtuoso'));
    ->
    (
     ("character" 1 2000 "'" "'" "length" 1 1 3 0 0 0 "varchar" <DB NULL> <DB NULL> )
     ("numeric" 2 40 "" "" "precision,scale" 1 1 2 0 0 0 "numeric" 0 15 )
     ("decimal" 3 40 "" "" "precision,scale" 1 1 2 0 0 0 "decimal" 0 15 )
     ("integer" 4 10 "" "" <DB NULL> 1 1 2 0 0 0 "integer" 0 10 )
     ("smallint" 5 3 "" "" <DB NULL> 1 1 2 0 0 0 "smallint" <DB NULL> <DB NULL> )
     ("smallint" -7 3 "" "" <DB NULL> 1 1 2 0 0 0 "smallint" <DB NULL> <DB NULL> )
     ("float" 6 16 "" "e0" <DB NULL> 1 1 2 0 0 0 "double precision" <DB NULL> <DB NULL> )
     ("real" 7 16 "" "e0" <DB NULL> 1 1 2 0 0 0 "real" <DB NULL> <DB NULL> )
     ("double precision" 8 16 "" "e0" <DB NULL> 1 1 2 0 0 0 "double precision" <DB NULL> <DB NULL> )
     ("varchar" 12 2000 "'" "'" "length" 1 1 3 0 0 0 "varchar" <DB NULL> <DB NULL> )
     ("long varchar" -1 2147483647 "'" "'" <DB NULL> 1 1 0 0 0 0 "long varchar" <DB NULL> <DB NULL> )
     ("long varbinary" -4 2147483647 "'" "'" <DB NULL> 1 1 0 0 0 0 "long varbinary" <DB NULL> <DB NULL> )
     ("datetime" 11 19 "{ts" "}" <DB NULL> 1 1 3 0 0 0 "datetime" <DB NULL> <DB NULL> )
     ("timestamp" -2 10 "0x" <DB NULL> <DB NULL> 0 0 2 0 0 0 "timestamp" <DB NULL> <DB NULL> )
     ("time" 10 8 "{t" "}" <DB NULL> 1 1 2 0 0 0 "time" <DB NULL> <DB NULL> )
     ("date" 9 10 "{d" "}" <DB NULL> 1 1 2 0 0 0 "date" <DB NULL> <DB NULL> )
     ("binary" -2 2000 "0x" "" "length" 1 1 2 0 0 0 "varbinary" <DB NULL> <DB NULL> )
     ("varbinary" -3 2000 "0x" "" "length" 1 1 2 0 0 0 "varbinary" <DB NULL> <DB NULL> )
     ("nchar" -8 1000 "N'" "'" "length" 1 1 3 0 0 0 "nvarchar" <DB NULL> <DB NULL> )
     ("nvarchar" -9 1000 "N'" "'" "length" 1 1 3 0 0 0 "nvarchar" <DB NULL> <DB NULL> )
     ("long nvarchar" -10 1073741823 "N'" "'" <DB NULL> 1 1 0 0 0 0 "long nvarchar" <DB NULL> <DB NULL> )
    )

See Also

sql_data_sources, sql_columns sql_primary_keys, sql_statistics, sql_tables.