DBIx-Custom / t / common-sqlserver.t /
Newer Older
398 lines | 12.553kb
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
6
  if -f "$FindBin::Bin/run/common-postgresql.run";
7
$ENV{DBIX_CUSTOM_SKIP_MESSAGE} = 'postgresql private test';
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

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

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

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