Package variables | General documentation | Methods |
columns | No description | Code |
dbi | No description | Code |
rows | No description | Code |
search | No description | Code |
set_dbi | No description | Code |
set_primarykey | No description | Code |
set_table | No description | Code |
tables | No description | Code |
columns | description | prev | next | Top |
die "Can't locate object method\" columns\"" unless($dbh); my $self = shift; my $sql = ("SELECT * FROM $table LIMIT 1"); my $sth = $dbh->prepare($sql) || die $dbh->errstr; $sth->execute || die $sth->errstr; my $ref = $sth->fetchrow_hashref(); return keys %$ref;}
dbi | description | prev | next | Top |
die "Can't locate object method\" dbi\"" unless($dbh); return $dbh;}
rows | description | prev | next | Top |
die "Can't locate object method\" rows\"" unless($dbh); my $self = shift;; return keys %$self;}
search | description | prev | next | Top |
my $this = shift; my @args = @_; my $i = 0; my $where; while(defined $args[$i]){ if(length($where)){ $where .= ' AND '; }else{ $where = ' WHERE '; } if (substr($args[$i], 0, 1) eq '-' && substr($args[$i], 1, 1) !~ /[0-9]/){ $where .= substr($args[$i],1) . ' = "' . $args[$i + 1] . '"'; $i += 2; }else{ $where .= $args[$i]; $i ++; } } print "select $primarykey from $table $where"; my $ids = $dbh->selectcol_arrayref("select $primarykey from $table $where"); return @$ids;}
set_dbi | description | prev | next | Top |
my $self = shift; $dbh = shift;}
set_primarykey | description | prev | next | Top |
my $self = shift; $primarykey = shift;}
set_table | description | prev | next | Top |
my $self = shift; $table = shift;}
tables | description | prev | next | Top |
die "Can't locate object method\" tables\"" unless($dbh); my $self = shift; my %tables; foreach my $table ($dbh->tables(undef, 'public', undef, undef, {noprefix => 1})){ $table =~ s/^\"(.*)\"$/$1/g; $tables{$table} ++; } return keys %tables;}