Skip to contents

Creates a connection to either the live version or the test version of the Porowhita Hauwhā database. This can be used later if this function call is stored in an object. The connection to the live database is read-only.

Usage

connect_to_database(test_db = FALSE)

Arguments

test_db

Is this a connection to the test database? Defaults to FALSE.

Value

An S4 object. This object is used to communicate with the database engine, either live or test.

Examples

test_conn <- connect_to_database(test_db = TRUE)
DBI::dbGetQuery(test_conn, "SELECT * FROM assets")
#>     id                      name local_board          asset_type
#> 1  A26 Buckland Community Centre    Franklin Standalone Building
#> 2  A58       Franklin The Centre    Franklin Standalone Building
#> 3 A208                 Puni Hall    Franklin Standalone Building
#>               physical_address latitude longitude land_ownership image
#> 1 Cnr Logan and Buckville Road       NA        NA             NA    NA
#> 2             12 Massey Avenue       NA        NA             NA    NA
#> 3              329 Waiuku Road       NA        NA             NA    NA