% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/advanced.R
\name{mdb_queries}
\alias{mdb_queries}
\title{List Or Retrieve Queries In An MDB Database}
\usage{
mdb_queries(
  path,
  query = NULL,
  list = TRUE,
  newline = FALSE,
  delimiter = " ",
  as_text = FALSE,
  as_list = TRUE
)
}
\arguments{
\item{path}{Path to \code{.mdb}/\code{.accdb} file.}

\item{query}{Character vector of query names. When \code{NULL} (the default),
the function lists available query names instead of fetching SQL.}

\item{list}{Logical; when \code{TRUE} (the default) and \code{query} is \code{NULL},
return the list of query names. Set to \code{FALSE} to suppress listing and
return \code{character(0)}.}

\item{newline}{Logical; when \code{TRUE} and \code{as_text = TRUE}, collapse names
with \code{"\\n"} instead of \code{delimiter}.}

\item{delimiter}{Character scalar used to collapse query names when
\code{as_text = TRUE}. Default \code{" "}.}

\item{as_text}{Logical; when \code{TRUE}, collapses the query name list into a
single string using \code{delimiter} (or \code{"\\n"} if \code{newline = TRUE}).}

\item{as_list}{Logical; defaults to \code{TRUE}. When \code{TRUE} and \code{query} is
supplied, wraps the result in a named \code{mdblist} object.}
}
\value{
When \code{query} is \code{NULL}: a character vector of query names (or a
collapsed string when \code{as_text = TRUE}). When \code{query} is supplied and
\code{as_list = TRUE}: a named \code{mdblist} of SQL text strings, one per query.
With a single query and \code{as_list = FALSE}: a character scalar.
}
\description{
\code{mdb-queries} is a utility program distributed with MDB Tools.
Without \code{query}, it lists the names of all saved queries in the database.
With \code{query}, it returns the SQL text of the named query or queries.
}
\examples{
db <- mdbr:::.mdb_example_nwind_path()
if (nzchar(db)) {
  mdb_queries(db)
  mdb_queries(db, "Orders Qry")
}
}
