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

NAME

GX::Database::MySQL - MySQL database component

SYNOPSIS

    package MyApp::Database::Default;
    
    use GX::Database::MySQL;
    
    __PACKAGE__->setup(
        database => 'myapp',
        host     => '127.0.0.1',
        user     => 'jau',
        password => '12345'
    );
    
    1;

DESCRIPTION

This module provides the GX::Database::MySQL class which extends the GX::Database class.

METHODS

Constructor

new

Returns the database component instance.

    $database = $database_class->new;
Returns:
Exceptions:

Public Methods

All public methods can be called both as instance and class methods.

connect

See GX::Database.

connect_options

See GX::Database.

dbh

See GX::Database.

disconnect

See GX::Database.

dsn

See GX::Database.

is_connected

See GX::Database.

password

Returns the password that is used for connecting to the database.

    $password = $database->password;
Returns:
  • $password ( string | undef )

setup

Sets up the database component.

    $database_class->setup( %options );
Options:
  • connect_options ( HASH reference )

    A reference to a hash with additional options to pass to DBI's connect() method.

  • database ( string )

    The name of the database. Required unless dsn is specified.

  • driver_options ( string )

    Additional driver-specific options that should be appended to the auto-generated data source name (DSN), e.g. "mysql_compression=1".

  • dsn ( string )

    The full DBI data source name (DSN) that is used for connecting to the database. Overrides all other DSN related options if specified.

  • host ( string )

    The hostname of the MySQL server.

  • password ( string )

    The password that is used for connecting to the database.

  • port ( integer )

    The port number on which the MySQL server is running.

  • sql_builder ( GX::SQL::Builder object )

    The associated SQL builder. Defaults to a GX::SQL::Builder::MySQL instance.

  • user ( string )

    The username that is used for connecting to the database.

Exceptions:

sql_builder

See GX::Database.

user

Returns the user name that is used for connecting to the database.

    $user = $database->user;
Returns:
  • $user ( string | undef )

SEE ALSO

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright (c) 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.