line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Copyright (c) 2005, Presicient Corp., USA |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Permission is granted to use this software according to the terms of the |
5
|
|
|
|
|
|
|
# Artistic License, as specified in the Perl README file, |
6
|
|
|
|
|
|
|
# with the exception that commercial redistribution, either |
7
|
|
|
|
|
|
|
# electronic or via physical media, as either a standalone package, |
8
|
|
|
|
|
|
|
# or incorporated into a third party product, requires prior |
9
|
|
|
|
|
|
|
# written approval of the author. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# This software is distributed in the hope that it will be useful, |
12
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Presicient Corp. reserves the right to provide support for this software |
16
|
|
|
|
|
|
|
# to individual sites under a separate (possibly fee-based) |
17
|
|
|
|
|
|
|
# agreement. |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# History: |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
# 2005-Jan-27 D. Arnold |
22
|
|
|
|
|
|
|
# Coded. |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
package SQL::Amazon::StorageEngine; |
25
|
1
|
|
|
1
|
|
583
|
use SQL::Amazon::Tables::SysSchema; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
26
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
27
|
1
|
|
|
1
|
|
7
|
use constant AMZN_STORE_TABLES => 0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
28
|
1
|
|
|
1
|
|
5
|
use constant AMZN_STORE_ERRSTR => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2197
|
|
29
|
|
|
|
|
|
|
our %amzn_table_classes = ( |
30
|
|
|
|
|
|
|
'ACCESSORIES', 'SQL::Amazon::Tables::Accessories', |
31
|
|
|
|
|
|
|
'APPAREL', 'SQL::Amazon::Tables::Apparel', |
32
|
|
|
|
|
|
|
'BABY', 'SQL::Amazon::Tables::Baby', |
33
|
|
|
|
|
|
|
'BEAUTY', 'SQL::Amazon::Tables::Beauty', |
34
|
|
|
|
|
|
|
'BLENDED', 'SQL::Amazon::Tables::Blended', |
35
|
|
|
|
|
|
|
'BOOKS', 'SQL::Amazon::Tables::Books', |
36
|
|
|
|
|
|
|
'BROWSENODES', 'SQL::Amazon::Tables::BrowseNodes', |
37
|
|
|
|
|
|
|
'CAMERAPHOTO', 'SQL::Amazon::Tables::Photo', |
38
|
|
|
|
|
|
|
'CLASSICALMUSIC', 'SQL::Amazon::Tables::ClassicalMusic', |
39
|
|
|
|
|
|
|
'CUSTOMERREVIEWS', 'SQL::Amazon::Tables::CustomerReviews', |
40
|
|
|
|
|
|
|
'CUSTOMERS', 'SQL::Amazon::Tables::Customers', |
41
|
|
|
|
|
|
|
'DIGITALMUSIC', 'SQL::Amazon::Tables::DigitalMusic', |
42
|
|
|
|
|
|
|
'DVDS', 'SQL::Amazon::Tables::DVDs', |
43
|
|
|
|
|
|
|
'EDITORIALREVIEWS', 'SQL::Amazon::Tables::EditorialReviews', |
44
|
|
|
|
|
|
|
'ELECTRONICS', 'SQL::Amazon::Tables::Electronics', |
45
|
|
|
|
|
|
|
'GOURMETFOOD', 'SQL::Amazon::Tables::GourmetFood', |
46
|
|
|
|
|
|
|
'HARDWARE', 'SQL::Amazon::Tables::Hardware', |
47
|
|
|
|
|
|
|
'HEALTHPERSONALCARE', 'SQL::Amazon::Tables::HealthPersonalCare', |
48
|
|
|
|
|
|
|
'HOMEGARDEN', 'SQL::Amazon::Tables::HomeGarden', |
49
|
|
|
|
|
|
|
'ITEMS', 'SQL::Amazon::Tables::Items', |
50
|
|
|
|
|
|
|
'ITEMATTRIBUTES', 'SQL::Amazon::Tables::ItemAttributes', |
51
|
|
|
|
|
|
|
'ITEMFEATURES', 'SQL::Amazon::Tables::ItemFeatures', |
52
|
|
|
|
|
|
|
'JEWELRY', 'SQL::Amazon::Tables::Jewelry', |
53
|
|
|
|
|
|
|
'KITCHEN', 'SQL::Amazon::Tables::Kitchen', |
54
|
|
|
|
|
|
|
'LISTMANIALISTS', 'SQL::Amazon::Tables::ListManiaLists', |
55
|
|
|
|
|
|
|
'MAGAZINES', 'SQL::Amazon::Tables::Magazines', |
56
|
|
|
|
|
|
|
'MERCHANTS', 'SQL::Amazon::Tables::Merchants', |
57
|
|
|
|
|
|
|
'MISCELLANEOUS', 'SQL::Amazon::Tables::Miscellaneous', |
58
|
|
|
|
|
|
|
'MUSIC', 'SQL::Amazon::Tables::Music', |
59
|
|
|
|
|
|
|
'MUSICALINSTRUMENTS', 'SQL::Amazon::Tables::MusicalInstruments', |
60
|
|
|
|
|
|
|
'MUSICTRACKS', 'SQL::Amazon::Tables::MusicTracks', |
61
|
|
|
|
|
|
|
'OFFERS', 'SQL::Amazon::Tables::Offers', |
62
|
|
|
|
|
|
|
'OFFERLISTINGS', 'SQL::Amazon::Tables::OfferListings', |
63
|
|
|
|
|
|
|
'OFFICEPRODUCTS', 'SQL::Amazon::Tables::OfficeProducts', |
64
|
|
|
|
|
|
|
'OUTDOORLIVING', 'SQL::Amazon::Tables::OutdoorLiving', |
65
|
|
|
|
|
|
|
'PCHARDWARE', 'SQL::Amazon::Tables::PCHardware', |
66
|
|
|
|
|
|
|
'RESTAURANTS', 'SQL::Amazon::Tables::Restaurants', |
67
|
|
|
|
|
|
|
'SAVEDITEMS', 'SQL::Amazon::Tables::SavedItems', |
68
|
|
|
|
|
|
|
'SYSSCHEMA', 'SQL::Amazon::Tables::SysSchema', |
69
|
|
|
|
|
|
|
'SELLERS', 'SQL::Amazon::Tables::Sellers', |
70
|
|
|
|
|
|
|
'SELLERFEEDBACK', 'SQL::Amazon::Tables::SellerFeedback', |
71
|
|
|
|
|
|
|
'SELLERLISTINGS', 'SQL::Amazon::Tables::SellerListings', |
72
|
|
|
|
|
|
|
'SIMILARITEMS', 'SQL::Amazon::Tables::SimilarItems', |
73
|
|
|
|
|
|
|
'SIMILARPRODUCTS', 'SQL::Amazon::Tables::SimilarProducts', |
74
|
|
|
|
|
|
|
'SOFTWARE', 'SQL::Amazon::Tables::Software', |
75
|
|
|
|
|
|
|
'SPORTINGGOODS', 'SQL::Amazon::Tables::SportingGoods', |
76
|
|
|
|
|
|
|
'TRACKS', 'SQL::Amazon::Tables::Tracks', |
77
|
|
|
|
|
|
|
'TRANSACTIONS', 'SQL::Amazon::Tables::Transactions', |
78
|
|
|
|
|
|
|
'TRANSACTIONITEMS', 'SQL::Amazon::Tables::TransactionItems', |
79
|
|
|
|
|
|
|
'TOYS', 'SQL::Amazon::Tables::Toys', |
80
|
|
|
|
|
|
|
'VARIATIONS', 'SQL::Amazon::Tables::Variations', |
81
|
|
|
|
|
|
|
'VHS', 'SQL::Amazon::Tables::VHS', |
82
|
|
|
|
|
|
|
'VIDEO', 'SQL::Amazon::Tables::Video', |
83
|
|
|
|
|
|
|
'VIDEOLANGUAGES', 'SQL::Amazon::Tables::VideoLanguages', |
84
|
|
|
|
|
|
|
'VIDEOGAMES', 'SQL::Amazon::Tables::VideoGames', |
85
|
|
|
|
|
|
|
'WIRELESS', 'SQL::Amazon::Tables::Wireless', |
86
|
|
|
|
|
|
|
'WIRELESSACCESSORIES', 'SQL::Amazon::Tables::WirelessAccessories', |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
our %amzn_table_names = ( |
89
|
|
|
|
|
|
|
'ACCESSORIES', [ 'Accessories', 'Item' ], |
90
|
|
|
|
|
|
|
'APPAREL', [ 'Apparel', 'Item' ], |
91
|
|
|
|
|
|
|
'BABY', [ 'Baby', 'Item' ], |
92
|
|
|
|
|
|
|
'BEAUTY', [ 'Beauty', 'Item' ], |
93
|
|
|
|
|
|
|
'BLENDED', [ 'Blended', 'Item' ], |
94
|
|
|
|
|
|
|
'BOOKS', [ 'Books', 'Item' ], |
95
|
|
|
|
|
|
|
'BROWSENODES', [ 'BrowseNodes', 'BrowseNode' ], |
96
|
|
|
|
|
|
|
'CAMERAPHOTO', [ 'Photo', 'Item' ], |
97
|
|
|
|
|
|
|
'CART', [ 'Cart', 'Cart' ], |
98
|
|
|
|
|
|
|
'CLASSICALMUSIC', [ 'ClassicalMusic', 'Item' ], |
99
|
|
|
|
|
|
|
'CUSTOMERREVIEWS', [ 'CustomerReviews', 'CustomerContent' ], |
100
|
|
|
|
|
|
|
'CUSTOMERS', [ 'Customers', 'CustomerContent' ], |
101
|
|
|
|
|
|
|
'DIGITALMUSIC', [ 'DigitalMusic', 'Item' ], |
102
|
|
|
|
|
|
|
'DVDS', [ 'DVDs', 'Item' ], |
103
|
|
|
|
|
|
|
'EDITORIALREVIEWS', [ 'EditorialReviews', undef ], |
104
|
|
|
|
|
|
|
'ELECTRONICS', [ 'Electronics', 'Item' ], |
105
|
|
|
|
|
|
|
'GOURMETFOOD', [ 'GourmetFood', 'Item' ], |
106
|
|
|
|
|
|
|
'HARDWARE', [ 'Hardware', 'Item' ], |
107
|
|
|
|
|
|
|
'HEALTHPERSONALCARE', [ 'HealthPersonalCare', 'Item' ], |
108
|
|
|
|
|
|
|
'HOMEGARDEN', [ 'HomeGarden', 'Item' ], |
109
|
|
|
|
|
|
|
'ITEMS', [ 'Items', 'Item' ], |
110
|
|
|
|
|
|
|
'ITEMATTRIBUTES', [ 'ItemAttributes', undef ], |
111
|
|
|
|
|
|
|
'ITEMFEATURES', [ 'ItemFeatures', undef ], |
112
|
|
|
|
|
|
|
'JEWELRY', [ 'Jewelry', 'Item' ], |
113
|
|
|
|
|
|
|
'KITCHEN', [ 'Kitchen', 'Item' ], |
114
|
|
|
|
|
|
|
'LISTMANIALISTS', [ 'ListManiaLists', 'Lists' ], |
115
|
|
|
|
|
|
|
'MAGAZINES', [ 'Magazines', 'Item' ], |
116
|
|
|
|
|
|
|
'MERCHANTS', [ 'Merchants', 'Merchants', 'Sellers' ], |
117
|
|
|
|
|
|
|
'MISCELLANEOUS', [ 'Miscellaneous', 'Item' ], |
118
|
|
|
|
|
|
|
'MUSIC', [ 'Music', 'Item' ], |
119
|
|
|
|
|
|
|
'MUSICALINSTRUMENTS', [ 'MusicalInstruments', 'Item' ], |
120
|
|
|
|
|
|
|
'MUSICTRACKS', [ 'MusicTracks', 'Item' ], |
121
|
|
|
|
|
|
|
'OFFERS', [ 'Offers', undef ], |
122
|
|
|
|
|
|
|
'OFFERLISTINGS', [ 'OfferListings', undef ], |
123
|
|
|
|
|
|
|
'OFFICEPRODUCTS', [ 'OfficeProducts', 'Item' ], |
124
|
|
|
|
|
|
|
'OUTDOORLIVING', [ 'OutdoorLiving', 'Item' ], |
125
|
|
|
|
|
|
|
'PURCHASES', [ 'Purchases', undef ], |
126
|
|
|
|
|
|
|
'PCHARDWARE', [ 'PCHardware', 'Item' ], |
127
|
|
|
|
|
|
|
'RESTAURANTS', [ 'Restaurants', 'Item' ], |
128
|
|
|
|
|
|
|
'SAVEDITEMS', [ 'SavedItems', 'Cart' ], |
129
|
|
|
|
|
|
|
'SELLERS', [ 'Sellers', 'Sellers' ], |
130
|
|
|
|
|
|
|
'SELLERFEEDBACK', [ 'SellerFeedback', 'Sellers' ], |
131
|
|
|
|
|
|
|
'SELLERLISTINGS', [ 'SellerListings', 'Sellers' ], |
132
|
|
|
|
|
|
|
'SIMILARITEMS', [ 'SimilarItems', 'Similar' ], |
133
|
|
|
|
|
|
|
'SIMILARPRODUCTS', [ 'SimilarProducts', 'Similar' ], |
134
|
|
|
|
|
|
|
'SOFTWARE', [ 'Software', 'Item' ], |
135
|
|
|
|
|
|
|
'SPORTINGGOODS', [ 'SportingGoods', 'Item' ], |
136
|
|
|
|
|
|
|
'TRACKS', [ 'Tracks', 'Item' ], |
137
|
|
|
|
|
|
|
'TRANSACTIONS', [ 'Transactions', 'Transactions' ], |
138
|
|
|
|
|
|
|
'TRANSACTIONITEMS', [ 'TransactionItems', 'Transactions' ], |
139
|
|
|
|
|
|
|
'TOYS', [ 'Toys', 'Item' ], |
140
|
|
|
|
|
|
|
'VARIATIONS', [ 'Variations', 'Item' ], |
141
|
|
|
|
|
|
|
'VHS', [ 'VHS', 'Item' ], |
142
|
|
|
|
|
|
|
'VIDEO', [ 'Video', 'Item' ], |
143
|
|
|
|
|
|
|
'VIDEOLANGUAGES', [ 'VideoLanguages', 'Item' ], |
144
|
|
|
|
|
|
|
'VIDEOGAMES', [ 'VideoGames', 'Item' ], |
145
|
|
|
|
|
|
|
'WIRELESS', [ 'Wireless', 'Item' ], |
146
|
|
|
|
|
|
|
'WIRELESSACCESSORIES', [ 'WirelessAccessories', 'Item' ], |
147
|
|
|
|
|
|
|
); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub new { |
150
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
151
|
0
|
|
|
|
|
|
my $obj = [ {} ]; |
152
|
0
|
|
|
|
|
|
$obj->[AMZN_STORE_TABLES]{SYSSCHEMA} = |
153
|
|
|
|
|
|
|
SQL::Amazon::Tables::SysSchema->new; |
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
bless $obj, $class; |
156
|
0
|
|
|
|
|
|
return $obj; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
sub has_table { |
159
|
0
|
|
|
0
|
0
|
|
my $table = shift; |
160
|
0
|
0
|
|
|
|
|
$table = $1 if ($table=~/^CACHED(\w+)$/i); |
161
|
|
|
|
|
|
|
|
162
|
0
|
0
|
|
|
|
|
return wantarray ? @{$amzn_table_names{uc $table}} : |
|
0
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
$amzn_table_names{uc $table}[0]; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub get_table { |
167
|
0
|
|
|
0
|
0
|
|
my ($obj, $table) = @_; |
168
|
0
|
0
|
|
|
|
|
$table = $1 |
169
|
|
|
|
|
|
|
if ($table=~/^CACHED(\w+)$/i); |
170
|
|
|
|
|
|
|
|
171
|
0
|
0
|
|
|
|
|
$obj->[AMZN_STORE_ERRSTR] = 'Unknown table $table.', |
172
|
|
|
|
|
|
|
return undef |
173
|
|
|
|
|
|
|
unless $amzn_table_classes{uc $table}; |
174
|
0
|
|
|
|
|
|
$table = uc $table; |
175
|
0
|
|
|
|
|
|
$obj->[AMZN_STORE_ERRSTR] = undef; |
176
|
0
|
0
|
|
|
|
|
unless ($obj->[AMZN_STORE_TABLES]{$table}) { |
177
|
0
|
|
|
|
|
|
eval "require $amzn_table_classes{$table};"; |
178
|
0
|
0
|
|
|
|
|
$obj->[AMZN_STORE_ERRSTR] = $@, |
179
|
|
|
|
|
|
|
return undef |
180
|
|
|
|
|
|
|
if $@; |
181
|
0
|
|
|
|
|
|
my $class = $amzn_table_classes{$table}; |
182
|
0
|
|
|
|
|
|
$obj->[AMZN_STORE_TABLES]{$table} = ${class}->new(); |
183
|
|
|
|
|
|
|
} |
184
|
0
|
|
|
|
|
|
return $obj->[AMZN_STORE_TABLES]{$table}; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
sub debug { |
187
|
0
|
|
|
0
|
0
|
|
my ($obj, $debug, @tables) = @_; |
188
|
|
|
|
|
|
|
|
189
|
0
|
0
|
|
|
|
|
unless (scalar @tables) { |
190
|
0
|
|
|
|
|
|
$_->debug($debug) |
191
|
0
|
|
|
|
|
|
foreach (values %{$obj->[AMZN_STORE_TABLES]}); |
192
|
0
|
|
|
|
|
|
return $obj; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
foreach (@tables) { |
196
|
0
|
0
|
|
|
|
|
$obj->[AMZN_STORE_TABLES]{$_}->debug($debug) |
197
|
|
|
|
|
|
|
if $obj->[AMZN_STORE_TABLES]{uc $_}; |
198
|
|
|
|
|
|
|
} |
199
|
0
|
|
|
|
|
|
return $obj; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
sub close { |
202
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
203
|
0
|
|
|
|
|
|
delete $obj->[AMZN_STORE_TABLES]{$_} |
204
|
0
|
|
|
|
|
|
foreach (keys %{$obj->[AMZN_STORE_TABLES]}); |
205
|
0
|
|
|
|
|
|
return $obj; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub DESTROY { |
209
|
0
|
|
|
0
|
|
|
shift->close; |
210
|
0
|
|
|
|
|
|
1; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
sub cache_item { |
213
|
0
|
|
|
0
|
0
|
|
my ($obj, $table, $row) = @_; |
214
|
|
|
|
|
|
|
|
215
|
0
|
0
|
|
|
|
|
$table = $1 |
216
|
|
|
|
|
|
|
if ($table=~/^CACHED(\w+)$/i); |
217
|
|
|
|
|
|
|
|
218
|
0
|
|
|
|
|
|
$table = uc $table; |
219
|
0
|
|
|
|
|
|
my $table_obj = $obj->get_table($table); |
220
|
|
|
|
|
|
|
return undef |
221
|
0
|
0
|
|
|
|
|
unless $table_obj; |
222
|
|
|
|
|
|
|
|
223
|
0
|
0
|
|
|
|
|
$obj->[AMZN_STORE_ERRSTR] = $table_obj->errstr, |
224
|
|
|
|
|
|
|
return undef |
225
|
|
|
|
|
|
|
unless $table_obj->insert($row); |
226
|
0
|
|
|
|
|
|
return $obj; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
sub spoil_cache_item { |
229
|
0
|
|
|
0
|
0
|
|
my ($obj, $id, $table) = @_; |
230
|
|
|
|
|
|
|
|
231
|
0
|
0
|
|
|
|
|
$table = $1 |
232
|
|
|
|
|
|
|
if ($table=~/^CACHED(\w+)$/i); |
233
|
|
|
|
|
|
|
|
234
|
0
|
0
|
|
|
|
|
$obj->[AMZN_STORE_TABLES]{$table}->spoil($id) |
235
|
|
|
|
|
|
|
if $obj->[AMZN_STORE_TABLES]{$table}; |
236
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
|
return $obj; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
sub spoil_cache_table { |
241
|
0
|
|
|
0
|
0
|
|
my ($obj, $table) = @_; |
242
|
|
|
|
|
|
|
|
243
|
0
|
0
|
|
|
|
|
$table = $1 |
244
|
|
|
|
|
|
|
if ($table=~/^CACHED(\w+)$/i); |
245
|
|
|
|
|
|
|
|
246
|
0
|
0
|
|
|
|
|
$obj->[AMZN_STORE_TABLES]{$table}->spoil_all() |
247
|
|
|
|
|
|
|
if $obj->[AMZN_STORE_TABLES]{$table}; |
248
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
|
return $obj; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub spoil_cache_all { |
253
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
254
|
|
|
|
|
|
|
|
255
|
0
|
|
|
|
|
|
$obj->spoil_cache_table($_) |
256
|
0
|
|
|
|
|
|
foreach (keys %{$obj->[AMZN_STORE_TABLES]}); |
257
|
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
|
return $obj; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
sub send_requests { |
261
|
0
|
|
|
0
|
0
|
|
my ($obj, $requests) = @_; |
262
|
|
|
|
|
|
|
|
263
|
0
|
|
|
|
|
|
my $start = time(); |
264
|
0
|
|
|
|
|
|
my %reqids = (); |
265
|
0
|
|
|
|
|
|
my $warnmsg; |
266
|
0
|
|
|
|
|
|
my $reqno = 1; |
267
|
0
|
|
|
|
|
|
foreach (@$requests) { |
268
|
0
|
|
|
|
|
|
$_->{_reqno} = $reqno++; |
269
|
0
|
0
|
|
|
|
|
return ($_->errstr, undef, undef) |
270
|
|
|
|
|
|
|
unless $_->send_request($obj, \%reqids); |
271
|
0
|
0
|
|
|
|
|
$warnmsg = $_->warnstr unless $warnmsg; |
272
|
|
|
|
|
|
|
} |
273
|
0
|
|
|
|
|
|
return ($warnmsg, \%reqids, time() - $start); |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
sub get_result_set { |
276
|
0
|
|
|
0
|
0
|
|
my ($obj, $table, $reqids) = @_; |
277
|
0
|
0
|
|
|
|
|
$reqids = undef, |
278
|
|
|
|
|
|
|
$table = $1 |
279
|
|
|
|
|
|
|
if ($table=~/^CACHED(\w+)$/i); |
280
|
|
|
|
|
|
|
|
281
|
0
|
|
|
|
|
|
$table = uc $table; |
282
|
|
|
|
|
|
|
return undef |
283
|
0
|
0
|
|
|
|
|
unless $obj->[AMZN_STORE_TABLES]{$table}; |
284
|
0
|
|
|
|
|
|
return SQL::Amazon::Spool->new($obj->[AMZN_STORE_TABLES]{$table}, $reqids); |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
sub fetch_row { |
287
|
0
|
|
|
0
|
0
|
|
my ($obj, $table, $id, $timeout) = @_; |
288
|
|
|
|
|
|
|
|
289
|
0
|
0
|
|
|
|
|
$table = $1 |
290
|
|
|
|
|
|
|
if ($table=~/^CACHED(\w+)$/i); |
291
|
|
|
|
|
|
|
|
292
|
0
|
0
|
|
|
|
|
return $obj->[AMZN_STORE_TABLES]{$table} ? |
293
|
|
|
|
|
|
|
$obj->[AMZN_STORE_TABLES]{$table}->fetch($id, $timeout) : |
294
|
|
|
|
|
|
|
"Unknown table $table."; |
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub is_readonly { |
298
|
0
|
|
|
0
|
0
|
|
my ($obj, $table) = @_; |
299
|
|
|
|
|
|
|
|
300
|
0
|
0
|
|
|
|
|
$table = $1 |
301
|
|
|
|
|
|
|
if ($table=~/^CACHED(\w+)$/i); |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
|
$table = uc $table; |
304
|
0
|
0
|
|
|
|
|
return $obj->[AMZN_STORE_TABLES]{$table} ? |
305
|
|
|
|
|
|
|
$obj->[AMZN_STORE_TABLES]{$table}->is_readonly : 1; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
0
|
0
|
|
sub errstr { return shift->[AMZN_STORE_ERRSTR]; } |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
1; |