Type: | Package |
Title: | Parse 'SQL' Statements |
Version: | 1.5 |
Author: | Subhasree Bose |
Maintainer: | Subhasree Bose <subhasree10.7@gmail.com> |
Description: | Parser for 'SQL' statements. Currently, it supports parsing of only 'SELECT' statements. |
License: | GPL-2 |
Imports: | stringr,stringi |
Depends: | R (≥ 2.1.0) |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.0 |
Suggests: | knitr, rmarkdown,testthat |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2020-05-11 15:28:25 UTC; Subhasree |
Repository: | CRAN |
Date/Publication: | 2020-05-14 08:40:06 UTC |
Get the bind variables in sql statement
Description
This function takes sql statement and returns all the bind variables in the sql statement.
Usage
get_all_bind_variables(sql)
Arguments
sql |
statement |
Value
all bind variables in the sql statement
Examples
get_all_bind_variables("select * from users where userid = :bind_userid")
Get the names of the selected columns in the sql statement
Description
This function takes sql statement and returns all the columns selected in the sql statement.
Usage
get_all_select_cols_with_alias(sql)
Arguments
sql |
statement |
Value
names of columns selected in sql statement
Examples
get_all_select_cols_with_alias("Select p from abc where xyz = 5")
Get the subqueries in sql statement
Description
This function takes sql statement and returns the list of subqueries.It does not return nested sub queries. For nested subqueries, each subquery needs to be fed into the method again.
Usage
get_all_subqueries(sql)
Arguments
sql |
statement |
Value
all subqueries for the sql statement
Examples
get_all_subqueries("select * from users where appid in
(select appid from applications)")
Get the names of the tables with alias present in the sql
Description
This function takes sql statement and returns the list of names of tables and alias for that table, if any present in the sql statement. The first column represent table name and second column represents alias.
Usage
get_all_tables_with_alias(sql)
Arguments
sql |
statement |
Value
names of tables with alias present in sql statement
Examples
get_all_tables_with_alias("Select p from abc where xyz = 5")