db_add_auto_id: Add an id Field

Description Usage Arguments Value Details Examples

View source: R/RMariaDBHelper.R

Description

Add an auto-number integer "id" field to a table.

Usage

1
2
3
4
5
6
7
db_add_auto_id(
  tablename,
  fieldname = "id",
  pk = TRUE,
  uniq = TRUE,
  conf_file = "~/.db_conf.yml"
)

Arguments

tablename

(character) The table name that will get the new "id" field.

fieldname

(character) The field name to use for the new "id" field. (Default: "id")

pk

(boolean) Add "id" as a PRIMARY KEY (TRUE) or not (FALSE). (Default: TRUE)

uniq

(boolean) Add "id" as a UNIQUE primary key (TRUE) or not (FALSE). (Default: TRUE)

conf_file

(character) A file containing database connection parameters. (Default: "~/.db_conf.yml")

Value

(boolean) Success: TRUE; failure: FALSE.

Details

An auto-incrementing, non-null, non-negative integer "id" field will be added to a table, set as an index, and optionally set as a primary key.

Examples

1
2
3
4
## Not run: 
db_add_auto_id("iris")

## End(Not run)

deohs/RMariaDBHelper documentation built on Dec. 31, 2020, 11:17 p.m.