EVOLUTION-MANAGER
Edit File: backend_dbplyr.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Database and SQL generics.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for backend_dbplyr {dplyr}"><tr><td>backend_dbplyr {dplyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Database and SQL generics.</h2> <h3>Description</h3> <p>The <code>sql_</code> generics are used to build the different types of SQL queries. The default implementations in dbplyr generates ANSI 92 compliant SQL. The <code>db_</code> generics execute actions on the database. The default implementations in dbplyr typically just call the standard DBI S4 method. </p> <h3>Usage</h3> <pre> db_desc(x) sql_translate_env(con) db_list_tables(con) db_has_table(con, table) db_data_type(con, fields) db_save_query(con, sql, name, temporary = TRUE, ...) db_begin(con, ...) db_commit(con, ...) db_rollback(con, ...) db_write_table(con, table, types, values, temporary = FALSE, ...) db_create_table(con, table, types, temporary = FALSE, ...) db_insert_into(con, table, values, ...) db_create_indexes(con, table, indexes = NULL, unique = FALSE, ...) db_create_index(con, table, columns, name = NULL, unique = FALSE, ...) db_drop_table(con, table, force = FALSE, ...) db_analyze(con, table, ...) db_explain(con, sql, ...) db_query_fields(con, sql, ...) db_query_rows(con, sql, ...) sql_select( con, select, from, where = NULL, group_by = NULL, having = NULL, order_by = NULL, limit = NULL, distinct = FALSE, ... ) sql_subquery(con, from, name = random_table_name(), ...) sql_join(con, x, y, vars, type = "inner", by = NULL, ...) sql_semi_join(con, x, y, anti = FALSE, by = NULL, ...) sql_set_op(con, x, y, method) sql_escape_string(con, x) sql_escape_ident(con, x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>con</code></td> <td> <p>A database connection.</p> </td></tr> <tr valign="top"><td><code>table</code></td> <td> <p>A string, the table name.</p> </td></tr> <tr valign="top"><td><code>fields</code></td> <td> <p>A list of fields, as in a data frame.</p> </td></tr> </table> <h3>Details</h3> <p>A few backend methods do not call the standard DBI S4 methods including </p> <ul> <li> <p><code>db_data_type()</code>: Calls <code><a href="../../DBI/html/dbDataType.html">DBI::dbDataType()</a></code> for every field (e.g. data frame column) and returns a vector of corresponding SQL data types </p> </li> <li> <p><code>db_save_query()</code>: Builds and executes a <code style="white-space: pre;">CREATE [TEMPORARY] TABLE <table> ...</code> SQL command. </p> </li> <li> <p><code>db_create_index()</code>: Builds and executes a <code style="white-space: pre;">CREATE INDEX <name> ON <table></code> SQL command. </p> </li> <li> <p><code>db_drop_table()</code>: Builds and executes a <code style="white-space: pre;">DROP TABLE [IF EXISTS] <table></code> SQL command. </p> </li> <li> <p><code>db_analyze()</code>: Builds and executes an <code style="white-space: pre;">ANALYZE <table></code> SQL command. </p> </li></ul> <p>Currently, <code><a href="copy_to.html">copy_to()</a></code> is the only user of <code>db_begin()</code>, <code>db_commit()</code>, <code>db_rollback()</code>, <code>db_write_table()</code>, <code>db_create_indexes()</code>, <code>db_drop_table()</code> and <code>db_analyze()</code>. If you find yourself overriding many of these functions it may suggest that you should just override <code>copy_to()</code> instead. </p> <p><code>db_create_table()</code> and <code>db_insert_into()</code> have been deprecated in favour of <code>db_write_table()</code>. </p> <h3>Value</h3> <p>Usually a logical value indicating success. Most failures should generate an error. However, <code>db_has_table()</code> should return <code>NA</code> if temporary tables cannot be listed with <code><a href="../../DBI/html/dbListTables.html">DBI::dbListTables()</a></code> (due to backend API limitations for example). As a result, you methods will rely on the backend to throw an error if a table exists when it shouldn't. </p> <hr /><div style="text-align: center;">[Package <em>dplyr</em> version 1.0.2 <a href="00Index.html">Index</a>]</div> </body></html>