DBIx-Custom / t / common-sqlserver.t /
Newer Older
397 lines | 12.516kb
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

            
14
    my $date_typename = 'date';
15
    my $datetime_typename = 'datetime';
16

            
17
    sub date_typename { lc $date_typename }
18
    sub datetime_typename { lc $datetime_typename }
19

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

            
23
    sub date_datatype { lc $date_datatype }
24
    sub datetime_datatype { lc $datetime_datatype }
fixed SQL Server tests
Yuki Kimoto authored on 2011-08-14
25

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

            
added SQL Server test
Yuki Kimoto authored on 2011-08-14
379
    my $dsn = "dbi:ODBC:driver={SQL Server};Server={localhost\\SQLEXPRESS};"
380
      . "Trusted_Connection=No;AutoTranslate=No;Database=dbix_custom;";
381
    has dsn => $dsn;
382
    has user  => 'dbix_custom';
383
    has password => 'dbix_custom';
384
    
385
    sub create_table1 { 'create table table1 (key1 varchar(255), key2 varchar(255));' }
386
    sub create_table1_2 {'create table table1 (key1 varchar(255), key2 varchar(255), '
387
     . 'key3 varchar(255), key4 varchar(255), key5 varchar(255));' }
388
    sub create_table1_type { "create table table1 (key1 $date_typename, key2 $datetime_typename);" }
389
    sub create_table1_highperformance { "create table table1 (ab varchar(255), bc varchar(255), "
390
      . "ik varchar(255), hi varchar(255), ui varchar(255), pq varchar(255), dc varchar(255));" }
391
    sub create_table2 { 'create table table2 (key1 varchar(255), key3 varchar(255));' }
392
    sub create_table2_2 { "create table table2 (key1 varchar(255), key2 varchar(255), key3 varchar(255))" }
393
    sub create_table3 { "create table table3 (key1 varchar(255), key2 varchar(255), key3 varchar(255))" }
394
    sub create_table_reserved { 'create table "table" ("select" varchar(255), "update" varchar(255))' }
395
}
396

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