1Class::DBI::Query(3) User Contributed Perl Documentation Class::DBI::Query(3)
2
3
4
6 Class::DBI::Query - Deprecated SQL manager for Class::DBI
7
9 my $sth = Class::DBI::Query
10 ->new({
11 owner => $class,
12 sqlname => $type,
13 essential => \@columns,
14 where_columns => \@where_cols,
15 })
16 ->run($val);
17
19 This abstracts away many of the details of the Class::DBI underlying
20 SQL mechanism. For the most part you probably don't want to be
21 interfacing directly with this.
22
23 The underlying mechanisms are not yet stable, and are subject to change
24 at any time.
25
27 A Query can have many options set before executing. Most can either be
28 passed as an option to new(), or set later if you are building the
29 query up dynamically:
30
31 owner
32 The Class::DBI subclass that 'owns' this query. In the vast majority of
33 cases a query will return objects - the owner is the class of which
34 instances will be returned.
35
36 sqlname
37 This should be the name of a query set up using set_sql.
38
39 where_clause
40 This is the raw SQL that will substituted into the 'WHERE %s' in your
41 query. If you have multiple %s's in your query then you should supply a
42 listref of where_clauses. This SQL can include placeholders, which will
43 be used when you call run().
44
45 essential
46 When retrieving rows from the database that match the WHERE clause of
47 the query, these are the columns that we fetch back and pre-load the
48 resulting objects with. By default this is the Essential column group
49 of the owner class.
50
52 where()
53 $query->where($match, @columns);
54
55 This will extend your 'WHERE' clause by adding a 'AND $column = ?' (or
56 whatever $match is, isntead of "=") for each column passed. If you have
57 multiple WHERE clauses this will extend the last one.
58
59
60
61perl v5.32.0 2020-07-28 Class::DBI::Query(3)