dbq | R Documentation |
query the database using an user-defined connection or a temp connection based on saved credentials.
dbq(con, q, geom, ...) ## S4 method for signature 'MySQLConnection,character,ANY' dbq(con, q, enhance = FALSE, asUTC = TRUE, ...) ## S4 method for signature 'MariaDBConnection,character,ANY' dbq(con, q, asUTC = TRUE, ...) ## S4 method for signature 'missing,character,ANY' dbq(q, enhance = FALSE, ...) ## S4 method for signature 'MySQLConnection,character,character' dbq(con, q, geom = "SHAPE", tableNam, ...)
con |
a connection object returned by |
q |
a query string. credentials are stored on disk. |
geom |
name of the geometry column. Default to 'SHAPE' |
... |
pass to dbGetQuery |
enhance |
FALSE. if TRUE then enhanceOutput() is applied by reference on the output. |
asUTC |
for MariaDBConnection. not yet implemented |
tableNam |
name of the table containing the geometry. |
a data.frame or a Spatial*DataFrame (spatial_MySQL) for a SELECT query, or NULL for non-SELECT queries.
saveCredentials
,dbcon
## Not run: # A connection is made and used by dbq con = dbcon('testuser', host = '127.0.0.1', pwd = 'cs') d1 = dbq(con, 'SELECT * from tests.t1') d2 = dbq(con, 'SELECT * from tests.t1', enhance = TRUE) # A temp. connection is made and closed once the data is retrieved dbq(q = 'select now()', user = 'testuser', host = '127.0.0.1', pwd = 'cs') dbq(q = 'select now()', user = 'testuser',host = '127.0.0.1', pwd = 'cs', enhance = TRUE)%>% print # spatial return s = dbq(con, q = 'select * from tests.t3', geom = 'SHAPE') s = dbq(con, q = 'select SHAPE from tests.t3', geom = 'SHAPE') s = dbq(con, q = 'select * from tests.t2', geom = 'SHAPE') ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.