get_idx_cols: Extract constituting columns from a "create index" statement

View source: R/db_checking.R

get_idx_colsR Documentation

Extract constituting columns from a "create index" statement

Description

This function takes a string from a SQL statement that creates an index on a table, and returns the columns that constitute the index.

Usage

get_idx_cols(stmt)

Arguments

stmt

A SQLite statement to create an index on a table on some columns. The function extracts the columns on which the index is created. As the example illustrates, "ASC" and "DESC" statements are removed.

Value

A character vector with the column names defining the index.

Examples

magutils:::get_idx_cols("CREATE INDEX idx1 ON mytable (col1 ASC, col2 ASC)")
# gives  c("col1", "col2")

f-hafner/magutils documentation built on Sept. 20, 2023, 5:05 a.m.