1Data::ObjectDriver::DriUvseerr::CDoBnDt(r3ipbmu)ted PerlDaDtoac:u:mOebnjteacttiDorniver::Driver::DBD(3pm)
2
3
4
6 Data::ObjectDriver::Driver::DBD - base class for database drivers
7
9 package SomeObject;
10 use base qw( Data::ObjectDriver::BaseObject );
11
12 __PACKAGE__->install_properties({
13 ...
14 driver => Data::ObjectDriver::Driver::DBI->new(
15 ...
16 dbd => Data::ObjectDriver::Driver::DBD->new('mysql'),
17 ),
18 });
19
21 Data::ObjectDriver::Driver::DBD is the base class for database drivers.
22 Database drivers handle the peculiarities of specific database servers
23 to provide an abstract API to the object drivers. While database
24 drivers operate on queries and database concepts like the last insert
25 ID and binding attributes for a query, object drivers operate on
26 objects higher level concepts like caching and partitioning.
27
28 Database drivers are used with "Data::ObjectDriver::Driver::DBI" object
29 drivers. If you are making an object driver that doesn't use "DBI", you
30 do not need a database driver; implement your custom behavior in your
31 "Data::ObjectDriver" subclass directly.
32
34 "Data::ObjectDriver::Driver::DBD->new($name)"
35 Creates a new database driver of the given subclass type. That is,
36 new('mysql') would create a new instance of
37 "Data::ObjectDriver::Driver::DBD::mysql".
38
39 "$dbd->init_dbh($dbh)"
40 Initializes the given database handle connected to this driver's type
41 of database.
42
43 By default, no operation is performed. Override this method if your
44 type of database must do further initialization that other database
45 servers don't need, such as setting an operative time zone.
46
47 "$dbd->bind_param_attributes($type)"
48 Returns a hashref to pass to the "DBI" statement method "bind_param",
49 to describe the SQL type of a column defined as $type in an object
50 class's "column_defs" mapping.
51
52 By default, no operation is performed. Override this method if your
53 type of database needs such type hinting for some fields, such as
54 specifying a parameter is a "BLOB".
55
56 Note that object classes must define your custom types in their
57 "column_defs" mappings for those classes to be compatible with your
58 "DBD". Make sure to document any custom types you implement.
59
60 "$dbd->db_column_name($datasource, $column)"
61 Returns a decorated column name. For example, if your database requires
62 column names to be prepended with table names, that concatenation would
63 occur in this method.
64
65 By default, "db_column_name" returns the column name unmodified.
66
67 "$dbd->fetch_id()"
68 Returns the autogenerated ID of the most recently inserted record, or
69 "undef" if this feature is not supported.
70
71 By default, "fetch_id" returns "undef".
72
73 "$dbd->map_error_code($code, $msg)"
74 Returns a "Data::ObjectDriver::Errors" code for the given database
75 error, or "undef" if no equivalent has been defined.
76
77 By default, "map_error_code" returns "undef" for every error.
78
79 "$dbd->sql_for_unixtime()"
80 Returns the SQL for querying the current UNIX time on the database
81 server, or a UNIX time to use as the remote time.
82
83 By default, "sql_for_unixtime" returns the value of perl time() on the
84 local machine.
85
86 "$dbd->offset_implemented()"
87 Returns true if the database this driver represents supports "OFFSET"
88 clauses.
89
90 By default, "offset_implemented" returns true.
91
92 "$dbd->can_delete_with_limit()"
93 Returns true if the database this driver represents supports "LIMIT"
94 clauses on "DELETE" statements.
95
96 By default, "can_delete_with_limit" returns false.
97
98 "$dbd->can_prepare_cached_statements()"
99 Returns true if the database this driver can cope with preparing a
100 cached statement.
101
102 By default, "can_delete_with_limit" returns true.
103
104 "$dbd->is_case_insensitive()"
105 Returns true if the database this driver represents normally compares
106 string fields case insensitively.
107
108 By default, "is_case_insensitive" returns false.
109
110 "$dbd->can_replace()"
111 Returns true if the database this driver represents supports "REPLACE
112 INTO" statements.
113
114 By default, "can_replace" returns false.
115
116 "$dbd->force_no_prepared_cache()"
117 Returns false if the database this driver represents supports the
118 "prepare_cached" method on its DBI database handles.
119
120 By default, "force_no_prepared_cache" returns false.
121
122 "$dbd->sql_class()"
123 Provides the package name of the class responsible for representing SQL
124 queries. This method returns 'Data::ObjectDriver::SQL', but may be
125 overridden to return a package that has a similar interface but
126 produces SQL that is compatible with that DBD driver. The package
127 provided must already be loaded and available for use.
128
130 Data::ObjectDriver is free software; you may redistribute it and/or
131 modify it under the same terms as Perl itself.
132
134 Except where otherwise noted, Data::ObjectDriver is Copyright 2005-2006
135 Six Apart, cpan@sixapart.com. All rights reserved.
136
137
138
139perl v5.38.0 2023-07-2D0ata::ObjectDriver::Driver::DBD(3pm)