Table of Contents

Class SQLiteConnectionDataProvider

Namespace
combit.Reporting.DataProviders
Assembly
combit.ListLabel31.CrossPlatform.dll

Provides a data provider implementation for SQLite databases.

[Serializable]
public class SQLiteConnectionDataProvider : DbConnectionDataProvider, IDataProvider, ICanHandleUsedIdentifiers, IDisposable, ISupportsLogger, ISerializable
Inheritance
SQLiteConnectionDataProvider
Implements
Derived
Inherited Members

Examples

The following example demonstrates how to use the SQLiteConnectionDataProvider to export a report to PDF:

// Example 1: Connect using a file path
SQLiteConnectionDataProvider provider = new SQLiteConnectionDataProvider(
    @"C:\Data\myDatabase.db");

// Create a ListLabel reporting engine instance and assign the provider as the data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;

// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;

// Export the report to PDF.
listLabel.Export(exportConfiguration);

// Example 2: Connect using a connection string
SQLiteConnectionDataProvider connProvider = new SQLiteConnectionDataProvider(
    "Data Source=C:\\Data\\myDatabase.db; Version=3");

// Example 3: Connect to an in-memory database
SQLiteConnectionDataProvider memoryProvider = new SQLiteConnectionDataProvider(
    "Data Source=:memory:; Version=3");

// Example 4: Use existing SQLite connection
var connection = new System.Data.SQLite.SQLiteConnection(
    "Data Source=C:\\Data\\myDatabase.db; Version=3");
SQLiteConnectionDataProvider existingConnProvider = new SQLiteConnectionDataProvider(connection);

// Example 5: Filter to only tables (exclude views)
SQLiteConnectionDataProvider tablesOnlyProvider = new SQLiteConnectionDataProvider(
    @"C:\Data\myDatabase.db");
tablesOnlyProvider.SupportedElementTypes = DbConnectionElementTypes.Table;

// Example 6: Disable advanced filtering if needed
SQLiteConnectionDataProvider simpleProvider = new SQLiteConnectionDataProvider(
    @"C:\Data\myDatabase.db");
simpleProvider.SupportsAdvancedFiltering = false;

Remarks

The SQLiteConnectionDataProvider class extends DbConnectionDataProvider to provide connectivity to SQLite, a self-contained, serverless, zero-configuration SQL database engine widely used for embedded databases, mobile applications, and lightweight data storage. The provider uses System.Data.SQLite and automatically discovers tables and views, parsing SQLite's schema (sqlite_master) to extract foreign key relationships. It supports both file-based and in-memory databases, with special handling for in-memory connections that remain open throughout the provider's lifetime. The provider can accept either a connection string or a simple file path (automatically converted to a connection string). Foreign key relationships are extracted by parsing CREATE TABLE statements using regular expressions. It supports custom filter syntax translation for List & Label expressions, converting them to SQLite-compatible SQL syntax. Native aggregate function mapping provides SQLite-specific function names. The provider handles composite foreign keys and supports both tables and views through configurable element type filtering.

Constructors

SQLiteConnectionDataProvider(IDbConnection)

Initializes a new instance of the SQLiteConnectionDataProvider class with the specified connection.

public SQLiteConnectionDataProvider(IDbConnection connection)

Parameters

connection IDbConnection

An IDbConnection instance. The connection object must be of type System.Data.SQLite.SQLiteConnection.

Exceptions

ListLabelException

Thrown if the connection object is not of the expected type.

SQLiteConnectionDataProvider(SerializationInfo, StreamingContext)

Initializes a new instance of the SQLiteConnectionDataProvider class from serialized data.

protected SQLiteConnectionDataProvider(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The SerializationInfo containing the serialized object data.

context StreamingContext

The StreamingContext that contains contextual information about the source or destination.

SQLiteConnectionDataProvider(string)

Initializes a new instance of the SQLiteConnectionDataProvider class using the specified connection string.

public SQLiteConnectionDataProvider(string connectionString)

Parameters

connectionString string

The connection string used to open the SQLite connection.

Properties

SupportedElementTypes

Gets or sets the supported DbConnectionElementTypes for the database connection.

public DbConnectionElementTypes SupportedElementTypes { get; set; }

Property Value

DbConnectionElementTypes

Remarks

This property indicates which element types (tables, views) are supported by this data provider.

SupportsAdvancedFiltering

Gets or sets a value indicating whether advanced filtering is supported by the data provider.

public override bool SupportsAdvancedFiltering { get; set; }

Property Value

bool

Methods

GetNativeAggregateFunctionName(NativeAggregateFunction)

Gets the native aggregate function name for the specified aggregate function instance.

protected override string GetNativeAggregateFunctionName(NativeAggregateFunction functionInstance)

Parameters

functionInstance NativeAggregateFunction

An instance of the native aggregate function.

Returns

string

The native aggregate function name as defined by SQLite.

Init()

Initializes the data provider by retrieving the schema information from the database.

protected override void Init()

Remarks

This method retrieves information about tables and views using the GetSchema method of the connection. It then creates commands for each table and analyzes the SQL definition to detect foreign key relationships.

OnTranslateFilterSyntax(object, TranslateFilterSyntaxEventArgs)

Translates filter syntax from the data provider into SQLite-specific filter syntax.

protected override void OnTranslateFilterSyntax(object sender, TranslateFilterSyntaxEventArgs e)

Parameters

sender object

The source of the filter translation request.

e TranslateFilterSyntaxEventArgs

A TranslateFilterSyntaxEventArgs that contains the event data.