Giter VIP home page Giter VIP logo

db-evented's Introduction

NAME

DB::Evented - A pragmatic DBI like evented module.

SYNOPSIS

Doing selects in synchronise order is not always the most efficient way to interact with the Database.

use DB::Evented;

my $evented = DB::Evented->new("DBI:SQLite2:dbname=$dname", "","");

my $results;
$evented->selectcol_arrayref(
  q{
    select
      test1,
      test2
    from
      test
  },
  { 
    Columns => [1,2],
    response => sub {
        $results->{result1} = shift;
    }           
  }
);

$evented->selectrow_hashref(
  q{
    select
      test1,
      test2
    from
      test
  },
  {
    response => sub {
      $results->{result2} = shift;
    }
  }
);

$evented->execute_in_parallel;

STATIC METHODS

new ($connection_str, $username, $pass, %dbi_args )

In order to initialize a DB::Evented object a connection_str is most likely required. See AnyEvent::DBI for more information.

INSTANCE METHODS

any_event_handler

This will return an AnyEvent::DBI handler. The key difference between this handler and DBI is that it's using AnyEvent under the hood. What does this mean? It means that if you use an AnyEvent::DBI method it will run asynchronously.

clear_handlers

Clears all handlers

clear_queue

Clears the queue of any db todos

execute_in_parallel

Will execute all of the queued statements in parallel. This will create a pool of handlers and cache them if necessary.

selectall_arrayref ($sql, \%attr, @binds )

This method functions in the same way as DBI::selectall_arrayref. The key difference being it delays the execution until execute_in_parallel has been called. The results can be accessed in the response attribute call back

selectall_hashref ($sql, $key_field, \%attr, @binds )

This method functions in the same way as DBI::selectall_hashref. The key difference being it delays the execution until execute_in_parallel has been called. The results can be accessed in the response attribute call back

selectrow_arrayref ($sql, \%attr, @binds )

This method functions in the same way as DBI::selectrow_arrayref. The key difference being it delays the execution until execute_in_parallel has been called. The results can be accessed in the response attribute call back

selectrow_hashref ($sql, \%attr, @binds )

This method functions in the same way as DBI::selectrow_hashref. The key difference being it delays the execution until execute_in_parallel has been called. The results can be accessed in the response attribute call back

AUTHOR

Logan Bell, <logie at cpan.org>

SUPPORT

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

perldoc DB::Evented

You can also look for information at:

ACKNOWLEDGEMENTS

Aaron Cohen and Belden Lyman.

LICENSE

Copyright (c) 2013 Logan Bell and Shutterstock Inc (http://shutterstock.com). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

db-evented's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.