Description Usage Arguments Details Examples
Represents a database, handling the connections itself. It allows you to perform operations through the use of functions (e.g. list tables, query data).
1 2 3 4 5 6 | credentials <- DatabaseCredentials$new("connection", "user", "password")
database <- Database$new(credentials)
database$list(tableType)
database$listTableInformation(tableName)
database$query(query)
|
Object containing all the information required to connect to a database.
Data structure normally used to describe the connection to a database.
Id of the user, usually necessary to perform database connections.
Password of the user, usually necessary to perform database connections.
Table type (e.g. TABLE, VIEW)
Name of the table inside a database.
SQL query to run against the database.
$new(databaseCredentials = NULL)
Creates an instance of Database.
$list(tableType = "TABLE")
List all the tables (name and description) in the database according to the type given.
$listTableInformation(tableName = "")
List the information about a given table (names of the columns, their type and nullability).
$query(query = NuLL)
Queries the database when given a valid SQL Query (e.g. SELECT * FROM table)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
# Building the Database object.
dsn <- "connection"
uid <- "root"
pwd <- "password"
databaseCredentials <- DatabaseCredentials$new(dsn, uid, pwd)
database <- Database$new(databaseCredentials)
# Listing all the tables and views in the database.
database$list("TABLE")
database$list("VIEW")
# List information about a sepecif table.
database$listTableInformation("tableName")
# Query the database to get information.
database$query("SELECT * FROM table")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.