Commit | Line | Data |
ac50f57b |
1 | package DBIx::Class::Storage::DBI::SQL::Statement; |
2 | |
3 | use strict; |
4 | use base 'DBIx::Class::Storage::DBI'; |
5 | use mro 'c3'; |
6 | use namespace::clean; |
7 | |
8 | __PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::SQLStatement'); |
9 | __PACKAGE__->sql_quote_char('"'); |
10 | __PACKAGE__->sql_limit_dialect('LimitXY_NoBinds'); |
11 | |
12 | # Unsupported options |
13 | sub _determine_supports_insert_returning { 0 }; |
14 | |
15 | # Statement caching currently buggy with either S:S or DBD::AnyData (and/or possibly others) |
16 | # Disable it here and look into fixing it later on |
17 | sub _init { |
18 | my $self = shift; |
19 | $self->next::method(@_); |
20 | $self->disable_sth_caching(1); |
21 | } |
22 | |
23 | # No support for transactions; sorry... |
24 | sub txn_begin { |
25 | my $self = shift; |
26 | |
27 | # Only certain internal calls are allowed through, and even then, we are merely |
28 | # ignoring the txn part |
29 | my $callers = join "\n", map { (caller($_))[3] } (1 .. 4); |
30 | return $self->_get_dbh |
31 | if ($callers =~ / |
32 | DBIx::Class::Storage::DBI::insert_bulk| |
33 | DBIx::Class::Relationship::CascadeActions::update |
34 | /x); |
35 | |
36 | $self->throw_exception('SQL::Statement-based drivers do not support transactions!'); |
37 | } |
38 | sub svp_begin { shift->throw_exception('SQL::Statement-based drivers do not support savepoints!'); } |
39 | |
40 | # Nor is there any last_insert_id support (unless the driver supports it directly) |
41 | sub _dbh_last_insert_id { shift->throw_exception('SQL::Statement-based drivers do not support AUTOINCREMENT keys! You will need to specify the PKs directly.'); } |
42 | |
43 | # leftovers to support txn_begin exceptions |
44 | sub txn_commit { 1; } |
45 | |
46 | 1; |
47 | |
48 | =head1 NAME |
49 | |
50 | DBIx::Class::Storage::DBI::SQL::Statement - Base Class for SQL::Statement- / DBI::DBD::SqlEngine-based |
51 | DBD support in DBIx::Class |
52 | |
53 | =head1 SYNOPSIS |
54 | |
55 | This is the base class for DBDs that use L<SQL::Statement> and/or |
56 | L<DBI::DBD::SqlEngine|DBI::DBD::SqlEngine::Developers>. This class is |
57 | used for: |
58 | |
59 | =over |
60 | =item L<DBD::Sys> |
61 | =item L<DBD::AnyData> |
62 | =item L<DBD::TreeData> |
63 | =item L<DBD::SNMP> |
64 | =item L<DBD::PO> |
65 | =item L<DBD::CSV> |
66 | =item L<DBD::DBM> |
67 | =back |
68 | |
69 | =head1 IMPLEMENTATION NOTES |
70 | |
71 | =head2 Transactions |
72 | |
73 | These drivers do not support transactions (and in fact, even the SQL syntax for |
74 | them). Therefore, any attempts to use txn_* or svp_* methods will throw an |
75 | exception. |
76 | |
77 | In a future release, they may be replaced with emulated functionality. (Then |
78 | again, it would probably be added into L<SQL::Statement> instead.) |
79 | |
80 | =head2 SELECT ... FOR UPDATE/SHARE |
81 | |
82 | This also is not supported, but it will silently ignore these. |
83 | |
84 | =head1 AUTHOR |
85 | |
86 | See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>. |
87 | |
88 | =head1 LICENSE |
89 | |
90 | You may distribute this code under the same terms as Perl itself. |
91 | |
92 | =cut |