db_init: Initialize a database

Description Usage Arguments Details Author(s)

View source: R/db_create.R

Description

Initialize an empty database

Usage

1
2
3
4
5
6
7
db_init(
  db_file,
  driver = SQLite(),
  con = dbConnect(driver, db_file),
  schema = strsplit(paste(readLines(schema_file), collapse = " "), ";")[[1]],
  schema_file = system.file("create_db.sql", package = "ybt")
)

Arguments

db_file

string, the full path and name of the database file to be initialized.

driver

A SQLite driver

con

A connection to an empty database. If the database does not exist, it will be created.

schema

string, a SQLite command to create the database

schema_file

a file with SQLite code specifying the schema for the database.

Details

This function initialized a database according to a schema. This is done so that contraints on the data fields, including keys, can be specified. Once initialized, the database can be populated while ensuring that the data meet the constraints.

Author(s)

Matt Espe


fishsciences/ybt documentation built on March 11, 2021, 8:45 a.m.