Zane C. Bowers-Hadley

NAME

ZConf::DBI::utils - Assorted utilities for ZConf::DBI.

VERSION

Version 0.0.0

SYNOPSIS

This is primarily meant for quick small things. If you are going to calling a lot of stuff here repeatively/heavily, you are probally going to be better off making use of what ever is being called by the function directly.

METHODS

new

This initiates the object.

One arguement is required and it is the 'ZConf::DBI' object.

    my $foo=ZConf::DBI::util->new($zcdbi);
    if($foo->error){
        warn('error code:'.$foo->error.': '.$foo->errorString);
    }

create_table

This creates a new table using DBIx::Admin::CreateTable->create_table.

Three arguements are required. The first is the data source name. The second is the table name. The third is a SQL string describing the columns.

    $foo->create_table('whatever', 'sometable', 'id char(32) primary key, data varchar(255) not null');
    if($foo->error){
        warn('error code:'.$error.': '.$foo->errorString);
    }

do

This executes the do statement on a DBH created from the data source.

Two arguements are required. The first is the data source. The second is the SQL.

    $foo->create_table('whatever', 'drop sequence fubar;');
    if($foo->error){
        warn('error code:'.$error.': '.$foo->errorString);
    }

drop_table

This drops a table using DBIx::Admin::CreateTable->drop_table.

Two arguements are required. The first is the data source name. The second is the table name.

    $foo->create_table('whatever', 'sometable');
    if($foo->error){
        warn('error code:'.$error.': '.$foo->errorString);
    }

error

Returns the current error code and true if there is an error.

If there is no error, undef is returned.

    my $error=$foo->error;
    if($error){
        warn('error code:'.$error.': '.$foo->errorString);
    }

errorString

Returns the error string if there is one. If there is not, it will return undef.

    my $error=$foo->error;
    if($error){
        warn('error code:'.$error.': '.$foo->errorString);
    }

table_columns

This returns a array reference of table column names found by DBIx::Admin::TableInfo->columns.

There are three arguements taken. The first, and required, is the data source name. The second, and optional, is the schema name. The third, and optional, is the schema.

    my $tables=$foo->table_columns('tigerline', 'geometry_columns');
    if($foo->error){
        warn('error code:'.$foo->error.': '.$foo->errorString);
    }

table_info

This returns a hash reference of table column names found by DBIx::Admin::TableInfo->info.

There are two arguements taken. The first, and required, is the data source name. The second, and optional, is the schema name.

    my $tables=$foo->table_info('tigerline', 'geometry_columns');
    if($foo->error){
        warn('error "'.$foo->error.'"');
    }

tables

This returns a array refernce of table names found by DBIx::Admin::TableInfo->tables.

There are two arguements taken. The first, and required, is the data source name. The second, and optional, is the schema name.

    my $tables=$foo->tables('tigerline');
    if($foo->error){
        warn('error "'.$foo->error.'"');
    }

errorblank

This blanks the error storage and is only meant for internal usage.

It does the following.

    $self->{error}=undef;
    $self->{errorString}=undef;

ERROR CODES

1

No ZConf::DBI object passed.

2

The passed object is not a ZConf::DBI object.

3

No data source name specified.

4

DBIx::Admin::TableInfo->new returned undef.

5

No table specified.

6

Connect errored.

7

No SQL defined.

8

Creating the table frailed.

9

Dropping the table failed.

AUTHOR

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-zconf-dbi-utils at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ZConf-DBI-utils. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc ZConf::DBI::utils

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2010 Zane C. Bowers, all rights reserved.

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