| dot-has_column | R Documentation |
Cross-database method to check if a column exists in a table. Uses database-specific introspection methods via S3 dispatch.
.has_column(conn, table_name, column_name)
## S3 method for class 'SQLiteConnection'
.has_column(conn, table_name, column_name)
## S3 method for class 'PqConnection'
.has_column(conn, table_name, column_name)
## S3 method for class 'MariaDBConnection'
.has_column(conn, table_name, column_name)
## S3 method for class ''Microsoft SQL Server''
.has_column(conn, table_name, column_name)
## S3 method for class 'duckdb_connection'
.has_column(conn, table_name, column_name)
## Default S3 method:
.has_column(conn, table_name, column_name)
conn |
Database connection (DBIConnection) |
table_name |
Character. Name of the table |
column_name |
Character. Name of the column to check |
Logical. TRUE if column exists, FALSE otherwise
.has_column(SQLiteConnection): SQLite implementation using PRAGMA
.has_column(PqConnection): PostgreSQL implementation using information_schema
.has_column(MariaDBConnection): MySQL/MariaDB implementation using information_schema
.has_column(`Microsoft SQL Server`): SQL Server implementation using information_schema
.has_column(duckdb_connection): DuckDB implementation using information_schema
.has_column(default): Default implementation for unknown database types
if (FALSE) {
conn <- connection_get("my_db")
has_deleted_at <- .has_column(conn, "users", "deleted_at")
DBI::dbDisconnect(conn)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.