SQLite Connection (ISqliteConnection)Copy link to this sectionLink to this section copied!

OverviewCopy link to this sectionLink to this section copied!

The SQLite Connection provides a lightweight, file-based database option that can be bundled directly with your application. Unlike server-based databases, SQLite requires no external service or network configuration, making it ideal for embedded applications, local caches, or simple data storage scenarios.

Through this interface you can specify the database file path, configure whether the file should be created automatically if missing, and attach SQL queries or scripts to run during install, uninstall, or maintenance actions. Advanced Installer manages the execution flow, logging, and error handling based on your configuration.

This object is created using SqlDatabasesComponent.NewSQLiteConnection and appears in the SQL Databases page in Advanced Installer.

Isqldatabasescomponent sqlite connection

MethodsCopy link to this sectionLink to this section copied!

  • NewQuery (string name) → ISqlQuery Creates a new SQL query under this SQLite connection with the specified display name. Returns the created ISqlQuery.
  • DeleteQuery (ISqlQuery query) Deletes the specified ISqlQuery from this connection.
  • NewScript (string name) → ISqlScript Creates a new SQL script under this connection with the specified display name. Returns the created ISqlScript.
  • DeleteScript (ISqlScript script) Deletes the specified ISqlScript from this connection.

PropertiesCopy link to this sectionLink to this section copied!

  • Name (string) {get}{set} Gets or sets the display name of the SQLite connection.
  • Type (string) {get}{set} Gets or sets the connection type (always SQLite).
  • DatabaseFile (string) {get}{set} Gets or sets the SQLite database file path used at install time (e.g., [APPDIR]\data\app.db).
  • CreateDatabaseIfNotExists (bool) {get}{set} When true, creates the SQLite database file if it does not already exist.
  • Use64bitOdbcResource (bool) {get}{set} When true, uses 64-bit ODBC resources; otherwise, 32-bit.
  • LoginTimeout (uint) {get}{set} Gets or sets the login/open timeout in seconds.
  • Condition (string) {get}{set} Gets or sets a Windows Installer condition. When false, the connection and its operations are skipped.
  • IsVerbose (bool) {get}{set} Enables verbose logging for this connection’s operations.
  • LogErrorsToFile (bool) {get}{set} When true, logs errors to a file (location determined by project/logging settings).
  • Queries (SAFEARRAY(Variant)) {get} Returns an array of ISqlQuery objects defined under this connection.
  • Scripts (SAFEARRAY(Variant)) {get} Returns an array of ISqlScript objects defined under this connection.
  • Object (uint) {get} Read-only internal identifier for this connection instance.

Sample commandsCopy link to this sectionLink to this section copied!

# ISqliteConnection usage

$advinst  = New-Object -ComObject "AdvancedInstaller"
$project  = $advinst.CreateProject($advinst.ProjectTypes.Enterprise)

# Create a SQLite connection
$sqlite = $project.SqlDatabasesComponent.NewSQLiteConnection("App SQLite DB")

# Configure properties
$sqlite.DatabaseFile = "[APPDIR]\data\app.db"   # example project path
$sqlite.CreateDatabaseIfNotExists = $true
$sqlite.Use64bitOdbcResource = $true
$sqlite.LoginTimeout = 30
$sqlite.IsVerbose = $true
$sqlite.LogErrorsToFile = $true

# Add a query (SQLite syntax, ';' separator)
$q = $sqlite.NewQuery("Create Demo Table")
$q.StatementSeparator = ";"
$q.InlineScript = @"
CREATE TABLE demo (
  id   INTEGER PRIMARY KEY,
  name TEXT NOT NULL
);
"@

# List queries / scripts
$sqlite.Queries
$sqlite.Scripts

# Delete query (optional)
# $sqlite.DeleteQuery($q)

# Remove the connection (optional cleanup)
# $project.SqlDatabasesComponent.DeleteDatabaseObject($sqlite)

# Save project
$project.SaveAs("F:\cmdlet\output\DemoProject Enterprise - SQLite.aip")