GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  GANTRY::UTILS::CDBI (3)

.ds Aq ’

NAME

Gantry::Utils::CDBI - Class::DBI base class for Gantry applications

CONTENTS

SYNOPSIS

This module expects to retrieve the database connection, username, and password from one of two places.

    In mod_perl

If it lives in mod_perl, it expects these to come from the apache conf file. You might supply them like this:



    <Location / >
        PerlSetVar dbconn dbi:Pg:dbname=your_db_name
        PerlSetVar dbuser your_user
        PerlSetVar dbpass your_password
    </Location>



It then retrieves them roughly like this (the mod_perl version affects this):



    $r = Apache->request();

    $r->dir_config( dbconn ), 
    $r->dir_config( dbuser ),
    $r->dir_config( dbpass ),



The handle is cached using pnotes to avoid recreating it.

    In scripts

On the other hand, if the module does not live in mod_perl, it needs to directly use Gantry::Utils::DBConnHelper::Script like this:



    use Gantry::Utils::DBConnHelper::Script {
            dbconn => dbi:Pg:dbname=your_db_name,
            dbuser => your_user,
            dbuser => your_pass,
    };



If you can’t put the connection info into the use statement (say because you take it from the command line) do the above in two steps:



    use Gantry::Utils::DBConnHelper::Script;

    # figure out your connection info

    Gantry::Utils::DBConnHelper::Script->set_conn_info(
            dbconn => $dsn,
            dbuser => $dbuser,
            dbuser => $dbpass,
    );



The database handle is cached by the helper. To get hold of it say:



    my $dbh = Gantry::Utils::DBConnHelper::Script->get_dbh();



DESCRIPTION

This module provides the base methods for Class:DBI, including the db conection method within a mod_perl environment.

METHODS

get_db_options Default database attributes usually supplied by Class::DBI’s _default_attributes method.
pretty_date A failed attempt at date format beautification. Probably should be removed.
Note that these other methods are mixed in from Gantry::Utils::ModelHelper:



    db_Main
    retrieve_all_for_main_listing
    get_form_selections



See its docs for details.

AUTHOR

Tim Keefer <tkeefer@gmail.com>

COPYRIGHT and LICENSE

Copyright (c) 2005-6, Tim Keefer.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 GANTRY::UTILS::CDBI (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.