Description Usage Arguments Details See Also
'dbCreateTable' does not directly support adding primary or secondary indexes to the table being created. Properly chosen indexing of tables increases query performance.
1 | dbAddPrimaryKey(con, name, primary_key, ...)
|
con |
a DBConnection oject |
name |
a character string specifying the name of an existing DBMS table |
primary_key |
a character vector of column names which will form the primary key To specify a composite Primary Key for the 'symbol' and 'date' columns use primary_key = c("symbol","date" ) For a table with a Primary Key defined, each records must have a unqiue primary key. Attempts to 'INSERT' records with a duplicate Primary Key to an existing record in the DB will cause an ERROR |
The default 'dbAddPrimaryKey()' method performs checks that the targeted table exists and that the columns specified for the primary-key exist in the target table. the method throws an error if either condition is FALSE
The sql generation uses the function 'sqlAlterTableWithPrimaryKey()' another S4 generic defined in this package. Default sql generation is appropriate for MariaDB and MySQL.
Other DBIConnection generics: dbAddIndex
,
dbDeleteAllRecords
,
dbDropTable
,
dbReplaceInTable
,
dbUpdateTable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.