Learn R Programming

RMySQL (version 0.4-6)

quickSQL: Quick SQL Execution

Description

Simplifies queries by submitting an SQL command and fetching its output in one function

Usage

quickSQL(con, statement, ...)

Arguments

con
an open dbConnection object.
statement
an SQL statement as a character vector.
...
any additional arguments specific to the database engine may be specified.

Value

  • a data.frame in the case of a SELECT-like statement, or NULL otherwise.

Bugs:

Perhaps this function should be named dbQuery or dbImmediate?

References

See the Omega Project for Statistical Computing at http://www.omegahat.org for more details on the R/S database interface.

Details

This function simply calls dbExecStatement followed by fetch.

See Also

On database managers:

dbManager MySQL load unload

On connections, SQL statements and resultSets:

dbExecStatement dbExec fetch quickSQL

On transaction management:

commit rollback

On meta-data:

describe getVersion getDatabases getTables getFields getCurrentDatabase getTableIndices getException getStatement hasCompleted getRowCount getAffectedRows getNullOk getInfo

Examples

Run this code
# The following extract all the tables in the current database

mgr <- dbManager("MySQL")
con <- dbConnect(mgr)
quickSQL(con, "show tables")

Run the code above in your browser using DataLab