Package 'RSqlParser'

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

Help Index


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")