% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/duckhts.R
\name{rduckhts_connect}
\alias{rduckhts_connect}
\title{Create a DuckDB connection with bundled DuckHTS loaded}
\usage{
rduckhts_connect(
  dbdir = ":memory:",
  read_only = FALSE,
  bigint = "numeric",
  config = list(),
  extension_path = NULL
)
}
\arguments{
\item{dbdir}{Path to a DuckDB database, or \code{":memory:"} for an
in-memory database.}

\item{read_only}{Logical; open a file-backed database read-only.}

\item{bigint}{How DuckDB 64-bit integers are returned; passed to
\code{duckdb::duckdb()}.}

\item{config}{Named list of additional DuckDB configuration settings.}

\item{extension_path}{Optional path to a DuckHTS \code{.duckdb_extension}
file. If \code{NULL}, uses the extension bundled with Rduckhts.}
}
\value{
A DuckDB connection with DuckHTS loaded.
}
\description{
Creates a DuckDB connection that explicitly permits loading the package-built
DuckHTS extension, disables automatic installation and loading of unrelated
known DuckDB extensions, and loads the bundled DuckHTS extension.
}
\details{
Current versions of the \pkg{duckdb} R package can disable extension loading on
Linux builds that use a C++ standard library other than \code{libstdc++}.
DuckHTS is compiled locally with the same package toolchain, so this helper
explicitly enables extension loading for this package-owned connection.
Package-owned connections use per-session DuckDB extension/secret storage
by default when the installed \pkg{duckdb} version supports that setting.

DuckDB reuses a live database instance when the same file-backed \code{dbdir}
is opened again, ignoring new driver and configuration settings. This helper
rejects such reuse rather than silently weakening its connection policy. Use
\code{rduckhts_load()} on the existing connection if it already permits
unsigned, driver-level extension loading, or close the existing database
instance before calling this helper.

The settings \code{allow_unsigned_extensions},
\code{autoinstall_known_extensions}, and
\code{autoload_known_extensions} are controlled by this helper and override
entries with those names in \code{config}. Other named DuckDB settings are
passed through unchanged.
}
\examples{
con <- rduckhts_connect()
DBI::dbGetQuery(con, "SELECT duckhts_htslib_version() AS version")
DBI::dbDisconnect(con, shutdown = TRUE)

}
