Description Usage Arguments Details Examples
Represents an SQL query factory, responsible for building SQL queries. By simply calling the available methods and supplying them with your needs, you get an SQLQuery object containing a query that can bring the information from the database.
1 2 3 4 5 | sqlFactory <- SQLQueryFactory$new()
sqlFactory$createSelect(tableMap, joinMap, distinct, where, groupBy, having)
sqlFactory$createView(viewName, tableMap, distinct, where, groupBy, having)
sqlFactory$deleteView(viewName)
|
Name of the table inside a database.
Name of the view inside a database.
Dataframe specifing which tables and columns should be used to extract information.
Dataframe specifing which tables to join and repective atributes.
Logical that dictates if the data retrieved should be distinct or not.
Filters the results by the specified conditions.
Groups the results by the values of one or more columns.
Further filters the results, by allowing the use of agreggation functions (e.g. COUNT, SUM, ...)
$new()
Creates an instance of DBAbstractR.
$connectToDatabase(dataSourceName = "", userID = "", password = "")
Performs the connection to a database, returning its information.
$listTables
Returns a dataframe with all the tables (name and description) in the database.
$listTableInformation(tableName = "")
Returns a dataframe with the information (names of the columns, their type and nullability) about a given table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# Building the SQLQueryFactory object.
sqlQueryFactory <- SQLQueryFactory$new()
# Selecting both the username and last_login from the user table.
tableMap <- data.frame(tableName = "user", columns = "username", "last_login")
sqlQueryFactory$createSelect(tableMap)
# Creating a view based on the user table where all registered users date from under 2009.
tableMap <- data.frame(tablename = "user", columns = "*")
where <- "register_date < 2010-01-01"
# Droping an existing view
sqlQueryFactory$deleteView("old_users")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.