odbcConnectionColumns: odbcConnectionColumns

odbcConnectionColumnsR Documentation

odbcConnectionColumns

Description

For a given table this function returns detailed information on all fields / columns. The expectation is that this is a relatively thin wrapper around the ODBC SQLColumns function call, with some of the field names renamed / re-ordered according to the return specifications below.

Usage

odbcConnectionColumns(conn, name, ...)

## S4 method for signature 'OdbcConnection,Id'
odbcConnectionColumns(conn, name, column_name = NULL)

## S4 method for signature 'OdbcConnection,character'
odbcConnectionColumns(
  conn,
  name,
  catalog_name = NULL,
  schema_name = NULL,
  column_name = NULL
)

## S4 method for signature 'OdbcConnection,SQL'
odbcConnectionColumns(conn, name, ...)

## S4 method for signature 'Oracle,character'
odbcConnectionColumns(
  conn,
  name,
  catalog_name = NULL,
  schema_name = NULL,
  column_name = NULL
)

Arguments

conn

OdbcConnection

name

table we wish to get information on

...

additional parameters to methods

column_name

The name of the column to return, the default returns all columns.

catalog_name

character catalog where the table is located

schema_name

character schema where the table is located

Details

In dbWriteTable() we make a call to this method to get details on the fields of the table we are writing to. In particular the columns data_type, column_size, and decimal_digits are used. An implementation is not necessary for dbWriteTable() to work.

odbcConnectionColumns is routed through the SQLColumns ODBC method. This function, together with remaining catalog functions (SQLTables, etc), by default ( SQL_ATTR_METADATA_ID == false ) expect either ordinary arguments (OA) in the case of the catalog, or pattern value arguments (PV) in the case of schema/table name. For these, quoted identifiers do not make sense, so we unquote identifiers prior to the call.

Query, rather than use SQLColumns ODBC API for ORACLE since when using the API we bind a BIGINT to one of the column results. Oracle's OEM driver is unable to handle.

Value

data.frame with columns

  • name

  • field.type - equivalent to type_name in SQLColumns output

  • table_name

  • schema_name

  • catalog_name

  • data_type

  • column_size

  • buffer_length

  • decimal_digits

  • numeric_precision_radix

  • column_default

  • sql_data_type

  • sql_datetime_subtype

  • char_octet_length

  • ordinal_position

  • nullable

See Also

The ODBC documentation on SQLColumns for further details.

The ODBC documentation on Arguments to catalog functions.


odbc documentation built on July 9, 2023, 7:04 p.m.