| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::Class::Storage::DBI::ACCESS; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1743
|
use strict; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
107
|
|
|
4
|
4
|
|
|
4
|
|
18
|
use warnings; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
117
|
|
|
5
|
4
|
|
|
4
|
|
18
|
use base 'DBIx::Class::Storage::DBI::UniqueIdentifier'; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
1368
|
|
|
6
|
4
|
|
|
4
|
|
30
|
use mro 'c3'; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
2679
|
use DBI (); |
|
|
4
|
|
|
|
|
33066
|
|
|
|
4
|
|
|
|
|
1638
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->sql_limit_dialect ('Top'); |
|
11
|
|
|
|
|
|
|
__PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::ACCESS'); |
|
12
|
|
|
|
|
|
|
__PACKAGE__->sql_quote_char ([qw/[ ]/]); |
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
1
|
|
sub sqlt_type { 'ACCESS' } |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
__PACKAGE__->new_guid(undef); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
DBIx::Class::Storage::DBI::ACCESS - Support specific to MS Access |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This is the base class for Microsoft Access support. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This driver supports L, |
|
27
|
|
|
|
|
|
|
empty inserts for tables with C columns, nested transactions via |
|
28
|
|
|
|
|
|
|
L, C columns via |
|
29
|
|
|
|
|
|
|
L. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SUPPORTED VERSIONS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This module has currently only been tested on MS Access 2010. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Information about how well it works on different version of MS Access is welcome |
|
36
|
|
|
|
|
|
|
(write the mailing list, or submit a ticket to RT if you find bugs.) |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 USING GUID COLUMNS |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
If you have C PKs or other C columns with |
|
41
|
|
|
|
|
|
|
L you will need to set a |
|
42
|
|
|
|
|
|
|
L callback, like |
|
43
|
|
|
|
|
|
|
so: |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$schema->storage->new_guid(sub { Data::GUID->new->as_string }); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Under L you can use code similar to this in your |
|
48
|
|
|
|
|
|
|
L C: |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
after BUILD => sub { |
|
51
|
|
|
|
|
|
|
my $self = shift; |
|
52
|
|
|
|
|
|
|
$self->storage->new_guid(sub { Data::GUID->new->as_string }); |
|
53
|
|
|
|
|
|
|
}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
|
|
sub _dbh_last_insert_id { $_[1]->selectrow_array('select @@identity') } |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# support empty insert |
|
60
|
|
|
|
|
|
|
sub insert { |
|
61
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
62
|
0
|
|
|
|
|
|
my ($source, $to_insert) = @_; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $columns_info = $source->columns_info; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if (keys %$to_insert == 0) { |
|
67
|
|
|
|
|
|
|
my ($autoinc_col) = grep { |
|
68
|
0
|
|
|
|
|
|
$columns_info->{$_}{is_auto_increment} |
|
69
|
0
|
|
|
|
|
|
} keys %$columns_info; |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
$self->throw_exception( |
|
72
|
|
|
|
|
|
|
'empty insert only supported for tables with an autoincrement column' |
|
73
|
|
|
|
|
|
|
) unless $autoinc_col; |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $table = $source->from; |
|
76
|
0
|
0
|
|
|
|
|
$table = $$table if ref $table; |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$to_insert->{$autoinc_col} = \"dmax('${autoinc_col}', '${table}')+1"; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return $self->next::method(@_); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub bind_attribute_by_data_type { |
|
85
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
86
|
0
|
|
|
|
|
|
my ($data_type) = @_; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
0
|
|
|
|
my $attributes = $self->next::method(@_) || {}; |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
0
|
|
|
|
|
if ($self->_is_text_lob_type($data_type)) { |
|
|
|
0
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$attributes->{TYPE} = DBI::SQL_LONGVARCHAR; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
elsif ($self->_is_binary_lob_type($data_type)) { |
|
94
|
0
|
|
|
|
|
|
$attributes->{TYPE} = DBI::SQL_LONGVARBINARY; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return $attributes; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# savepoints are not supported, but nested transactions are. |
|
101
|
|
|
|
|
|
|
# Unfortunately DBI does not support nested transactions. |
|
102
|
|
|
|
|
|
|
# WARNING: this code uses the undocumented 'BegunWork' DBI attribute. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub _exec_svp_begin { |
|
105
|
0
|
|
|
0
|
|
|
my ($self, $name) = @_; |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
local $self->_dbh->{AutoCommit} = 1; |
|
108
|
0
|
|
|
|
|
|
local $self->_dbh->{BegunWork} = 0; |
|
109
|
0
|
|
|
|
|
|
$self->_exec_txn_begin; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# A new nested transaction on the same level releases the previous one. |
|
113
|
0
|
|
|
0
|
|
|
sub _exec_svp_release { 1 } |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub _exec_svp_rollback { |
|
116
|
0
|
|
|
0
|
|
|
my ($self, $name) = @_; |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
local $self->_dbh->{AutoCommit} = 0; |
|
119
|
0
|
|
|
|
|
|
local $self->_dbh->{BegunWork} = 1; |
|
120
|
0
|
|
|
|
|
|
$self->_exec_txn_rollback; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 FURTHER QUESTIONS? |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Check the list of L. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This module is free software L |
|
130
|
|
|
|
|
|
|
by the L. You can |
|
131
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as the |
|
132
|
|
|
|
|
|
|
L. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# vim:sts=2 sw=2: |