has_idx | R Documentation |
Check if the table holds an index on the specified columns and optionally check whether it is unique.
has_idx(conn, on_tbl, on_cols, keep_unique = FALSE, temp = FALSE)
conn |
An object of class |
on_tbl |
A table in the database. |
on_cols |
A character vector with the columns to check. |
keep_unique |
A logical. Additionally check if the index has the UNIQUE constraint. Default is FALSE. |
temp |
Should |
The function only checks exact matching of on_cols
, that is, the
order of columns in on_cols
needs to correspond to the order of columns in
the CREATE INDEX statement: If on_cols = c("col1", "col2")
, but the
database has "CREATE UNIQUE INDEX idx1 ON mytable(col2, col1)"
,
the function will return FALSE.
A logical.
conn <- connect_to_db(db_example("AcademicGraph.sqlite"))
has_idx(conn, "author_output", "AuthorId", keep_unique = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.