![]() |
|< 1 2 >| | ![]() |
14 Einträge, 2 Seiten |
1 2 3
sub search { my ($self, $st, @bind) = @_; my $dbh = $self->{_DATA_}->{DBH};
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
package Friender::EasyDB; use strict; use DBI; #use Friender::Search::Search; sub new { my $class = shift; my $self = {}; bless($self, $class); $self->init(@_); return $self; } sub init { my $self = shift; my $dbh = DBI->connect_cached(@_, { AutoCommit => 0, RaiseError => 1 } ) or die $DBI::errstr; $self->{_DATA_}->{DBH} = $dbh; } sub search { my $self = shift; my ($st, @bind) = @_; return Friender::Search::Search->new($self, $st, @bind); } sub quick { my $self = shift; my $dbh = $self->{_DATA_}->{DBH}; my ($st, @bind) = @_; return $dbh->selectrow_array($st, undef, @bind); } sub do { my $self = shift; my $dbh = $self->{_DATA_}->{DBH}; my ($st, @bind) = @_; $dbh->do($st, undef, @bind); } sub disconnect { my $self = shift; my $dbh = $self->{_DATA_}->{DBH}; $dbh->disconnect; } sub prepare { my $self = shift; my ($st, @bind) = @_; my $dbh = $self->{_DATA_}->{DBH}; my $sth = $dbh->prepare($st); $sth->execute(@bind) or die $DBI::errstr; return $sth; } sub fetch { my $self=shift; my $sth=shift; return $sth->fetchrow_hashref; } 1; ######################################################################### package Friender::Search::Search; use strict; use SQL::Abstract; sub new { my $class = shift; my $db = shift; my $self = {}; $self->{_DB_}=$db; $self->{_DATA_}->{RESULTS}=$db->fetch_prepare(@_); bless($self, $class); return $self; } sub get { my $self = shift; my $sth = $self->{_DATA_}->{RESULTS}; return $self->{_DB_}->fetch($sth); } 1;
1 2 3 4
sub search { my ($self, $st, @bind) = @_; $self->{_DATA_}->{_OBJECTS_} = Friender::Search::Search->new($self, $st, @bind); }
![]() |
|< 1 2 >| | ![]() |
14 Einträge, 2 Seiten |