Closed brownag closed 1 year ago
Now w/ https://github.com/brownag/gpkg/commit/dfd755f5830bdbb49bccfaad1b0162131986b401 I get:
library(gpkg)
g <- geopackage()
g
#> <geopackage>
#> --------------------------------------------------------------------------------
#> # of Tables: 0
#>
#>
#> --------------------------------------------------------------------------------
# works
gpkg_connect(g)
#> <geopackage>
#> --------------------------------------------------------------------------------
#> # of Tables: 0
#>
#>
#> --------------------------------------------------------------------------------
#> <SQLiteConnection>
#> Path: /tmp/RtmpKe9spX/Rgpkg2ea944417fc85.gpkg
#> Extensions: TRUE
g
#> <geopackage>
#> --------------------------------------------------------------------------------
#> # of Tables: 0
#>
#>
#> --------------------------------------------------------------------------------
#> <SQLiteConnection>
#> Path: /tmp/RtmpKe9spX/Rgpkg2ea944417fc85.gpkg
#> Extensions: TRUE
# works
g <- gpkg_connect(g)
g
#> <geopackage>
#> --------------------------------------------------------------------------------
#> # of Tables: 0
#>
#>
#> --------------------------------------------------------------------------------
#> <SQLiteConnection>
#> Path: /tmp/RtmpKe9spX/Rgpkg2ea944417fc85.gpkg
#> Extensions: TRUE
# works
gpkg_disconnect(g)
g
#> <geopackage>
#> --------------------------------------------------------------------------------
#> # of Tables: 0
#>
#>
#> --------------------------------------------------------------------------------
#> <SQLiteConnection>
#> DISCONNECTED
Reopening, may be closed by #11
Often there isn't a need to manually connect a
geopackage
object because connections are created and destroyed on the fly. However, when performing many database operations it may be beneficial to make use of a persistent connection to avoid the extra overhead of repeatedly closing and re-opening.Currently, you need to overwrite the object to connect to the database and have that connection "stick".
Connecting to a database and not saving the result prevents from being able to reference the pointer in the future to be disconnected (which causes warnings:
Warning message: call dbDisconnect() when finished working with a connection
).It would be nice to come up with a way that in-place modification of a geopackage object could be used to update the connection field.