DDL/Constants.pm

filter: Statementstmt 100% 35 / 35 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 100% 46 / 46 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« DDL/CloneClear.pm ↑ Summary DDL/Failure.pm »
1 package CXC::DB::DDL::Constants;
2  
3 # ABSTRACT: Constants
4  
5 12 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use experimental 'signatures', 'postderef';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 12 our $VERSION = '0.21';
11  
12 12 ▶use DBI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 12 ▶use CXC::Exporter::Util ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 12 ▶use SQL::Translator::Schema::Constants ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 12 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 12 ▶use base 'Exporter::Tiny';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 12 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
21 install_CONSTANTS {
22  
23 SCHEMA_CONSTANTS => {
24 NOT_NULL => SQL::Translator::Schema::Constants::NOT_NULL(),
25 PRIMARY_KEY => SQL::Translator::Schema::Constants::PRIMARY_KEY(),
26 FOREIGN_KEY => SQL::Translator::Schema::Constants::FOREIGN_KEY(),
27 UNIQUE => SQL::Translator::Schema::Constants::UNIQUE(),
28 NORMAL => SQL::Translator::Schema::Constants::NORMAL(),
29 CHECK_C => SQL::Translator::Schema::Constants::CHECK_C(),
30 },
31  
32 SCHEMA_CONSTRAINT_MATCH_TYPES => {
33 FULL => 'full',
34 PARTIAL => 'partial',
35 SIMPLE => 'simple',
36 },
37  
38 SCHEMA_CONSTRAINT_ON_DELETE => {
39 NO_ACTION => 'NO ACTION',
40 RESTRICT => 'RESTRICT',
41 SET_NULL => 'SET NULL',
42 SET_DEFAULT => 'SET DEFAULT',
43 CASCADE => 'CASCADE',
44 },
45  
46 SCHEMA_CONSTRAINT_ON_UPDATE => {
47 NO_ACTION => 'NO ACTION',
48 RESTRICT => 'RESTRICT',
49 SET_NULL => 'SET NULL',
50 SET_DEFAULT => 'SET DEFAULT',
51 CASCADE => 'CASCADE',
52 },
53  
54 # this acess is documented in DBI, so it's legal
55 SQL_TYPE_CONSTANTS => {
56 map {
57 12 ▶ no strict 'refs'; ## no critic (TestingAndDebugging::ProhibitNoStrict)
Subroutine BEGIN: called CC=1 SCAR=0.0
58 696 $_ => &{"DBI::$_"};
59 } $DBI::EXPORT_TAGS{sql_types}->@*,
60 },
61  
62 12 CREATE_CONSTANTS => {
63 CREATE_IF_NOT_EXISTS => 0, # create table only if it doesn't exist
64 CREATE_ALWAYS => 1, # drop then create table
65 CREATE_ONCE => 2, # error if table already exists
66 },
67  
68 # these should be the DBD driver name.
69 SUPPORTED_DBDS => {
70 DBD_SYBASE => 'Sybase',
71 DBD_POSTGRESQL => 'Pg',
72 DBD_SQLITE => 'SQLite',
73 },
74 };
75 }
76  
77 12 install_EXPORTS;
78  
79 #
80 # This file is part of CXC-DB-DDL
81 #
82 # This software is Copyright (c) 2022 by Smithsonian Astrophysical Observatory.
83 #
84 # This is free software, licensed under:
85 #
86 # The GNU General Public License, Version 3, June 2007
87 #
88  
89 12 1;
90  
91 __END__
« DDL/CloneClear.pm ↑ Summary DDL/Failure.pm »