... | ... |
@@ -0,0 +1,428 @@ |
1 |
+use strict; |
|
2 |
+use warnings; |
|
3 |
+ |
|
4 |
+use FindBin; |
|
5 |
+use lib "$FindBin::Bin/common"; |
|
6 |
+$ENV{DBIX_CUSTOM_TEST_RUN} = 1 |
|
7 |
+ if -f "$FindBin::Bin/run/common-sqlserver.run"; |
|
8 |
+$ENV{DBIX_CUSTOM_SKIP_MESSAGE} = 'sqlserver private test'; |
|
9 |
+ |
|
10 |
+use DBIx::Custom; |
|
11 |
+{ |
|
12 |
+ package DBIx::Custom; |
|
13 |
+ no warnings 'redefine'; |
|
14 |
+ |
|
15 |
+ my $table1 = 'table1'; |
|
16 |
+ my $table2 = 'table2'; |
|
17 |
+ my $table2_alias = 'table2_alias'; |
|
18 |
+ my $table3 = 'table3'; |
|
19 |
+ my $key1 = 'key1'; |
|
20 |
+ my $key2 = 'key2'; |
|
21 |
+ my $key3 = 'key3'; |
|
22 |
+ my $key4 = 'key4'; |
|
23 |
+ my $key5 = 'key5'; |
|
24 |
+ my $key6 = 'key6'; |
|
25 |
+ my $key7 = 'key7'; |
|
26 |
+ my $key8 = 'key8'; |
|
27 |
+ my $key9 = 'key9'; |
|
28 |
+ my $key10 = 'key10'; |
|
29 |
+ |
|
30 |
+ has table1 => $table1; |
|
31 |
+ has table2 => $table2; |
|
32 |
+ has table2_alias => $table2_alias; |
|
33 |
+ has table3 => $table3; |
|
34 |
+ has key1 => $key1; |
|
35 |
+ has key2 => $key2; |
|
36 |
+ has key3 => $key3; |
|
37 |
+ has key4 => $key4; |
|
38 |
+ has key5 => $key5; |
|
39 |
+ has key6 => $key6; |
|
40 |
+ has key7 => $key7; |
|
41 |
+ has key8 => $key8; |
|
42 |
+ has key9 => $key9; |
|
43 |
+ has key10 => $key10; |
|
44 |
+ |
|
45 |
+ my $date_typename = 'date'; |
|
46 |
+ my $datetime_typename = 'datetime'; |
|
47 |
+ |
|
48 |
+ sub date_typename { lc $date_typename } |
|
49 |
+ sub datetime_typename { lc $datetime_typename } |
|
50 |
+ |
|
51 |
+ my $date_datatype = -9; |
|
52 |
+ my $datetime_datatype = 93; |
|
53 |
+ |
|
54 |
+ sub date_datatype { lc $date_datatype } |
|
55 |
+ sub datetime_datatype { lc $datetime_datatype } |
|
56 |
+ |
|
57 |
+ has exclude_table => sub { |
|
58 |
+ return qr/^( |
|
59 |
+ CHECK_CONSTRAINTS |
|
60 |
+ |COLUMN_DOMAIN_USAGE |
|
61 |
+ |COLUMN_PRIVILEGES |
|
62 |
+ |COLUMNS |
|
63 |
+ |CONSTRAINT_COLUMN_USAGE |
|
64 |
+ |CONSTRAINT_TABLE_USAGE |
|
65 |
+ |DOMAIN_CONSTRAINTS |
|
66 |
+ |DOMAINS |
|
67 |
+ |KEY_COLUMN_USAGE |
|
68 |
+ |PARAMETERS |
|
69 |
+ |REFERENTIAL_CONSTRAINTS |
|
70 |
+ |ROUTINE_COLUMNS |
|
71 |
+ |ROUTINES |
|
72 |
+ |SCHEMATA |
|
73 |
+ |TABLE_CONSTRAINTS |
|
74 |
+ |TABLE_PRIVILEGES |
|
75 |
+ |TABLES |
|
76 |
+ |VIEW_COLUMN_USAGE |
|
77 |
+ |VIEW_TABLE_USAGE |
|
78 |
+ |VIEWS |
|
79 |
+ |all_columns |
|
80 |
+ |all_objects |
|
81 |
+ |all_parameters |
|
82 |
+ |all_sql_modules |
|
83 |
+ |all_views |
|
84 |
+ |allocation_units |
|
85 |
+ |assemblies |
|
86 |
+ |assembly_files |
|
87 |
+ |assembly_modules |
|
88 |
+ |assembly_references |
|
89 |
+ |assembly_types |
|
90 |
+ |asymmetric_keys |
|
91 |
+ |backup_devices |
|
92 |
+ |certificates |
|
93 |
+ |change_tracking_databases |
|
94 |
+ |change_tracking_tables |
|
95 |
+ |check_constraints |
|
96 |
+ |column_type_usages |
|
97 |
+ |column_xml_schema_collection_usages |
|
98 |
+ |columns |
|
99 |
+ |computed_columns |
|
100 |
+ |configurations |
|
101 |
+ |conversation_endpoints |
|
102 |
+ |conversation_groups |
|
103 |
+ |conversation_priorities |
|
104 |
+ |credentials |
|
105 |
+ |crypt_properties |
|
106 |
+ |cryptographic_providers |
|
107 |
+ |data_spaces |
|
108 |
+ |database_audit_specification_details |
|
109 |
+ |database_audit_specifications |
|
110 |
+ |database_files |
|
111 |
+ |database_mirroring |
|
112 |
+ |database_mirroring_endpoints |
|
113 |
+ |database_permissions |
|
114 |
+ |database_principal_aliases |
|
115 |
+ |database_principals |
|
116 |
+ |database_recovery_status |
|
117 |
+ |database_role_members |
|
118 |
+ |databases |
|
119 |
+ |default_constraints |
|
120 |
+ |destination_data_spaces |
|
121 |
+ |dm_audit_actions |
|
122 |
+ |dm_audit_class_type_map |
|
123 |
+ |dm_broker_activated_tasks |
|
124 |
+ |dm_broker_connections |
|
125 |
+ |dm_broker_forwarded_messages |
|
126 |
+ |dm_broker_queue_monitors |
|
127 |
+ |dm_cdc_errors |
|
128 |
+ |dm_cdc_log_scan_sessions |
|
129 |
+ |dm_clr_appdomains |
|
130 |
+ |dm_clr_loaded_assemblies |
|
131 |
+ |dm_clr_properties |
|
132 |
+ |dm_clr_tasks |
|
133 |
+ |dm_cryptographic_provider_properties |
|
134 |
+ |dm_database_encryption_keys |
|
135 |
+ |dm_db_file_space_usage |
|
136 |
+ |dm_db_index_usage_stats |
|
137 |
+ |dm_db_mirroring_auto_page_repair |
|
138 |
+ |dm_db_mirroring_connections |
|
139 |
+ |dm_db_mirroring_past_actions |
|
140 |
+ |dm_db_missing_index_details |
|
141 |
+ |dm_db_missing_index_group_stats |
|
142 |
+ |dm_db_missing_index_groups |
|
143 |
+ |dm_db_partition_stats |
|
144 |
+ |dm_db_persisted_sku_features |
|
145 |
+ |dm_db_script_level |
|
146 |
+ |dm_db_session_space_usage |
|
147 |
+ |dm_db_task_space_usage |
|
148 |
+ |dm_exec_background_job_queue |
|
149 |
+ |dm_exec_background_job_queue_stats |
|
150 |
+ |dm_exec_cached_plans |
|
151 |
+ |dm_exec_connections |
|
152 |
+ |dm_exec_procedure_stats |
|
153 |
+ |dm_exec_query_memory_grants |
|
154 |
+ |dm_exec_query_optimizer_info |
|
155 |
+ |dm_exec_query_resource_semaphores |
|
156 |
+ |dm_exec_query_stats |
|
157 |
+ |dm_exec_query_transformation_stats |
|
158 |
+ |dm_exec_requests |
|
159 |
+ |dm_exec_sessions |
|
160 |
+ |dm_exec_trigger_stats |
|
161 |
+ |dm_filestream_file_io_handles |
|
162 |
+ |dm_filestream_file_io_requests |
|
163 |
+ |dm_fts_active_catalogs |
|
164 |
+ |dm_fts_fdhosts |
|
165 |
+ |dm_fts_index_population |
|
166 |
+ |dm_fts_memory_buffers |
|
167 |
+ |dm_fts_memory_pools |
|
168 |
+ |dm_fts_outstanding_batches |
|
169 |
+ |dm_fts_population_ranges |
|
170 |
+ |dm_io_backup_tapes |
|
171 |
+ |dm_io_cluster_shared_drives |
|
172 |
+ |dm_io_pending_io_requests |
|
173 |
+ |dm_os_buffer_descriptors |
|
174 |
+ |dm_os_child_instances |
|
175 |
+ |dm_os_cluster_nodes |
|
176 |
+ |dm_os_dispatcher_pools |
|
177 |
+ |dm_os_dispatchers |
|
178 |
+ |dm_os_hosts |
|
179 |
+ |dm_os_latch_stats |
|
180 |
+ |dm_os_loaded_modules |
|
181 |
+ |dm_os_memory_allocations |
|
182 |
+ |dm_os_memory_brokers |
|
183 |
+ |dm_os_memory_cache_clock_hands |
|
184 |
+ |dm_os_memory_cache_counters |
|
185 |
+ |dm_os_memory_cache_entries |
|
186 |
+ |dm_os_memory_cache_hash_tables |
|
187 |
+ |dm_os_memory_clerks |
|
188 |
+ |dm_os_memory_node_access_stats |
|
189 |
+ |dm_os_memory_nodes |
|
190 |
+ |dm_os_memory_objects |
|
191 |
+ |dm_os_memory_pools |
|
192 |
+ |dm_os_nodes |
|
193 |
+ |dm_os_performance_counters |
|
194 |
+ |dm_os_process_memory |
|
195 |
+ |dm_os_ring_buffers |
|
196 |
+ |dm_os_schedulers |
|
197 |
+ |dm_os_spinlock_stats |
|
198 |
+ |dm_os_stacks |
|
199 |
+ |dm_os_sublatches |
|
200 |
+ |dm_os_sys_info |
|
201 |
+ |dm_os_sys_memory |
|
202 |
+ |dm_os_tasks |
|
203 |
+ |dm_os_threads |
|
204 |
+ |dm_os_virtual_address_dump |
|
205 |
+ |dm_os_wait_stats |
|
206 |
+ |dm_os_waiting_tasks |
|
207 |
+ |dm_os_worker_local_storage |
|
208 |
+ |dm_os_workers |
|
209 |
+ |dm_qn_subscriptions |
|
210 |
+ |dm_repl_articles |
|
211 |
+ |dm_repl_schemas |
|
212 |
+ |dm_repl_tranhash |
|
213 |
+ |dm_repl_traninfo |
|
214 |
+ |dm_resource_governor_configuration |
|
215 |
+ |dm_resource_governor_resource_pools |
|
216 |
+ |dm_resource_governor_workload_groups |
|
217 |
+ |dm_server_audit_status |
|
218 |
+ |dm_tran_active_snapshot_database_transactions |
|
219 |
+ |dm_tran_active_transactions |
|
220 |
+ |dm_tran_commit_table |
|
221 |
+ |dm_tran_current_snapshot |
|
222 |
+ |dm_tran_current_transaction |
|
223 |
+ |dm_tran_database_transactions |
|
224 |
+ |dm_tran_locks |
|
225 |
+ |dm_tran_session_transactions |
|
226 |
+ |dm_tran_top_version_generators |
|
227 |
+ |dm_tran_transactions_snapshot |
|
228 |
+ |dm_tran_version_store |
|
229 |
+ |dm_xe_map_values |
|
230 |
+ |dm_xe_object_columns |
|
231 |
+ |dm_xe_objects |
|
232 |
+ |dm_xe_packages |
|
233 |
+ |dm_xe_session_event_actions |
|
234 |
+ |dm_xe_session_events |
|
235 |
+ |dm_xe_session_object_columns |
|
236 |
+ |dm_xe_session_targets |
|
237 |
+ |dm_xe_sessions |
|
238 |
+ |endpoint_webmethods |
|
239 |
+ |endpoints |
|
240 |
+ |event_notification_event_types |
|
241 |
+ |event_notifications |
|
242 |
+ |events |
|
243 |
+ |extended_procedures |
|
244 |
+ |extended_properties |
|
245 |
+ |filegroups |
|
246 |
+ |foreign_key_columns |
|
247 |
+ |foreign_keys |
|
248 |
+ |fulltext_catalogs |
|
249 |
+ |fulltext_document_types |
|
250 |
+ |fulltext_index_catalog_usages |
|
251 |
+ |fulltext_index_columns |
|
252 |
+ |fulltext_index_fragments |
|
253 |
+ |fulltext_indexes |
|
254 |
+ |fulltext_languages |
|
255 |
+ |fulltext_stoplists |
|
256 |
+ |fulltext_stopwords |
|
257 |
+ |fulltext_system_stopwords |
|
258 |
+ |function_order_columns |
|
259 |
+ |http_endpoints |
|
260 |
+ |identity_columns |
|
261 |
+ |index_columns |
|
262 |
+ |indexes |
|
263 |
+ |internal_tables |
|
264 |
+ |key_constraints |
|
265 |
+ |key_encryptions |
|
266 |
+ |linked_logins |
|
267 |
+ |login_token |
|
268 |
+ |master_files |
|
269 |
+ |master_key_passwords |
|
270 |
+ |message_type_xml_schema_collection_usages |
|
271 |
+ |messages |
|
272 |
+ |module_assembly_usages |
|
273 |
+ |numbered_procedure_parameters |
|
274 |
+ |numbered_procedures |
|
275 |
+ |objects |
|
276 |
+ |openkeys |
|
277 |
+ |parameter_type_usages |
|
278 |
+ |parameter_xml_schema_collection_usages |
|
279 |
+ |parameters |
|
280 |
+ |partition_functions |
|
281 |
+ |partition_parameters |
|
282 |
+ |partition_range_values |
|
283 |
+ |partition_schemes |
|
284 |
+ |partitions |
|
285 |
+ |plan_guides |
|
286 |
+ |procedures |
|
287 |
+ |remote_logins |
|
288 |
+ |remote_service_bindings |
|
289 |
+ |resource_governor_configuration |
|
290 |
+ |resource_governor_resource_pools |
|
291 |
+ |resource_governor_workload_groups |
|
292 |
+ |routes |
|
293 |
+ |schemas |
|
294 |
+ |securable_classes |
|
295 |
+ |server_assembly_modules |
|
296 |
+ |server_audit_specification_details |
|
297 |
+ |server_audit_specifications |
|
298 |
+ |server_audits |
|
299 |
+ |server_event_notifications |
|
300 |
+ |server_event_session_actions |
|
301 |
+ |server_event_session_events |
|
302 |
+ |server_event_session_fields |
|
303 |
+ |server_event_session_targets |
|
304 |
+ |server_event_sessions |
|
305 |
+ |server_events |
|
306 |
+ |server_file_audits |
|
307 |
+ |server_permissions |
|
308 |
+ |server_principal_credentials |
|
309 |
+ |server_principals |
|
310 |
+ |server_role_members |
|
311 |
+ |server_sql_modules |
|
312 |
+ |server_trigger_events |
|
313 |
+ |server_triggers |
|
314 |
+ |servers |
|
315 |
+ |service_broker_endpoints |
|
316 |
+ |service_contract_message_usages |
|
317 |
+ |service_contract_usages |
|
318 |
+ |service_contracts |
|
319 |
+ |service_message_types |
|
320 |
+ |service_queue_usages |
|
321 |
+ |service_queues |
|
322 |
+ |services |
|
323 |
+ |soap_endpoints |
|
324 |
+ |spatial_index_tessellations |
|
325 |
+ |spatial_indexes |
|
326 |
+ |spatial_reference_systems |
|
327 |
+ |sql_dependencies |
|
328 |
+ |sql_logins |
|
329 |
+ |sql_modules |
|
330 |
+ |stats |
|
331 |
+ |stats_columns |
|
332 |
+ |symmetric_keys |
|
333 |
+ |synonyms |
|
334 |
+ |syscacheobjects |
|
335 |
+ |syscharsets |
|
336 |
+ |syscolumns |
|
337 |
+ |syscomments |
|
338 |
+ |sysconfigures |
|
339 |
+ |sysconstraints |
|
340 |
+ |syscurconfigs |
|
341 |
+ |syscursorcolumns |
|
342 |
+ |syscursorrefs |
|
343 |
+ |syscursors |
|
344 |
+ |syscursortables |
|
345 |
+ |sysdatabases |
|
346 |
+ |sysdepends |
|
347 |
+ |sysdevices |
|
348 |
+ |sysfilegroups |
|
349 |
+ |sysfiles |
|
350 |
+ |sysforeignkeys |
|
351 |
+ |sysfulltextcatalogs |
|
352 |
+ |sysindexes |
|
353 |
+ |sysindexkeys |
|
354 |
+ |syslanguages |
|
355 |
+ |syslockinfo |
|
356 |
+ |syslogins |
|
357 |
+ |sysmembers |
|
358 |
+ |sysmessages |
|
359 |
+ |sysobjects |
|
360 |
+ |sysoledbusers |
|
361 |
+ |sysopentapes |
|
362 |
+ |sysperfinfo |
|
363 |
+ |syspermissions |
|
364 |
+ |sysprocesses |
|
365 |
+ |sysprotects |
|
366 |
+ |sysreferences |
|
367 |
+ |sysremotelogins |
|
368 |
+ |sysservers |
|
369 |
+ |system_columns |
|
370 |
+ |system_components_surface_area_configuration |
|
371 |
+ |system_objects |
|
372 |
+ |system_parameters |
|
373 |
+ |system_sql_modules |
|
374 |
+ |system_views |
|
375 |
+ |systypes |
|
376 |
+ |sysusers |
|
377 |
+ |table_types |
|
378 |
+ |tables |
|
379 |
+ |tcp_endpoints |
|
380 |
+ |trace_categories |
|
381 |
+ |trace_columns |
|
382 |
+ |trace_event_bindings |
|
383 |
+ |trace_events |
|
384 |
+ |trace_subclass_values |
|
385 |
+ |traces |
|
386 |
+ |transmission_queue |
|
387 |
+ |trigger_event_types |
|
388 |
+ |trigger_events |
|
389 |
+ |triggers |
|
390 |
+ |type_assembly_usages |
|
391 |
+ |types |
|
392 |
+ |user_token |
|
393 |
+ |via_endpoints |
|
394 |
+ |views |
|
395 |
+ |xml_indexes |
|
396 |
+ |xml_schema_attributes |
|
397 |
+ |xml_schema_collections |
|
398 |
+ |xml_schema_component_placements |
|
399 |
+ |xml_schema_components |
|
400 |
+ |xml_schema_elements |
|
401 |
+ |xml_schema_facets |
|
402 |
+ |xml_schema_model_groups |
|
403 |
+ |xml_schema_namespaces |
|
404 |
+ |xml_schema_types |
|
405 |
+ |xml_schema_wildcard_namespaces |
|
406 |
+ |xml_schema_wildcards |
|
407 |
+ )/x |
|
408 |
+ }; |
|
409 |
+ |
|
410 |
+ my $dsn = "dbi:ODBC:driver={SQL Server};Server={localhost\\SQLEXPRESS};" |
|
411 |
+ . "Trusted_Connection=No;AutoTranslate=No;Database=dbix_custom;"; |
|
412 |
+ has dsn => $dsn; |
|
413 |
+ has user => 'dbix_custom'; |
|
414 |
+ has password => 'dbix_custom'; |
|
415 |
+ |
|
416 |
+ sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255))" } |
|
417 |
+ sub create_table1_2 {"create table $table1 ($key1 varchar(255), $key2 varchar(255), " |
|
418 |
+ . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255))" } |
|
419 |
+ sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" } |
|
420 |
+ sub create_table1_highperformance { "create table $table1 ($key1 varchar(255), $key2 varchar(255), " |
|
421 |
+ . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255))" } |
|
422 |
+ sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255))" } |
|
423 |
+ sub create_table2_2 { "create table $table2 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" } |
|
424 |
+ sub create_table3 { "create table $table3 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" } |
|
425 |
+ sub create_table_reserved { 'create table "table" ("select" varchar(255), "update" varchar(255))' } |
|
426 |
+} |
|
427 |
+ |
|
428 |
+require "$FindBin::Bin/common.t"; |