DBD-Neo4p

 view release on metacpan or  search on metacpan

lib/DBD/Neo4p.pm  view on Meta::CPAN


BEGIN {
 $DBD::Neo4p::VERSION = '0.2001';
}

our $err = 0;               # holds error code   for DBI::err
our $errstr =  '';          # holds error string for DBI::errstr
our $drh = undef;           # holds driver handle once initialised
our $prefix = 'neo';

sub driver($$){
    return $drh if $drh;
    my($sClass, $rhAttr) = @_;
    $sClass .= '::dr';

# install methods if nec.

    DBD::Neo4p::db->install_method('neo_neo4j_version');

    $drh = DBI::_new_drh($sClass,  
        {   

lib/DBD/Neo4p.pm  view on Meta::CPAN

            Attribution => 'DBD::Neo4p by Mark A. Jensen'
        }
    );
    return $drh;
}

package # hide from PAUSE
  DBD::Neo4p::dr;
$DBD::Neo4p::dr::imp_data_size = 0;

sub connect($$;$$$) {
    my($drh, $sDbName, $sUsr, $sAuth, $rhAttr)= @_;

#1. create database-handle
    my ($outer, $dbh) = DBI::_new_dbh($drh, {
        Name         => $sDbName,
        USER         => $sUsr,
        CURRENT_USER => $sUsr,
    });
    local $REST::Neo4p::HANDLE;
    $dbh->STORE("${prefix}_Handle", REST::Neo4p->create_and_set_handle);

lib/DBD/Neo4p.pm  view on Meta::CPAN

    $dbh->{"${prefix}_agent"} = REST::Neo4p->agent;

    return $outer;
}

sub data_sources ($;$) {
    my($drh, $rhAttr) = @_;
    return;
}

sub disconnect_all($) { }

package #hide from PAUSE
  DBD::Neo4p::db;
$DBD::Neo4p::db::imp_data_size = 0;

sub prepare {
    my($dbh, $sStmt, $rhAttr) = @_;
#1. Create blank sth
    my ($outer, $sth) = DBI::_new_sth($dbh, { Statement   => $sStmt, });
    return $sth unless($sth);

lib/DBD/Neo4p.pm  view on Meta::CPAN

    when (/^${prefix}_/) {
      $dbh->{$sAttr} = $sValue;
      return 1;
    }
    default {
      return $dbh->SUPER::STORE($sAttr => $sValue);
    }
  }
}

sub DESTROY($) {
  my($dbh) = @_;
  $dbh->disconnect;
  # deal with the REST::Neo4p object
}

package #hide from PAUSE
  DBD::Neo4p::st;
$DBD::Neo4p::st::imp_data_size = 0;

sub bind_param ($$$;$) {
  my($sth, $param, $value, $attribs) = @_;
  return $sth->DBI::set_err(2, "Can't bind_param $param, too big")
    if ($param > $sth->FETCH('NUM_OF_PARAMS'));
  $sth->{"${prefix}_param_values"}->[$param-1] = $value;
  return 1;
}

sub execute($@) {
  my ($sth, @bind_values) = @_;

  $sth->finish if $sth->{Active}; # DBI::DBD example, follow up...

  my $params = @bind_values ? \@bind_values : $sth->{"${prefix}_param_values"};
  unless (@$params == $sth->FETCH('NUM_OF_PARAMS')) {
    return $sth->set_err($DBI::stderr, "Wrong number of parameters");
  }
  # Execute
  # by this time, I know all my parameters



( run in 0.573 second using v1.01-cache-2.11-cpan-65fba6d93b7 )