spec_sql_list_objects
dbListObjects()
returns a data frame
with columns
table
and is_prefix
(in that order),
optionally with other columns with a dot (.
) prefix.
The table
column is of type list.
Each object in this list is suitable for use as argument in dbQuoteIdentifier()
.
The is_prefix
column is a logical.
This data frame contains one row for each object (schema, table
and view)
accessible from the prefix (if passed) or from the global namespace
(if prefix is omitted).
Tables added with dbWriteTable()
are part of the data frame. As soon a table is removed from the database, it is also removed from the data frame of database objects.
The same applies to temporary objects if supported by the database.
The returned names are suitable for quoting with dbQuoteIdentifier()
.
An error is raised when calling this method for a closed or invalid connection.
The prefix
column indicates if the table
value refers to a table
or a prefix.
For a call with the default prefix = NULL
, the table
values that have is_prefix == FALSE
correspond to the tables
returned from dbListTables()
,
The table
object can be quoted with dbQuoteIdentifier()
.
The result of quoting can be passed to dbUnquoteIdentifier()
.
(We have to assume that the resulting identifier is a table, because one
cannot always tell from a quoted identifier alone whether it is a table
or a schema for example. As a consequence, the quote-unquote roundtrip
only works for tables (possibly schema-qualified), but not for other
database objects like schemata or columns.)
The unquoted results are equal to the original table
object.
(For backends it may be convenient to use the Id class, but this is
not required.)
Values in table
column that have is_prefix == TRUE
can be
passed as the prefix
argument to another call to dbListObjects()
.
For the data frame returned from a dbListObject()
call with the
prefix
argument set, all table
values where is_prefix
is
FALSE
can be used in a call to dbExistsTable()
which returns
TRUE
.
Other sql specifications:
spec_sql_append_table
,
spec_sql_create_table
,
spec_sql_exists_table
,
spec_sql_list_fields
,
spec_sql_list_tables
,
spec_sql_quote_identifier
,
spec_sql_quote_literal
,
spec_sql_quote_string
,
spec_sql_read_table
,
spec_sql_remove_table
,
spec_sql_unquote_identifier
,
spec_sql_write_table