# info > DBI::DBD::SQlEngine

---
type: CommandReference
command: DBI::DBD::SqlEngine
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `use base qw(DBI::DBD::SqlEngine)` — inherit base class for DBI drivers without SQL engine
- `$drh->data_sources(\%attr)` — list data sources (subdirectories or custom)
- `$dbh->func("list_tables")` — list table names (files in f_dir)
- `$dbh->func("sql_versions")` — get version info (driver, DBI, Perl, SQL engine)
- `$dbh->{sql_meta}` — access table metadata (read-only, use driver-specific accessors like `csv_tables`)
- `$dbh->{sql_identifier_case}` — set identifier case handling (SQL_IC_UPPER, LOWER, MIXED)
- `$dbh->{sql_dialect}` — set SQL dialect for SQL::Parser (ANSI, CSV, AnyData)
- `$dbh->{sql_engine_in_gofer}` — check if driver operates via DBD::Gofer (read-only)

## Name

DBI::DBD::SqlEngine - Base class for DBI drivers without their own SQL engine

## Synopsis

perl
package DBD::myDriver;
use base qw(DBI::DBD::SqlEngine);

sub driver {
    my $drh = $proto->SUPER::driver($attr);
    return $drh->{class};
}

package DBD::myDriver::dr;
@ISA = qw(DBI::DBD::SqlEngine::dr);
sub data_sources { ... }

package DBD::myDriver::db;
@ISA = qw(DBI::DBD::SqlEngine::db);
sub init_valid_attributes { ... }
sub init_default_attributes { ... }
sub set_versions { ... }
sub validate_STORE_attr { my ($dbh, $attrib, $value) = @_; ... }
sub validate_FETCH_attr { my ($dbh, $attrib) = @_; ... }
sub get_myd_versions { ... }
sub get_avail_tables { ... }

package DBD::myDriver::st;
@ISA = qw(DBI::DBD::SqlEngine::st);
sub FETCH { ... }
sub STORE { ... }

package DBD::myDriver::Statement;
@ISA = qw(DBI::DBD::SqlEngine::Statement);
sub open_table { ... }

package DBD::myDriver::Table;
@ISA = qw(DBI::DBD::SqlEngine::Table);
sub new { ... }
## Options

### DBI Attributes Handled by DBI::DBD::SqlEngine

- `AutoCommit` — always on
- `ChopBlanks` — works
- `NUM_OF_FIELDS` — valid after `$sth->execute`
- `NUM_OF_PARAMS` — valid after `$sth->prepare`
- `NAME` — valid after `$sth->execute`; undef for non-select
- `NULLABLE` — always returns array ref of ones (not verified)

### Unsupported DBI Attributes

- `bind_param_inout`, `CursorName`, `LongReadLen`, `LongTruncOk`

### SqlEngine-Specific Attributes (dbh)

- `sql_engine_version` — module version of this driver (readonly)
- `sql_nano_version` — version of `DBI::SQL::Nano` (readonly)
- `sql_statement_version` — version of `SQL::Statement` if available (readonly)
- `sql_handler` — SQL statement engine (`DBI::SQL::Nano` or `SQL::Statement`) (readonly)
- `sql_parser_object` — instantiated `SQL::Parser` instance (readonly, filled on first use)
- `sql_sponge_driver` — internal `DBD::Sponge` handle (readonly)
- `sql_valid_attrs` — list of valid attributes for driver (readonly)
- `sql_readonly_attrs` — list of readonly attributes (readonly)
- `sql_identifier_case` — how non-quoted identifiers are handled: `SQL_IC_UPPER` (1), `SQL_IC_LOWER` (2), `SQL_IC_MIXED` (4); conversion only if no existing identifier matches
- `sql_quoted_identifier_case` — fixated to `SQL_IC_SENSITIVE` (3, interpreted as `SQL_IC_MIXED`) (readonly)
- `sql_flags` — additional flags for `SQL::Parser` instantiation; set before any statement
- `sql_dialect` — dialect for `SQL::Parser`: `ANSI`, `CSV`, `AnyData`; defaults to `CSV`; set before any statement
- `sql_engine_in_gofer` — true if operated via `DBD::Gofer` (readonly)
- `sql_meta` — private data area for table metadata (readonly); recognized attributes: `col_names`, `table_name`, `readonly`, `sql_data_source`, `sql_identifier_case`
- `sql_table_source` — class for fetching available tables
- `sql_data_source` — class for opening tables

### Driver Private Methods

- `data_sources` — returns list of subdirectories (or custom via `\%attr` `f_dir`); called as `$drh->data_sources(\%attr)`
- `list_tables` — returns list of file names in `$dbh->{f_dir}`; called as `$dbh->func("list_tables")`
- `sql_versions` — returns version info (driver, DBI, Perl, SQL engine); optional table name argument; list context returns array of lines
- `sql_get_meta($table_name, $attrib)` — get table-specific meta attribute value; `"."` for default
- `sql_set_meta($table_name, $attrib, $value)` — set table-specific meta attribute; `"."` for default
- `sql_clear_meta($table_name)` — clear table-specific meta information

## Examples

perl
# Connect and list tables
my $dbh = DBI->connect("dbi:CSV:f_dir=/usr/local/csv_data");
my @tables = $dbh->func("list_tables");

# Get version information
my $versions = $dbh->func("sql_versions");
print "$versions\n";
# Example output:
# DBI::DBD::SqlEngine 0.05 using SQL::Statement 1.402
# DBI                  1.623
# OS                   netbsd (6.99.12)
# Perl                 5.016002 (x86_64-netbsd-thread-multi)

# Use custom table source in data_sources
my @dsns = DBI->data_sources("dbi:CSV:", {
    f_dir => "/your/csv/tables",
    sql_table_source => "DBD::File::Archive::Tar::TableSource",
});
## See Also

- [DBI](https://metacpan.org/pod/DBI)
- [DBD::File](https://metacpan.org/pod/DBD::File)
- [DBD::AnyData](https://metacpan.org/pod/DBD::AnyData)
- [DBD::Sys](https://metacpan.org/pod/DBD::Sys)
- [DBD::File::Developers](https://metacpan.org/pod/DBD::File::Developers)
- [DBD::File::Roadmap](https://metacpan.org/pod/DBD::File::Roadmap)
- [DBI::SQL::Nano](https://metacpan.org/pod/DBI::SQL::Nano)
- [SQL::Statement](https://metacpan.org/pod/SQL::Statement)