Al Newkirk > DBIx-Simple-Batch-1.69 > DBIx::Simple::Batch

Download:
DBIx-Simple-Batch-1.69.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.69   Source  

NAME ^

DBIx::Simple::Batch - An Alternative To ORM and SQL Stored Procedures.

VERSION ^

Version 1.69

DOCUMENTATION ^

METHODS ^

new

The new method initializes a new DBIx::Simple::Batch object.

new arguments

$path
@connection_string

new usage and syntax

    $db = DBIx::Simple::Batch->new($path);
    
    takes 2 arguments
        1st argument           - required
            $path              - path to folder where sql files are stored
        2nd argument           - required
            @connection_string - display help for a specific command
            
    # Simple Example:
    my $db = DBIx::Simple::Batch->new($path, @connection_string);
    $db->call->folder->file(@parameters);
    
    ---
    
    # Got It? Now lets look at that again in slow-motion
    my $path = '/var/www/app/queries';
    my @connection_string = ('dbi:SQLite:/var/www/app/foo.db');
    my $db = DBIx::Simple::Batch->new($path, @connection_string);
    
    # $path can also take a file pattern which turns on object mapping
    my $path = '/var/www/app/queries/*.sql';
    my @connection_string = ('dbi:SQLite:/var/www/app/foo.db');
    my $db = DBIx::Simple::Batch->new($path, @connection_string);
    $db->call->folder->file(...);

call

The call method is used to access and process sql files in an object-oriented fashion.

call arguments

No arguments.

call usage and syntax

    $db->call;
    
    takes 0 arguments
            
    example:
    $db->call->file(...);
    $db->call->folder->file;
    $db->call->folder->folder->file;

constants

the `constants` method is used to define specific custom variables that should be including in the execution of all commands.

constants arguments

$custom_params

constants usage and syntax

    $self->constants({ param1 => 1, param2 => 2});
    
    takes 1 argument
        1st argument  - required
            \%hashref - display help for a specific command
            
    example:
    $self->constants({ id => 1 });
    Now, in every command `$!id` will be replaced with `1` unless a custom
    param is passed to the process_queue method or call accessors.

queue

The queue function parses the passed (sql) text file and build the list of sql statements to be executed and how.

queue arguments

$sql_file

queue usage and syntax

    $db->queue($sql_file);
    
    takes 1 argument
        1st argument  - required
            $sql_file - path to the sql file to process
            
    example:
    $db->queue($sql_file);

process_queue

The process_queue function sequentially processes the recorded commands found the (sql) text file.

process_queue arguments

@parameters

process_queue usage and syntax

    $self->process_queue(@parameters);
    
    takes 1 argument
        1st argument    - required
            @parameters - parameters to be used in parsing the sql file
            
    example:
    $db->process_queue(@parameters);
    $db->process_queue($hashref, @parameters);

process_queue synonyms

cache

The cache method accesses an arrayref of resultsets that were captured using the (sql file) capture command and returns the resultset of the index or name passed to it or returns 0.

cache arguments

$index

cache usage and syntax

    my $results = $db->cache($index);
    
    takes 1 argument
        1st argument  - required
            $index    - name or array index of the desired resultset
            
    example:
    my $resultset = $db->cache('new_group');
    my $resultset = $db->cache(2);

cache synonyms

clear

The clear method simply clears the cache (the resultset space).

clear arguments

No arguments.

clear usage and syntax

    $db->clear;
    
    takes 0 arguments
            
    example:
    $db->clear

AUTHOR ^

Al Newkirk, <al.newkirk at awnstudio.com>

BUGS ^

Please report any bugs or feature requests to bug-DBIx-Simple-Batch at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Simple-Batch. 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 DBIx::Simple::Batch

You can also look for information at:

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

Copyright 2009 Al Newkirk.

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

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: