DBIx::...arison(3pm)
π DBIx::Simple::Comparison π
okay bestie, welcome to the DBIx::...arison page β it's a User Contributed Perl Documentation joint, and it's literally just a cheat-sheet for translating between DBIx::Simple and raw DBI. pull up a chair. π«Ά
β¨ NAME β¨
DBIx::Simple::Comparison β DBIx::Simple in DBI jargon. that's it, that's the whole vibe. π
πΈ DESCRIPTION πΈ
so this is just a simple and inaccurate overview of what DBI things the DBIx::Simple things represent β or the other way around, we're not picky. π
it's here to help you find the foo equivalent of bar. iykyk. π¦
here's the legend, bestie, memorize it:
?means DBI doesn't have an equivalent, or the author genuinely couldn't find one. no cap.=means DBIx::Simple is giving direct wrapper β it just hands the thing straight to the DBI function. periodt.~means DBIx::Simple's method does more or less the same thing, but usually in a more high-level way: context sensitive, combining stuff, automatically taking care of something. it's doing the most, lovingly. β¨
π important reality check: DBIx::Simple is a wrapper around DBI. it is not "better" than DBI. in fact, DBIx::Simple literally cannot work without DBI. they're a package deal.
also: using DBI directly is always faster than using DBIx::Simple's equivalents. (for the computer, that is. for you, DBIx::Simple is supposed to be faster.) π
π Classes, common names π
use DBI ~ use DBIx::Simple
$DBI::errstr = DBIx::Simple->error
DBI::db ~ DBIx::Simple
$dbh ~ $db
$dbh->errstr = $db->error
connect ~ connect
connect ~ new
DBI::st ~ DBIx::Simple::Result
<undef> ~ DBIx::Simple::Dummy
$sth ~ $result
π Queries π
DBI be like:
my $sth = $dbh->prepare_cached($query);
$sth->execute(@values);
~ DBIx::Simple be like:
my $result = $db->query($query, $values);
look at that glow-up. one line. iconic. π
π¦ Results π¦
DBI DBIx::Simple
bind_columns ~ bind
fetchrow_arrayref/fetch = fetch
fetchrow_array ~ list
*1 ~ flat
[@{fetchrow_arrayref}] = array
fetchall_arrayref ~ arrays
fetchrow_hashref() *2*3 = hash
fetchall_arrayref({}) *4 ~ hashes
fetchall_hashref *2 = map_hashes
? ? map_arrays
fetchall_hashref(1) *2 = map
$sth->{NAME_lc/NAME} = $result->columns
and now the footnotes, because of course there are footnotes, bestie π:
*1There's no fetch variant, but you can do{ @{ $dbh->selectcol_arrayref('SELECT ...', { Slice => [] }) } }.*2To receive the keys (column names) lowercased, use$db->{FetchHashKeyName} = 'NAME_lc'. DBIx::Simple lower cases them by default. it just does. π«Ά*3Or supply an argument,'NAME_lc'.*4No,arrayrefisn't a typo. When supplied an empty hash reference, DBI'sfetchall_arrayrefactually returns hashrefs. This DBI method does not support lower casing of keys, DBIx::Simple does.
π Direct access π
DBI DBIx::Simple
$dbh = $db->dbh
$sth->{$foo} = $result->attr($foo)
func = func
begin_work = begin_work
commit = commit
rollback = rollback
last_insert_id = last_insert_id
rows = rows
disconnect ~ disconnect
finish ~ finish
π§ DBIx::Simple specific (?) π§
these are the little extras DBIx::Simple brings to the group chat β the question mark is right there in the heading, don't @ me:
keep_statements
lc_columns
iquery (via SQL::Interp)
select, insert, update, delete (via SQL::Abstract)
abstract (via SQL::Abstract)
flat
hashes
map_arrays
map
π AUTHOR π
Juerd Waalboer <juerd@cpan.org> <http://juerd.nl/> β shoutout, absolute legend. π
π« SEE ALSO π«
DBI, DBIx::Simple β go read those next, bestie, they're the main characters. π₯
okay that's the whole page, mwah π β this was perl v5.36.0, dated 2023-09-01, and it's User Contributed Perl Documentation, so go forth and query responsibly. slay. πβ¨
π¦ where this page comes from
- debian trixie: libdbix-simple-perl 1.37-3 Β· any-OSI
- ubuntu noble: libdbix-simple-perl 1.37-3 Β· any-OSI
- ubuntu resolute: libdbix-simple-perl 1.37-3 Β· any-OSI
- ubuntu stonking: libdbix-simple-perl 1.37-3 Β· any-OSI
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms