DBIx-Custom / t / common-sqlserver.t /
Newer Older
427 lines | 13.266kb
added SQL Server test
Yuki Kimoto authored on 2011-08-14
1
use strict;
2
use warnings;
3

            
4
use FindBin;
5
$ENV{DBIX_CUSTOM_TEST_RUN} = 1
prepare oracle test
Yuki Kimoto authored on 2011-08-15
6
  if -f "$FindBin::Bin/run/common-sqlserver.run";
7
$ENV{DBIX_CUSTOM_SKIP_MESSAGE} = 'sqlserver private test';
added SQL Server test
Yuki Kimoto authored on 2011-08-14
8

            
9
use DBIx::Custom;
10
{
11
    package DBIx::Custom;
12
    no warnings 'redefine';
13

            
finished sqlserver test clea...
Yuki Kimoto authored on 2011-08-15
14
    my $table1 = 'table1';
15
    my $table2 = 'table2';
16
    my $table2_alias = 'table2_alias';
17
    my $table3 = 'table3';
18
    my $key1 = 'key1';
19
    my $key2 = 'key2';
20
    my $key3 = 'key3';
21
    my $key4 = 'key4';
22
    my $key5 = 'key5';
23
    my $key6 = 'key6';
24
    my $key7 = 'key7';
25
    my $key8 = 'key8';
26
    my $key9 = 'key9';
27
    my $key10 = 'key10';
28
    
29
    has table1 => $table1;
30
    has table2 => $table2;
31
    has table2_alias => $table2_alias;
32
    has table3 => $table3;
33
    has key1 => $key1;
34
    has key2 => $key2;
35
    has key3 => $key3;
36
    has key4 => $key4;
37
    has key5 => $key5;
38
    has key6 => $key6;
39
    has key7 => $key7;
40
    has key8 => $key8;
41
    has key9 => $key9;
42
    has key10 => $key10;
43

            
added SQL Server test
Yuki Kimoto authored on 2011-08-14
44
    my $date_typename = 'date';
45
    my $datetime_typename = 'datetime';
46

            
47
    sub date_typename { lc $date_typename }
48
    sub datetime_typename { lc $datetime_typename }
49

            
fixex [] reserved_word_quote...
Yuki Kimoto authored on 2011-08-14
50
    my $date_datatype = -9;
51
    my $datetime_datatype = 93;
added SQL Server test
Yuki Kimoto authored on 2011-08-14
52

            
53
    sub date_datatype { lc $date_datatype }
54
    sub datetime_datatype { lc $datetime_datatype }
fixed SQL Server tests
Yuki Kimoto authored on 2011-08-14
55

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

            
added SQL Server test
Yuki Kimoto authored on 2011-08-14
409
    my $dsn = "dbi:ODBC:driver={SQL Server};Server={localhost\\SQLEXPRESS};"
410
      . "Trusted_Connection=No;AutoTranslate=No;Database=dbix_custom;";
411
    has dsn => $dsn;
412
    has user  => 'dbix_custom';
413
    has password => 'dbix_custom';
414
    
cleanup test
Yuki Kimoto authored on 2011-08-15
415
    sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255))" }
finished sqlserver test clea...
Yuki Kimoto authored on 2011-08-15
416
    sub create_table1_2 {"create table $table1 ($key1 varchar(255), $key2 varchar(255), "
cleanup test
Yuki Kimoto authored on 2011-08-15
417
     . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255))" }
418
    sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
finished sqlserver test clea...
Yuki Kimoto authored on 2011-08-15
419
    sub create_table1_highperformance { "create table $table1 ($key1 varchar(255), $key2 varchar(255), "
cleanup test
Yuki Kimoto authored on 2011-08-15
420
      . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255))" }
421
    sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255))" }
finished sqlserver test clea...
Yuki Kimoto authored on 2011-08-15
422
    sub create_table2_2 { "create table $table2 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" }
423
    sub create_table3 { "create table $table3 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" }
added SQL Server test
Yuki Kimoto authored on 2011-08-14
424
    sub create_table_reserved { 'create table "table" ("select" varchar(255), "update" varchar(255))' }
425
}
426

            
427
require "$FindBin::Bin/common.t";