1DBIx::Simple::ComparisoUns(e3r)Contributed Perl DocumentDaBtIixo:n:Simple::Comparison(3)
2
3
4
6 DBIx::Simple::Comparison - DBIx::Simple in DBI jargon
7
9 This is just a simple and inaccurate overview of what DBI things the
10 DBIx::Simple things represent, or the other way around.
11
12 This document can be useful to find the foo equivalent of bar.
13
14 "?" means that DBI doesn't have an equivalent or that I couldn't find
15 one.
16
17 "=" means that DBIx::Simple provides a direct wrapper to the DBI
18 function.
19
20 "~" means that DBIx::Simple's method does more or less the same, but
21 usually in a more high level way: context sensitive, combining things,
22 automatically taking care of something.
23
24 Note that DBIx::Simple is a wrapper around DBI. It is not "better" than
25 DBI. In fact, DBIx::Simple cannot work without DBI.
26
27 Using DBI directly is always faster than using DBIx::Simple's
28 equivalents. (For the computer, that is. For you, DBIx::Simple is
29 supposed to be faster.)
30
31 Classes, common names
32 use DBI ~ use DBIx::Simple
33
34 $DBI::errstr = DBIx::Simple->error
35
36 DBI::db ~ DBIx::Simple
37 $dbh ~ $db
38 $dbh->errstr = $db->error
39
40 connect ~ connect
41 connect ~ new
42
43 DBI::st ~ DBIx::Simple::Result
44 <undef> ~ DBIx::Simple::Dummy
45 $sth ~ $result
46
47 Queries
48 DBI
49
50 my $sth = $dbh->prepare_cached($query);
51 $sth->execute(@values);
52
53 ~ DBIx::Simple
54
55 my $result = $db->query($query, $values);
56
57 Results
58 DBI DBIx::Simple
59
60 bind_columns ~ bind
61
62 fetchrow_arrayref/fetch = fetch
63 fetchrow_array ~ list
64 *1 ~ flat
65 [@{fetchrow_arrayref}] = array
66 fetchall_arrayref ~ arrays
67 fetchrow_hashref() *2*3 = hash
68 fetchall_arrayref({}) *4 ~ hashes
69
70 fetchall_hashref *2 = map_hashes
71 ? ? map_arrays
72 fetchall_hashref(1) *2 = map
73
74 $sth->{NAME_lc/NAME} = $result->columns
75
76 *1 There's no fetch variant, but you can do "{ @{
77 $dbh->selectcol_arrayref('SELECT ...', { Slice => [] }) } }".
78
79 *2 To receive the keys (column names) lowercased, use
80 "$db->{FetchHashKeyName} = 'NAME_lc'". DBIx::Simple lower cases them by
81 default.
82
83 *3 Or supply an argument, 'NAME_lc'.
84
85 *4 No, arrayref isn't a typo. When supplied an empty hash reference,
86 DBI's fetchall_arrayref actually returns hashrefs. This DBI method does
87 not support lower casing of keys, DBIx::Simple does.
88
89 Direct access
90 DBI DBIx::Simple
91
92 $dbh = $db->dbh
93 $sth->{$foo} = $result->attr($foo)
94
95 func = func
96
97 begin_work = begin_work
98 commit = commit
99 rollback = rollback
100 last_insert_id = last_insert_id
101 rows = rows
102
103 disconnect ~ disconnect
104 finish ~ finish
105
106 DBIx::Simple specific (?)
107 keep_statements
108 lc_columns
109 iquery (via SQL::Interp)
110 select, insert, update, delete (via SQL::Abstract)
111 abstract (via SQL::Abstract)
112 flat
113 hashes
114 map_arrays
115 map
116
118 Juerd Waalboer <juerd@cpan.org> <http://juerd.nl/>
119
121 DBI, DBIx::Simple
122
123
124
125perl v5.28.1 2010-12-03 DBIx::Simple::Comparison(3)