| 1 | # $Id$ | ||
| 2 | |||
| 3 | package Data::ObjectDriver::Driver::DBD; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | |||
| 8 | sub new { | ||
| 9 | my $class = shift; | ||
| 10 | my($name) = @_; | ||
| 11 | die "No Driver" unless $name; | ||
| 12 | my $subclass = join '::', $class, $name; | ||
| 13 | no strict 'refs'; | ||
| 14 | unless (%{"${subclass}::"}) { | ||
| 15 | eval "use $subclass"; ## no critic | ||
| 16 | die $@ if $@; | ||
| 17 | } | ||
| 18 | bless {}, $subclass; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub init_dbh { } | ||
| 22 | sub bind_param_attributes { } | ||
| 23 | sub db_column_name { $_[2] } | ||
| 24 | sub fetch_id { } | ||
| 25 | sub offset_implemented { 1 } | ||
| 26 | sub map_error_code { } | ||
| 27 | |||
| 28 | # SQL doesn't define a function to ask a machine of its time in | ||
| 29 | # unixtime form. MySQL does, so we override this in the subclass. | ||
| 30 | # but for sqlite and others, we assume "remote" time is same as local | ||
| 31 | # machine's time, which is especially true for sqlite. | ||
| 32 | sub sql_for_unixtime { return time() } | ||
| 33 | |||
| 34 | # by default, LIMIT isn't supported on a DELETE. MySql overrides. | ||
| 35 | sub can_delete_with_limit { 0 } | ||
| 36 | |||
| 37 | # searches are case sensitive by default. MySql overrides. | ||
| 38 | sub is_case_insensitive { 0 } | ||
| 39 | |||
| 40 | sub can_replace { 0 } | ||
| 41 | |||
| 42 | # Some drivers have problems with prepared caches | ||
| 43 | sub can_prepare_cached_statements { 1 }; | ||
| 44 | |||
| 45 | sub sql_class { 'Data::ObjectDriver::SQL' } | ||
| 46 | |||
| 47 | |||
| 48 | 1; | ||
| 49 | |||
| 50 | __END__ |