my $wheres = "PasswdHostGrp.HostGrpID IN ('group1', 'group2')";
my $arrayref = dbselect_array($dbh, build_select($select, $from, $joins, $wheres, 0));
my $i = 1;
for my $row (@{$arrayref}) {
print "Row $i\n";
for my $key (keys(%{$row})) {
print "\t$key = ${$row}{$key}\n";
}
$i++;
}
=head1 DESCRIPTION
DBD::mysql::SimpleMySQL is an extention of the DBI mysql driver. It simplifies getting the data you want out of your DB. I wrote it because I found that everytime I put together a DBI based app I ended up writing these functions anyway.
=head1 Public Methods
dbinsert
dbconnect($)
Takes a hash ref, return a DBI database handle.
dbselect($$)
Takes a DBI db handle and a MySQL query string.
dbselect_arrayref($$)
Takes a DBI db handle and a MySQL query string.
dbinsert
dbupdate($$$$)
Takes a DBI db handle, table name string, a hash ref of Columns to update including an "ID" column, and the "ID" column string
dbdo($$)
Takes a DBI db handle and a SQL command string. This string is pretty much passed directly to $dbh->do
where_struct($$$)
Takes a key, type and value argument.
Key is the column name or function in a where clause.
Type is the comparison, "LIKE", "IN", "=" etc.
Value is the value. "WHERE Key = Value."
Returns a reference to be used in "build_wheres"
join_struct($$$)
Takes a table, tableid and joinid.
Table is the table to join to query.
Tableid is the key to join the table on. "JOIN table ON tableid = joinid."
Joinid is the key to join the table on. "JOIN table ON tableid = joinid."
Returns a reference to be used in "build_joins"
build_joins($)
Takes a "join_struct" reference. Builds a LEFT JOIN query string.
OR
Takes a JOIN string directly including the "JOIN".
Returns a LEFT JOIN string to be passed to "build_*"
build_wheres($)
Takes a reference to an array of "where_struct" references. Builds a WHERE query string.
OR
Takes a WHERE string directly not including the "WHERE".
Returns a WHERE string to be passed to "build_*"
build_select($$$$$)
build_insert($$)
build_delete($$$)
find_dup($$$$)
=head1 AUTHOR
Jacob Boswell
=head1 COPYRIGHT
DBD::mysql::SimpleMySQL is Copyright(c) 2004 Jacob Boswell. All rights reserved
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
=back
=cut
Keyboard Shortcuts
Global
s
Focus search bar
?
Bring up this help dialog
GitHub
gp
Go to pull requests
gi
go to github issues (only if github is preferred repository)