Title: | Parse 'SQL' Statements |
---|---|
Description: | Parser for 'SQL' statements. Currently, it supports parsing of only 'SELECT' statements. |
Authors: | Subhasree Bose |
Maintainer: | Subhasree Bose <[email protected]> |
License: | GPL-2 |
Version: | 1.5 |
Built: | 2024-12-19 06:56:53 UTC |
Source: | CRAN |
This function takes sql statement and returns all the bind variables in the sql statement.
get_all_bind_variables(sql)
get_all_bind_variables(sql)
sql |
statement |
all bind variables in the sql statement
get_all_bind_variables("select * from users where userid = :bind_userid")
get_all_bind_variables("select * from users where userid = :bind_userid")
This function takes sql statement and returns all the columns selected in the sql statement.
get_all_select_cols_with_alias(sql)
get_all_select_cols_with_alias(sql)
sql |
statement |
names of columns selected in sql statement
get_all_select_cols_with_alias("Select p from abc where xyz = 5")
get_all_select_cols_with_alias("Select p from abc where xyz = 5")
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.
get_all_subqueries(sql)
get_all_subqueries(sql)
sql |
statement |
all subqueries for the sql statement
get_all_subqueries("select * from users where appid in (select appid from applications)")
get_all_subqueries("select * from users where appid in (select appid from applications)")
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.
get_all_tables_with_alias(sql)
get_all_tables_with_alias(sql)
sql |
statement |
names of tables with alias present in sql statement
get_all_tables_with_alias("Select p from abc where xyz = 5")
get_all_tables_with_alias("Select p from abc where xyz = 5")