The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Module::Build::DBD:SQLite - SQLite specifics for Module::Build::DB

Description

This module contains a number of class methods called by Module::Build::DB to handle SQLite specific tasks when detecting, building, and updating a database.

Methods

All methods are class methods.

get_client()

  my $client = Module::Build::DBD::SQLite->get_client;

Returns the name of the client to use to connect to SQLite. For now, that's just sqlite3, which is fine if it's in your path. Some code to search for a client might be added in the future. Either way, it's best to specify use the --db_client option to avoid all ambiguity.

get_db_and_command()

  my ($db_name, $cmd) = Module::Build::DBD::SQLite->get_db_and_command($client, $params);

Returns a database name culled from $params and an array reference with $client and all required options for all access to the database. $params contains both the contents of the context configuration file's DBI section and the attributes defined in the driver DSN (e.g., dbname=foo.db in dbi:SQLite:dbname=foo.db).

get_db_option()

  my @opts = Module::Build::DBD::SQLite->get_db_option($db_name);

Returns a list of options to be appended to the command returned by get_db_and_command() to connect to a specific database. For SQLite, that's simply $dbname.

get_create_db_command()

  my @command = Module::Build::DBD::SQLite->get_create_db_command($cmd, $db);

Returns a command list suitable for passing to system() that will create a new database. $cmd is the command returned by get_db_and_command() and $db is the name of the database to be created.

get_drop_db_command()

  my @command = Module::Build::DBD::SQLite->get_drop_db_command($cmd, $db);

Returns a command list suitable for passing to system() that will drop an existing database. $cmd is the command returned by get_db_and_command() and $db is the name of the database to be dropped.

get_check_db_command()

  my @command = Module::Build::DBD::SQLite->get_check_db_command($cmd, $db);

Returns a command list suitable for passing to system() that will, when executed, output a 1 when $db exists and nothing when $db does not exist. $cmd is the command returned by get_db_and_command() and $db is the name of the database to be checked.

get_execute_command()

  my @command = Module::Build::DBD::SQLite->get_execute_command($cmd, $db, $sql);

Returns a command list suitable for passing to system() that will execute the SQL in $sql and return its output, if any. $cmd is the command returned by get_db_and_command(), $db is the name of the database to be connect to for the query, and $sql is the SQL command or commands to be executed.

get_file_command()

  my @command = Module::Build::DBD::SQLite->get_file_command($cmd, $db, $sql);

Returns a command list suitable for passing to system() that will execute the SQL in $file and return its output, if any. $cmd is the command returned by get_db_and_command(), $db is the name of the database to be connect to for the query, and $file is a file with SQL commands.

get_meta_table_sql()

  my $sql = Module::Build::DBD::SQLite->get_meta_table_sql($table_name);

Returns an SQL string that creates a metadata table named $table_name.

Author

David E. Wheeler <david@justatheory.com>

Copyright

Copyright (c) 2008-2010 David E. Wheeler. Some Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.