Public methods
Method new()
Initializes a connection
Usage
RSQL.class$new(
drv,
dbname,
user = NULL,
password = NULL,
host = NULL,
port = NULL
)
Arguments
drvdriver name
dbnamedatabase name
useruser name
passwordpassword
hosthost name
portport number
Method setupRegexp()
initialize regexp for scraping entities
Usage
RSQL.class$setupRegexp(force = FALSE)
Arguments
forceforce setup?
Returns
regexp for scraping select expressions
Method finalize()
Class destructor
Usage
RSQL.class$finalize()
Method checkEntitiesNames()
Checks if an entity exists
Usage
RSQL.class$checkEntitiesNames(entities, entity.type)
Arguments
entitiesentities to check
entity.typeentity type to check against
Method gen_select()
Generates a select
Usage
RSQL.class$gen_select(
select_fields,
table,
where_fields = names(where_values),
where_values = NULL,
group_by = c(),
order_by = c(),
top = 0,
distinct = FALSE
)
Arguments
select_fieldsfields to be selected
tabletable to select from
where_fieldsfields in the where clause
where_valuesvalues to the fields on the where clause
group_byfields to group by
order_byfields to order by
topwhere does the resultset starts?
distinctprovides a way to select distinct rows
Method gen_insert()
Generate insert statement
Usage
RSQL.class$gen_insert(table, values_df, insert_fields = names(values_df))
Arguments
tableThe table to insert into
values_dfThe values to insert. Must be defined as data.frame of values
insert_fieldsthe fields to insert into
Method gen_update()
Generate insert statement
Usage
RSQL.class$gen_update(
table,
update_fields = names(values),
values,
where_fields = names(where_values),
where_values = NULL
)
Arguments
tablethe table to insert into
update_fieldsthe fields to update
valuesthe values to update
where_fieldsa where clause to the insert
where_valuesthe values to add to the where clause
Method gen_delete()
Generate a delete statement
Usage
RSQL.class$gen_delete(
table,
where_fields = names(where_values),
where_values = NULL
)
Arguments
tablethe table to insert into
where_fieldsa where clause to the insert
where_valuesthe fields to add to the where clause
Method execute_select()
Performs an execution on the database
Usage
RSQL.class$execute_select(sql_select)
Arguments
sql_selectthe sql select statement to perform
Method execute_update()
Performs an update on the database
Usage
RSQL.class$execute_update(sql_update)
Arguments
sql_updatethe sql update statement to perform
Method execute_insert()
Performs an insert on the database
Usage
RSQL.class$execute_insert(sql_insert)
Arguments
sql_insertthe sql insert statement to perform
Method execute_command()
Performs a command on the database
Usage
RSQL.class$execute_command(sql_command)
Arguments
sql_commandthe sql statement to perform
Method execute_delete()
Performs an deletion on the database
Usage
RSQL.class$execute_delete(sql_delete)
Arguments
sql_deletethe sql delete statement to perform
Method retrieve()
Performs an insert on the database. This is a composite function
Usage
RSQL.class$retrieve(
table,
fields_uk = names(values_uk),
values_uk,
fields = names(values),
values,
field_id = "id"
)
Arguments
tableThe table
fields_ukThe fields unique key
values_ukThe values unique key
fieldsThe fields (Not used. Included for compatibility)
valuesThe values (Not used. Included for compatibility)
field_idThe field of the serial id
Method retrieve_insert()
Obtain id if object exists on the database. Insert object if not.
Usage
RSQL.class$retrieve_insert(
table,
fields_uk = names(values_uk),
values_uk,
fields = names(values),
values,
field_id = "id"
)
Arguments
tableThe table
fields_ukThe fields unique key
values_ukThe values unique key
fieldsThe fields
valuesThe values
field_idThe field of the serial id
Method disconnect()
Disconnects the instance from the database
Usage
RSQL.class$disconnect()
Method clone()
The objects of this class are cloneable with this method.
Usage
RSQL.class$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.