GetODBCFields()

Summary

Gets a list of all fields in an ODBC table.

Syntax

field_names = GetODBCFields(string table_name, string schema_name, string data_source_name)

Argument Contents
table_name Name of a table in the specified ODBC data source
schema_name Name of the schema
data_source_name Name of an ODBC data source

Returns

An array of two elements:

Element Type Contents
1 Array An array of field names (strings)
2 Array An array of strings indicating whether the fields are indexed, with the values "No", "Yes", "Unique" and "Primary" ("Unique" means that each value is unique, "Primary" indicates this is the primary key for the table)

Notes

  • GetODBCFields() never returns null. The field_names array always includes at least one field.

  • GetODBCFields() calls the ODBC API function SQLColumns and returns the field names returned by SQLColumns. See ODBC API documentation for details.

  • Table names returned by GetODBCTables() are always acceptable as inputs to GetODBCFields(). However, if the input table_name is a direct input from the user, it must follow the conventions required by the ODBC data source. If the wrong form is used, the data source may not recognize the table and result in a NotFound error. For table names conventions, see the relevant data source/driver documentation.

Error Codes

Error Type Meaning
Error An error occurred while connecting to the given ODBC data source or while executing an ODBC API function
NotFound The specified table does not exist in the data source

See Also

Function Summary
GetODBCDataSourceInfo() Gets information about an ODBC data source
GetODBCDataSourceNames() Gets an array of the names of all defined ODBC data sources
GetODBCTables() Gets a list of all the tables in an ODBC data source