TBIDB class provides comprehensive database import capabilities, supporting any database with a Delphi/FPC connection component. Import entire schemas or individual tables with automatic relationship detection.
Quick Start
Key Methods
Import Connection
Import all tables from a database connection:Import Single Table
ImportFile
Import from database files (SQLite, Access, etc):Database Engines
TBIDB is abstract and requires a specific engine. Set the engine before use:- FireDAC (Delphi)
- IBX (InterBase Express)
- ADO (Windows)
- FPC/SQLDB (FreePascal)
Advanced Import Options
Multi-threaded Import
For faster import of multiple tables:Filter Tables
Import only specific tables using patterns:Include System Tables
DataDefinition Import
Create connections from configuration:Schema Detection
TBIDB automatically detects:- Primary Keys: Marked on columns with
.Primary := True - Foreign Keys: Automatic relationship detection
- Field Types: Mapped to TDataKind types
- Indexes: Key field detection
Execute SQL Queries
Import results from SQL queries:Progress Monitoring
Export to Database
UseTBIDBExport to save TDataItem back to database:
Add to Existing DataSet
Supported Databases
Depending on the engine:- SQL Server (via FireDAC, ADO)
- MySQL / MariaDB
- PostgreSQL
- SQLite
- Oracle
- InterBase / Firebird
- DB2
- Access (via ADO)
- ODBC connections
Common Patterns
Import from FireDAC
Import Specific Tables
Get Table Names
Performance Tips
- Multi-threading: Enable for databases with many tables
- Filter tables: Import only what you need
- Use SQL: For complex queries, use SQL instead of importing full tables
Common Issues
No engine configured error
No engine configured error
Set the database engine before use:
Connection fails to open
Connection fails to open
Check connection parameters and database driver installation.
Slow import of many tables
Slow import of many tables
Enable multi-threading:
Memory issues with large tables
Memory issues with large tables
Use SQL to limit rows:
