close_db: Close a database connection

View source: R/database.R

close_dbR Documentation

Close a database connection

Description

[Stable]

This is a convenience function that is simply a wrapper around DBI::dbDisconnect().

Usage

close_db(db)

Arguments

db

A database connection to an m-Path Sense database.

Value

Returns invisibly regardless of whether the database is active, valid, or even exists.

See Also

open_db() for opening an mpathsenser database.

Examples

# First create a database in a temporary directory
db <- create_db(tempdir(), "mydb.db")

# Then close it
close_db(db)

# You can even try to close a database that is already closed. This will not trigger an error.
close_db(db)

# Cleanup
file.remove(file.path(tempdir(), "mydb.db"))

mpathsenser documentation built on May 29, 2024, 9:11 a.m.