| 1 | package Rose::DB::Object::Metadata; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 61 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 61 | ▶ | use Carp(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 61 | ▶ | use Rose::Object; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 61 | our @ISA = qw(Rose::Object); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 61 | ▶ | use Rose::DB::Object::Util qw(lazy_column_values_loaded_key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | use Rose::DB::Object::Constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 61 | ▶ | qw(PRIVATE_PREFIX STATE_IN_DB MODIFIED_COLUMNS); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 61 | ▶ | use Rose::DB::Object::ConventionManager; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 61 | ▶ | use Rose::DB::Object::ConventionManager::Null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 61 | ▶ | use Rose::DB::Object::Metadata::PrimaryKey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 61 | ▶ | use Rose::DB::Object::Metadata::UniqueKey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 61 | ▶ | use Rose::DB::Object::Metadata::ForeignKey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 61 | ▶ | use Rose::DB::Object::Metadata::Column::Scalar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 61 | ▶ | use Rose::DB::Object::Metadata::Relationship::OneToOne; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # Attempt to load Scalar::Util::Clone at runtime and ignore any errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # to keep it from being a "hard" requirement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 61 | eval { local $@; require Scalar::Util::Clone }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 61 | ▶ | use Clone(); # This is the backup clone method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 61 | our $VERSION = '0.820'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 61 | our $Debug = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # Object data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | use Rose::Object::MakeMethods::Generic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 61 | ▶ | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 61 | scalar => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'class', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 'error', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 'pre_init_hook', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 'post_init_hook', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | '_object_default_manager_base_class', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 'scalar --get_set_init' => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 'db', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 'db_id', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 'primary_key', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 'column_name_to_method_name_mapper', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 'original_class', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 'auto_prime_caches', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | boolean => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | allow_inline_column_values => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | is_initialized => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | is_auto_initializating => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | allow_auto_initialization => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | was_auto_initialized => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | initialized_foreign_keys => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | default_load_speculative => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | auto_load_related_classes => { default => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | default_update_changes_only => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | default_insert_changes_only => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | default_cascade_save => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | default_smart_modification => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | include_predicated_unique_indexes => { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 'array --get_set_inited' => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 'columns_ordered', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 'nonpersistent_columns_ordered', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 61 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # Class data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | use Rose::Class::MakeMethods::Generic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 61 | ▶ | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 61 | inheritable_scalar => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 'dbi_prepare_cached', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 'default_column_undef_overrides_default', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | '_class_default_manager_base_class', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | inheritable_hash => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | column_type_classes => { interface => 'get_set_all' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | column_type_names => { interface => 'keys', hash_key => 'column_type_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | _column_type_class => { interface => 'get_set', hash_key => 'column_type_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | _delete_column_type_class => { interface => 'delete', hash_key => 'column_type_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | auto_helper_classes => { interface => 'get_set_all' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | delete_auto_helper_class => { interface => 'delete', hash_key => 'auto_helper_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | relationship_type_classes => { interface => 'get_set_all' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | relationship_type_class => { interface => 'get_set', hash_key => 'relationship_type_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | delete_relationship_type_class => { interface => 'delete', hash_key => 'relationship_type_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | class_registry => => { interface => 'get_set_all' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | convention_manager_classes => { interface => 'get_set_all' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | convention_manager_class => { interface => 'get_set', hash_key => 'convention_manager_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | delete_convention_manager_class => { interface => 'delete', hash_key => 'convention_manager_classes' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 61 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 61 | __PACKAGE__->default_manager_base_class('Rose::DB::Object::Manager'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 61 | __PACKAGE__->dbi_prepare_cached(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 61 | __PACKAGE__->class_registry({}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 61 | __PACKAGE__->auto_helper_classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 'informix' => 'Rose::DB::Object::Metadata::Auto::Informix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 'pg' => 'Rose::DB::Object::Metadata::Auto::Pg', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 'mysql' => 'Rose::DB::Object::Metadata::Auto::MySQL', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 'sqlite' => 'Rose::DB::Object::Metadata::Auto::SQLite', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 'oracle' => 'Rose::DB::Object::Metadata::Auto::Oracle', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 'generic' => 'Rose::DB::Object::Metadata::Auto::Generic', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 61 | __PACKAGE__->convention_manager_classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 'default' => 'Rose::DB::Object::ConventionManager', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 'null' => 'Rose::DB::Object::ConventionManager::Null', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 61 | __PACKAGE__->column_type_classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 'scalar' => 'Rose::DB::Object::Metadata::Column::Scalar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 'char' => 'Rose::DB::Object::Metadata::Column::Character', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 'character' => 'Rose::DB::Object::Metadata::Column::Character', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 'varchar' => 'Rose::DB::Object::Metadata::Column::Varchar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 'varchar2' => 'Rose::DB::Object::Metadata::Column::Varchar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 'nvarchar' => 'Rose::DB::Object::Metadata::Column::Varchar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 'nvarchar2' => 'Rose::DB::Object::Metadata::Column::Varchar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 'string' => 'Rose::DB::Object::Metadata::Column::Varchar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 'text' => 'Rose::DB::Object::Metadata::Column::Text', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 'blob' => 'Rose::DB::Object::Metadata::Column::Blob', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 'bytea' => 'Rose::DB::Object::Metadata::Column::Pg::Bytea', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 'bits' => 'Rose::DB::Object::Metadata::Column::Bitfield', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 'bitfield' => 'Rose::DB::Object::Metadata::Column::Bitfield', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 'bool' => 'Rose::DB::Object::Metadata::Column::Boolean', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 'boolean' => 'Rose::DB::Object::Metadata::Column::Boolean', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 'int' => 'Rose::DB::Object::Metadata::Column::Integer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 'integer' => 'Rose::DB::Object::Metadata::Column::Integer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 'tinyint' => 'Rose::DB::Object::Metadata::Column::Integer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 'smallint' => 'Rose::DB::Object::Metadata::Column::Integer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 'mediumint' => 'Rose::DB::Object::Metadata::Column::Integer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 'bigint' => 'Rose::DB::Object::Metadata::Column::BigInt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 'serial' => 'Rose::DB::Object::Metadata::Column::Serial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 'bigserial' => 'Rose::DB::Object::Metadata::Column::BigSerial', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 'enum' => 'Rose::DB::Object::Metadata::Column::Enum', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 'num' => 'Rose::DB::Object::Metadata::Column::Numeric', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | #'number' => 'Rose::DB::Object::Metadata::Column::Numeric', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 'numeric' => 'Rose::DB::Object::Metadata::Column::Numeric', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 'decimal' => 'Rose::DB::Object::Metadata::Column::Numeric', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 'float' => 'Rose::DB::Object::Metadata::Column::Float', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 'float8' => 'Rose::DB::Object::Metadata::Column::DoublePrecision', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 'double precision' => 'Rose::DB::Object::Metadata::Column::DoublePrecision', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 'time' => 'Rose::DB::Object::Metadata::Column::Time', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 'interval' => 'Rose::DB::Object::Metadata::Column::Interval', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 'date' => 'Rose::DB::Object::Metadata::Column::Date', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 'datetime' => 'Rose::DB::Object::Metadata::Column::Datetime', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 'timestamp' => 'Rose::DB::Object::Metadata::Column::Timestamp', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 'timestamp with time zone' => 'Rose::DB::Object::Metadata::Column::TimestampWithTimeZone', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 'timestamp without time zone' => 'Rose::DB::Object::Metadata::Column::Timestamp', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 'datetime year to fraction' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToFraction', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 'datetime year to fraction(1)' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToFraction1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 'datetime year to fraction(2)' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToFraction2', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 'datetime year to fraction(3)' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToFraction3', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 'datetime year to fraction(4)' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToFraction4', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 'datetime year to fraction(5)' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToFraction5', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 'datetime year to second' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToSecond', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 'datetime year to minute' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToMinute', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 'datetime year to month' => 'Rose::DB::Object::Metadata::Column::DatetimeYearToMonth', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 'epoch' => 'Rose::DB::Object::Metadata::Column::Epoch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 'epoch hires' => 'Rose::DB::Object::Metadata::Column::Epoch::HiRes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 'array' => 'Rose::DB::Object::Metadata::Column::Array', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 'set' => 'Rose::DB::Object::Metadata::Column::Set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 'chkpass' => 'Rose::DB::Object::Metadata::Column::Pg::Chkpass', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 61 | __PACKAGE__->relationship_type_classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 'one to one' => 'Rose::DB::Object::Metadata::Relationship::OneToOne', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 'one to many' => 'Rose::DB::Object::Metadata::Relationship::OneToMany', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 'many to one' => 'Rose::DB::Object::Metadata::Relationship::ManyToOne', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 'many to many' => 'Rose::DB::Object::Metadata::Relationship::ManyToMany', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | sub init_column_name_to_method_name_mapper() { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 61 | our %Objects; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 99 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 99 | my($this_class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 99 | ▶ | my $class = $args{'class'} or Carp::croak "Missing required 'class' parameter"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 99 | ▶ | return $Objects{$class} ||= shift->SUPER::new(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$Rose::DB::Object::Metadata::Objects{$class} ||= (shift())->SUPER::new(@_)
MC/DC0%0/2
$Rose::DB::Object::Metadata::Objects{$class} ||= (shift())->SUPER::new(@_)
$Rose::DB::Object::Metadata::Objects{$class}
(shift())->SUPER::new(@_)
Truth table33%1/3
A ||= B
A= $Rose::DB::Object::Metadata::Objects{$class}B= (shift())->SUPER::new(@_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | sub init | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 99 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 99 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # This attribute will be accessed many times, and a default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # of 0 is usually a "faster false" than undef. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 99 | $self->sql_qualify_column_names_on_load(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 99 | $self->SUPER::init(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 82 | ▶ | sub init_original_class { ref shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_original_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 75 | ▶ | sub init_auto_prime_caches { $ENV{'MOD_PERL'} ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_auto_prime_caches: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | sub default_manager_base_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 78 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_manager_base_class: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 78 | my($self_or_class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 78 | ▶ | if(ref($self_or_class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 12 | ▶ | return $self_or_class->_object_default_manager_base_class(@_) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self_or_class->_object_default_manager_base_class(@_) || ref($self_or_class)->_class_default_manager_base_class
MC/DC0%0/2
$self_or_class->_object_default_manager_base_class(@_) || ref($self_or_class)->_class_default_manager_base_class
$self_or_class->_object_default_manager_base_class(@_)
ref($self_or_class)->_class_default_manager_base_class
Truth table66%2/3
A || B
A= $self_or_class->_object_default_manager_base_class(@_)B= ref($self_or_class)->_class_default_manager_base_class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ref($self_or_class)->_class_default_manager_base_class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 66 | return $self_or_class->_class_default_manager_base_class(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | sub reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $self->is_initialized(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $self->allow_auto_initialization(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $self->was_auto_initialized(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $self->initialized_foreign_keys(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | sub clone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # The easy way: use Scalar::Util::Clone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | if(defined $Scalar::Util::Clone::VERSION) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | return Scalar::Util::Clone::clone($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | # The hard way: Clone.pm plus mucking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $meta = Clone::clone($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # Reset all the parent back-links | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | foreach my $item (grep { defined } $meta->columns, $meta->primary_key, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | $meta->unique_keys, $meta->foreign_keys, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | $meta->relationships) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $item->parent($meta); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | return $meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | sub allow_inheritance_from_meta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allow_inheritance_from_meta: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my($class, $meta) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | return $meta->num_columns > 0 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | sub for_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 99 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_class: called CC=5 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 99 | my($meta_class, $class) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 99 | ▶ | return $Objects{$class} if($Objects{$class}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # Clone an ancestor meta object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 98 | foreach my $parent_class (__get_parents($class)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 198 | ▶ | if(my $parent_meta = $Objects{$parent_class}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | next unless($meta_class->allow_inheritance_from_meta($parent_meta)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $meta = $parent_meta->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $meta->reset(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $meta->class($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | return $Objects{$class} = $meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 98 | return $Objects{$class} = $meta_class->new(class => $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | sub __get_parents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 198 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__get_parents: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 198 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 198 | my @parents; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 61 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 198 | foreach my $sub_class (@{"${class}::ISA"}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 198 | ▶ | push(@parents, __get_parents($sub_class)) if($sub_class->isa('Rose::DB::Object')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 198 | return $class, @parents; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | sub clear_all_dbs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_all_dbs: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | foreach my $obj_class ($class->registered_classes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $obj_class->meta->db(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | sub error_mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error_mode: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | return $_[0]->{'error_mode'} ||= $_[0]->init_error_mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0]{"error_mode"} ||= $_[0]->init_error_mode
MC/DC0%0/2
$_[0]{"error_mode"} ||= $_[0]->init_error_mode
$_[0]{"error_mode"}
$_[0]->init_error_mode
Truth table0%0/3
A ||= B
A= $_[0]{"error_mode"}B= $_[0]->init_error_mode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | unless(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my($self, $mode) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | unless($mode =~ /^(?:return|carp|croak|cluck|confess|fatal)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | Carp::croak "Invalid error mode: '$mode'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | return $self->{'error_mode'} = $mode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub init_error_mode { 'fatal' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_error_mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | sub handle_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handle_error: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | my($self, $object) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $mode = $self->error_mode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | return if($mode eq 'return'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $level = $Carp::CarpLevel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | local $Carp::CarpLevel = $level + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | if($mode eq 'croak' || $mode eq 'fatal') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
$mode eq "croak" or $mode eq "fatal"
MC/DC0%0/2
$mode eq "croak" or $mode eq "fatal"
$mode eq "croak"
$mode eq "fatal"
Truth table0%0/3
A or B
A= $mode eq "croak"B= $mode eq "fatal"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | Carp::croak $object->error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | elsif($mode eq 'carp') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | Carp::carp $object->error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | elsif($mode eq 'cluck') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | Carp::cluck $object->error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | elsif($mode eq 'confess') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | Carp::confess $object->error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | Carp::croak "(Invalid error mode set: '$mode') - ", $object->error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | sub setup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup: called CC=20 SCAR=45.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 5 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 5 | ▶ | return 1 if($self->is_initialized); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 5 | my $init_args = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 5 | my $auto_init = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 5 | ▶ | PAIR: while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 9 | my $method = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 9 | ▶ | if(ref $method eq 'CODE') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $method->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | next PAIR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 9 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 9 | ▶ | if($method =~ /^((?:auto_(?!helper)|(?:default_)?perl_)\w*)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | $self->init_auto_helper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 9 | ▶ | if($method eq 'initialize') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | $init_args = ref $args ? $args : [ $args ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | next PAIR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | ▶ | elsif($method eq 'auto_initialize' || $method eq 'auto') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$method eq "auto_initialize" or $method eq "auto"
MC/DC0%0/2
$method eq "auto_initialize" or $method eq "auto"
$method eq "auto_initialize"
$method eq "auto"
Truth table33%1/3
A or B
A= $method eq "auto_initialize"B= $method eq "auto"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | unless($method eq 'auto' && !ref $args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$method eq "auto" and not ref $args
MC/DC0%0/2
$method eq "auto" and not ref $args
$method eq "auto"
not ref $args
Truth table0%0/3
A and not(B)
A= $method eq "auto"B= not ref $args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | $init_args = ref $args ? $args : [ $args ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | $auto_init = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | next PAIR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | elsif($method eq 'helpers') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | require Rose::DB::Object::Helpers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | Rose::DB::Object::Helpers->import( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | '--target-class' => $self->class, (ref $args eq 'ARRAY' ? @$args : $args)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | next PAIR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 9 | ▶ | unless($self->can($method)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | Carp::croak "Invalid parameter name: '$method'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 9 | ▶ | if(ref $args eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # Special case for the unique_key and add_unique_key methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # when the argument is a single array reference containing only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # non-reference values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 9 | ▶ | if(($method eq 'unique_key' || $method eq 'add_unique_key') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$method eq "unique_key" || $method eq "add_unique_key" and not grep({ref $_;} @$args)
$method eq "unique_key" or $method eq "add_unique_key"
MC/DC0%0/3
$method eq "unique_key" || $method eq "add_unique_key" and not grep({ref $_;} @$args)
$method eq "unique_key"
$method eq "add_unique_key"
not grep({ref $_;} @$args)
Truth table20%1/5
A or B and not(C)
A= $method eq "unique_key"B= $method eq "add_unique_key"C= not grep({ref $_;} @$args)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | !grep { ref } @$args) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $self->$method($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 9 | $self->$method(@$args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $self->$method($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 5 | ▶ | if($auto_init) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $self->auto_initialize(@$init_args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 5 | $self->initialize(@$init_args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | sub init_db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 235 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_db: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 235 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 235 | ▶ | my $class = $self->class or die "Missing class!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 235 | ▶ | my $db = $self->class->init_db or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | Carp::croak "Could not init_db() for class $class - are you sure that ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | "Rose::DB's data sources are set up?"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 235 | $self->{'db_id'} = $db->{'id'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 235 | return $db; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | sub init_db_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 157 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_db_id: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 157 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 157 | $self->init_db; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 157 | return $self->{'db_id'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 93 | ▶ | sub init_convention_manager { shift->convention_manager_class('default')->new } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_convention_manager: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | sub convention_manager | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 432 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
convention_manager: called CC=8 SCAR=21.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 432 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 432 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 3 | my $mgr = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # Setting to undef means use the null convention manager | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 3 | ▶ | if(!defined $mgr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | return $self->{'convention_manager'} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | Rose::DB::Object::ConventionManager::Null->new(parent => $self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | elsif(!ref $mgr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 3 | ▶ | if(UNIVERSAL::isa($mgr, 'Rose::DB::Object::ConventionManager')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 1 | $mgr = $mgr->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 2 | ▶ | my $class = $self->convention_manager_class($mgr) or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | Carp::croak "No convention manager class registered under the name '$mgr'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 1 | $mgr = $class->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | elsif(!UNIVERSAL::isa($mgr, 'Rose::DB::Object::ConventionManager')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | Carp::croak "$mgr is not a Rose::DB::Object::ConventionManager-derived object"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 2 | $mgr->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 2 | return $self->{'convention_manager'} = $mgr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 429 | ▶ | if(defined $self->{'convention_manager'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 336 | return $self->{'convention_manager'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 93 | my $mgr = $self->init_convention_manager; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 93 | $mgr->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 93 | return $self->{'convention_manager'} = $mgr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 112 | ▶ | sub cached_objects_expire_in { shift->class->cached_objects_expire_in(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cached_objects_expire_in: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | sub clear_object_cache { shift->class->clear_object_cache(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_object_cache: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | sub prepare_select_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_select_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | @_ > 1 ? $_[0]->{'prepare_select_options'} = $_[1] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | $_[0]->{'prepare_select_options'} ||= {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
@_ > 1 ? $_[0]{"prepare_select_options"} = $_[1] : $_[0]{"prepare_select_options"} ||= {}
MC/DC0%0/1
@_ > 1 ? $_[0]{"prepare_select_options"} = $_[1] : $_[0]{"prepare_select_options"} ||= {}
@_ > 1 ? $_[0]{"prepare_select_options"} = $_[1] : $_[0]{"prepare_select_options"}
Truth table0%0/2
A
A= @_ > 1 ? $_[0]{"prepare_select_options"} = $_[1] : $_[0]{"prepare_select_options"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | sub prepare_insert_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_insert_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | @_ > 1 ? $_[0]->{'prepare_insert_options'} = $_[1] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | ▶ | $_[0]->{'prepare_insert_options'} ||= {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
@_ > 1 ? $_[0]{"prepare_insert_options"} = $_[1] : $_[0]{"prepare_insert_options"} ||= {}
MC/DC0%0/1
@_ > 1 ? $_[0]{"prepare_insert_options"} = $_[1] : $_[0]{"prepare_insert_options"} ||= {}
@_ > 1 ? $_[0]{"prepare_insert_options"} = $_[1] : $_[0]{"prepare_insert_options"}
Truth table0%0/2
A
A= @_ > 1 ? $_[0]{"prepare_insert_options"} = $_[1] : $_[0]{"prepare_insert_options"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | sub prepare_update_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_update_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | @_ > 1 ? $_[0]->{'prepare_update_options'} = $_[1] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | $_[0]->{'prepare_update_options'} ||= {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
@_ > 1 ? $_[0]{"prepare_update_options"} = $_[1] : $_[0]{"prepare_update_options"} ||= {}
MC/DC0%0/1
@_ > 1 ? $_[0]{"prepare_update_options"} = $_[1] : $_[0]{"prepare_update_options"} ||= {}
@_ > 1 ? $_[0]{"prepare_update_options"} = $_[1] : $_[0]{"prepare_update_options"}
Truth table0%0/2
A
A= @_ > 1 ? $_[0]{"prepare_update_options"} = $_[1] : $_[0]{"prepare_update_options"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | sub prepare_delete_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_delete_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | @_ > 1 ? $_[0]->{'prepare_delete_options'} = $_[1] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | $_[0]->{'prepare_delete_options'} ||= {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
@_ > 1 ? $_[0]{"prepare_delete_options"} = $_[1] : $_[0]{"prepare_delete_options"} ||= {}
MC/DC0%0/1
@_ > 1 ? $_[0]{"prepare_delete_options"} = $_[1] : $_[0]{"prepare_delete_options"} ||= {}
@_ > 1 ? $_[0]{"prepare_delete_options"} = $_[1] : $_[0]{"prepare_delete_options"}
Truth table0%0/2
A
A= @_ > 1 ? $_[0]{"prepare_delete_options"} = $_[1] : $_[0]{"prepare_delete_options"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | sub prepare_bulk_delete_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_bulk_delete_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | @_ > 1 ? $_[0]->{'prepare_bulk_delete_options'} = $_[1] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | $_[0]->{'prepare_bulk_delete_options'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ > 1 ? $_[0]{"prepare_bulk_delete_options"} = $_[1] : $_[0]{"prepare_bulk_delete_options"} ||= $_[0]->prepare_delete_options
MC/DC0%0/2
@_ > 1 ? $_[0]{"prepare_bulk_delete_options"} = $_[1] : $_[0]{"prepare_bulk_delete_options"} ||= $_[0]->prepare_delete_options
@_ > 1 ? $_[0]{"prepare_bulk_delete_options"} = $_[1] : $_[0]{"prepare_bulk_delete_options"}
$_[0]->prepare_delete_options
Truth table0%0/3
A ||= B
A= @_ > 1 ? $_[0]{"prepare_bulk_delete_options"} = $_[1] : $_[0]{"prepare_bulk_delete_options"}B= $_[0]->prepare_delete_options
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | $_[0]->prepare_delete_options; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | sub prepare_bulk_update_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_bulk_update_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | @_ > 1 ? $_[0]->{'prepare_bulk_update_options'} = $_[1] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | $_[0]->{'prepare_bulk_update_options'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ > 1 ? $_[0]{"prepare_bulk_update_options"} = $_[1] : $_[0]{"prepare_bulk_update_options"} ||= $_[0]->prepare_update_options
MC/DC0%0/2
@_ > 1 ? $_[0]{"prepare_bulk_update_options"} = $_[1] : $_[0]{"prepare_bulk_update_options"} ||= $_[0]->prepare_update_options
@_ > 1 ? $_[0]{"prepare_bulk_update_options"} = $_[1] : $_[0]{"prepare_bulk_update_options"}
$_[0]->prepare_update_options
Truth table0%0/3
A ||= B
A= @_ > 1 ? $_[0]{"prepare_bulk_update_options"} = $_[1] : $_[0]{"prepare_bulk_update_options"}B= $_[0]->prepare_update_options
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | $_[0]->prepare_update_options; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | sub prepare_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_options: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | my($self, $options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | Carp::croak "Missing required hash ref argument to prepare_options()" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | unless(ref $options eq 'HASH'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | $self->prepare_select_options({ %$options }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $self->prepare_insert_options({ %$options }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $self->prepare_update_options({ %$options }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | $self->prepare_delete_options({ %$options }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | sub table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 176 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
table: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 176 | ▶ | unless(@_ > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 171 | ▶ | return $_[0]->{'table'} ||= $_[0]->convention_manager->auto_table_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_[0]{"table"} ||= $_[0]->convention_manager->auto_table_name
MC/DC0%0/2
$_[0]{"table"} ||= $_[0]->convention_manager->auto_table_name
$_[0]{"table"}
$_[0]->convention_manager->auto_table_name
Truth table66%2/3
A ||= B
A= $_[0]{"table"}B= $_[0]->convention_manager->auto_table_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 5 | $_[0]->_clear_table_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 5 | return $_[0]->{'table'} = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | sub catalog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
catalog: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | return $_[0]->{'catalog'} unless(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $_[0]->_clear_table_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | return $_[0]->{'catalog'} = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | sub select_catalog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_catalog: called CC=5 SCAR=25.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 77 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 77 | ▶ | return undef if($db && !$db->supports_catalog); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$db and not $db->supports_catalog
MC/DC0%0/2
$db and not $db->supports_catalog
$db
not $db->supports_catalog
Truth table33%1/3
A and not(B)
A= $dbB= not $db->supports_catalog
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | return $self->{'catalog'} || ($db ? $db->catalog : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{'catalog'} || ($db ? $db->catalog : undef)
MC/DC0%0/2
$self->{'catalog'} || ($db ? $db->catalog : undef)
$self->{'catalog'}
($db ? $db->catalog : undef)
Truth table0%0/3
A || B
A= $self->{'catalog'}B= ($db ? $db->catalog : undef)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | sub schema | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
schema: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | ▶ | return $_[0]->{'schema'} unless(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | $_[0]->_clear_table_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | return $_[0]->{'schema'} = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | sub select_schema | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_schema: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 77 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 77 | ▶ | return undef if($db && !$db->supports_schema); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$db and not $db->supports_schema
MC/DC50%1/2
$db and not $db->supports_schema
$db
not $db->supports_schema
Truth table66%2/3
A and not(B)
A= $dbB= not $db->supports_schema
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 72 | ▶ | return $self->{'schema'} || ($db ? $db->schema : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{'schema'} || ($db ? $db->schema : undef)
MC/DC50%1/2
$self->{'schema'} || ($db ? $db->schema : undef)
$self->{'schema'}
($db ? $db->schema : undef)
Truth table66%2/3
A || B
A= $self->{'schema'}B= ($db ? $db->schema : undef)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | sub sql_qualify_column_names_on_load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 99 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sql_qualify_column_names_on_load: called CC=5 SCAR=19.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 99 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 99 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 99 | ▶ | my $value = $_[0] ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 61 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 99 | ▶ | if($value != $self->{'sql_qualify_column_names_on_load'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $self->{'sql_qualify_column_names_on_load'} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | $self->_clear_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | ▶ | $self->prime_caches if($self->is_initialized); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 99 | return $self->{'sql_qualify_column_names_on_load'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | sub key_column_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key_column_names: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | ▶ | $self->{'key_column_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"key_column_names"} ||= [$self->primary_key_columns, $self->unique_keys_column_names]
MC/DC0%0/1
$self->{"key_column_names"} ||= [$self->primary_key_columns, $self->unique_keys_column_names]
$self->{"key_column_names"}
Truth table0%0/2
A
A= $self->{"key_column_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | [ $self->primary_key_columns, $self->unique_keys_column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | ▶ | return wantarray ? @{$self->{'key_column_names'}} : $self->{'key_column_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | sub init_primary_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 81 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_primary_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 81 | Rose::DB::Object::Metadata::PrimaryKey->new(parent => shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | sub primary_key_generator { shift->primary_key->generator(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_generator: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 76 | ▶ | sub primary_key_columns { shift->primary_key->columns(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_columns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 645 | ▶ | sub primary_key_column_names { shift->primary_key->column_names(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_column_names: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | sub pk_columns { shift->primary_key_columns(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pk_columns: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | sub primary_key_column_names_or_aliases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_column_names_or_aliases: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | if($self->{'primary_key_column_names_or_aliases'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | return $self->{'primary_key_column_names_or_aliases'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | return $self->{'primary_key_column_names_or_aliases'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | [ map { $_->alias || $_->name } $self->primary_key_columns ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_->alias || $_->name
MC/DC0%0/2
$_->alias || $_->name
$_->alias
$_->name
Truth table0%0/3
A || B
A= $_->aliasB= $_->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | sub init_primary_key_column_info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 84 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_primary_key_column_info: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 84 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 84 | my $pk_position = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 84 | foreach my $col_name ($self->primary_key_column_names) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 88 | $pk_position++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 88 | ▶ | my $column = $self->column($col_name) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 82 | $column->is_primary_key_member(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 82 | $column->primary_key_position($pk_position); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 84 | $self->_clear_primary_key_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | # Init these by asking for them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 84 | $self->primary_key_column_accessor_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 84 | $self->primary_key_column_mutator_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 84 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | sub add_primary_key_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_primary_key_columns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 3 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 3 | $self->primary_key->add_columns(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 3 | $self->init_primary_key_column_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 3 | ▶ | sub add_primary_key_column { shift->add_primary_key_columns(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_primary_key_column: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | sub add_unique_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_unique_keys: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | if(@_ == 1 && ref $_[0] eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ == 1 and ref $_[0] eq "ARRAY"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1
ref $_[0] eq "ARRAY"
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | push @{$self->{'unique_keys'}}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | Rose::DB::Object::Metadata::UniqueKey->new(parent => $self, columns => $_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | push @{$self->{'unique_keys'}}, map | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | ▶ | UNIVERSAL::isa($_, 'Rose::DB::Object::Metadata::UniqueKey') ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | ($_->parent($self), $_) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | ref $_ eq 'HASH' ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | Rose::DB::Object::Metadata::UniqueKey->new(parent => $self, %$_) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | Rose::DB::Object::Metadata::UniqueKey->new(parent => $self, columns => $_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | sub unique_key_by_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unique_key_by_name: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | foreach my $uk ($self->unique_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | return $uk if($uk->name eq $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | sub add_unique_key { shift->add_unique_keys(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_unique_key: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | ▶ | sub unique_key { \shift->add_unique_keys(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unique_key: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | sub delete_unique_keys { $_[0]->{'unique_keys'} = [] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_unique_keys: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | sub unique_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 229 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unique_keys: called CC=5 SCAR=17.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 229 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 229 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | $self->delete_unique_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | $self->add_unique_keys(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 229 | ▶ | wantarray ? @{$self->{'unique_keys'} ||= []} : ($self->{'unique_keys'} ||= []); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$self->{"unique_keys"} ||= []
$self->{"unique_keys"} ||= []
MC/DC100%1/1
$self->{"unique_keys"} ||= []
$self->{"unique_keys"}
MC/DC0%0/1
$self->{"unique_keys"} ||= []
$self->{"unique_keys"}
Truth table100%2/2
A
A= $self->{"unique_keys"}
Truth table50%1/2
A
A= $self->{"unique_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | sub unique_keys_column_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 120 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unique_keys_column_names: called CC=4 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | ▶ | wantarray ? map { scalar $_->column_names } @{shift->{'unique_keys'} ||= []} : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
+(shift())->{"unique_keys"} ||= []
MC/DC0%0/1
+(shift())->{"unique_keys"} ||= []
+(shift())->{"unique_keys"}
Truth table50%1/2
A
A= +(shift())->{"unique_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | [ map { scalar $_->column_names } @{shift->{'unique_keys'} ||= []} ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
+(shift())->{"unique_keys"} ||= []
MC/DC0%0/1
+(shift())->{"unique_keys"} ||= []
+(shift())->{"unique_keys"}
Truth table0%0/2
A
A= +(shift())->{"unique_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | sub delete_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_column: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | delete $self->{'columns'}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | # Remove from ordered list too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | my $columns = $self->columns_ordered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | for(my $i = 0; $i < @$columns; $i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | if($columns->[$i]->name eq $name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | splice(@$columns, $i, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | sub delete_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 82 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_columns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 82 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 82 | $self->{'columns'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 82 | $self->{'columns_ordered'} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 82 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | sub delete_nonpersistent_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_nonpersistent_columns: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | $self->{'nonpersistent_columns'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | $self->{'nonpersistent_columns_ordered'} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | sub delete_nonpersistent_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_nonpersistent_column: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | delete $self->{'nonpersistent_columns'}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | # Remove from ordered list too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | my $columns = $self->nonpersistent_columns_ordered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | ▶ | for(my $i = 0; $i < @$columns; $i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | ▶ | if($columns->[$i]->name eq $name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | splice(@$columns, $i, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 1 | ▶ | sub first_column { shift->columns_ordered->[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first_column: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | sub sync_keys_to_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sync_keys_to_columns: called CC=6 SCAR=21.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 77 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 77 | $self->_clear_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 77 | my %columns = map { $_->name => 1 } $self->columns_ordered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 77 | foreach my $col_name ($self->primary_key_column_names) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 79 | ▶ | unless($columns{$col_name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | Carp::croak "Primary key column '$col_name' is not in the column list for ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | $self->class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | #$self->primary_key(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | #last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 77 | my @valid_uks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 77 | UK: foreach my $uk ($self->unique_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | foreach my $col_name ($uk->column_names) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | ▶ | unless($columns{$col_name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | Carp::croak "Column '$col_name' found in unique key is not in the column list for ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | $self->class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | #next UK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | push(@valid_uks, $uk); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 77 | $self->unique_keys(@valid_uks); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 77 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | sub replace_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_column: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | ▶ | unless(@_ == 2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | Carp::croak "Missing column name and value arguments" if(@_ < 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | ▶ | Carp::croak "Too many arguments passed to replace_column()" if(@_ < 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | return $self->column(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | sub column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 3076 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column: called CC=3 SCAR=11.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 3076 | my($self, $name) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 3076 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | $self->delete_column($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | $self->add_column($name => @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 3076 | ▶ | return $self->{'columns'}{$name} if($self->{'columns'}{$name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 81 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | sub nonpersistent_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_column: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | my($self, $name) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | $self->delete_nonpersistent_column($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | $self->add_nonpersistent_column($name => @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | ▶ | return $self->{'nonpersistent_columns'}{$name} if($self->{'nonpersistent_columns'}{$name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | sub columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 94 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
columns: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 94 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 94 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 82 | $self->delete_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 82 | $self->add_columns(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 94 | return $self->columns_ordered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | sub nonpersistent_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_columns: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | $self->delete_nonpersistent_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | $self->add_nonpersistent_columns(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | return $self->nonpersistent_columns_ordered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | sub num_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
num_columns: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | ▶ | return $self->{'num_columns'} ||= scalar(@{$self->columns_ordered}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"num_columns"} ||= scalar @{$self->columns_ordered;}
MC/DC0%0/1
$self->{"num_columns"} ||= scalar @{$self->columns_ordered;}
$self->{"num_columns"}
Truth table0%0/2
A
A= $self->{"num_columns"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | sub nonlazy_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonlazy_columns: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | return wantarray ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | (grep { !$_->lazy } $self->columns_ordered) : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | ▶ | [ grep { !$_->lazy } $self->columns_ordered ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | sub lazy_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lazy_columns: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | return wantarray ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | (grep { $_->lazy } $self->columns_ordered) : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | ▶ | [ grep { $_->lazy } $self->columns_ordered ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | # XXX: Super-lame code sharing via dynamically-scoped flag var | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 61 | our $Nonpersistent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | sub add_nonpersistent_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_nonpersistent_columns: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | local $Nonpersistent = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | shift->_add_columns(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | ▶ | sub add_nonpersistent_column { shift->add_nonpersistent_columns(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_nonpersistent_column: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | sub add_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 85 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_columns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 85 | local $Nonpersistent = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 85 | shift->_add_columns(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 1 | ▶ | sub add_column { shift->add_columns(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_column: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | sub _add_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 85 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_columns: called CC=42 SCAR=51.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 85 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 85 | my $class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 85 | my(@columns, @nonpersistent_columns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 85 | ▶ | ARG: while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 219 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 219 | ▶ | if(UNIVERSAL::isa($name, 'Rose::DB::Object::Metadata::Column')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 1 | my $column = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 1 | ▶ | Carp::croak "Relationship $column lacks a name()" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | unless($column->name =~ /\S/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 1 | $column->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 1 | ▶ | $column->nonpersistent(1) if($Nonpersistent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 1 | ▶ | if($column->nonpersistent) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | $self->{'nonpersistent_columns'}{$column->name} = $column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | push(@nonpersistent_columns, $column); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 1 | $self->{'columns'}{$column->name} = $column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 1 | push(@columns, $column); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 218 | ▶ | unless(ref $_[0]) # bare column name, persistent only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 166 | ▶ | my $column_class = $self->original_class->column_type_class('scalar') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | or Carp::croak "No column class set for column type 'scalar'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | #$Debug && warn $self->class, " - adding scalar column $name\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 166 | $self->{'columns'}{$name} = $column_class->new(name => $name, parent => $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 166 | push(@columns, $self->{'columns'}{$name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 166 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 52 | ▶ | if(UNIVERSAL::isa($_[0], 'Rose::DB::Object::Metadata::Column')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | my $column = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | $column->name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | $column->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | ▶ | $column->nonpersistent(1) if($Nonpersistent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | ▶ | if($column->nonpersistent) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | $self->{'nonpersistent_columns'}{$column->name} = $column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | push(@nonpersistent_columns, $column); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 0 | $self->{'columns'}{$column->name} = $column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | push(@columns, $column); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | elsif(ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 52 | my $info = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 52 | my $alias = $info->{'alias'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 52 | ▶ | if($info->{'primary_key'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | #$Debug && warn $self->class, " - adding primary key column $name\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 3 | $self->add_primary_key_column($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 52 | my $methods = delete $info->{'methods'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 52 | my $add_methods = delete $info->{'add_methods'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 52 | ▶ | if($methods && $add_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods and $add_methods
MC/DC0%0/2
$methods and $add_methods
$methods
$add_methods
Truth table33%1/3
A and B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | Carp::croak "Cannot specify both 'methods' and 'add_methods' - ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | "pick one or the other"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 52 | ▶ | my $type = $info->{'type'} ||= 'scalar'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$info->{"type"} ||= "scalar"
MC/DC100%1/1
$info->{"type"} ||= "scalar"
$info->{"type"}
Truth table100%2/2
A
A= $info->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 52 | ▶ | my $column_class = $self->original_class->column_type_class($type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | or Carp::croak "No column class set for column type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 52 | ▶ | unless($self->column_class_is_loaded($column_class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 24 | $self->load_column_class($column_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 52 | my %triggers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 52 | foreach my $event ($column_class->trigger_events) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 364 | ▶ | $triggers{$event} = delete $info->{$event} if(exists $info->{$event}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 52 | ▶ | if(delete $info->{'temp'}) # coerce temp to nonpersistent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | $info->{'nonpersistent'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | #$Debug && warn $self->class, " - adding $name $column_class\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | # XXX: Order of args is important here! Parent must be set first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | # because some params rely on it being present when they're set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 52 | my $column = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | $column_class->new(parent => $self, %$info, name => $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 52 | ▶ | $column->nonpersistent(1) if($Nonpersistent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 52 | ▶ | if($column->nonpersistent) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | $self->{'nonpersistent_columns'}{$column->name} = $column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 0 | push(@nonpersistent_columns, $column); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 52 | $self->{'columns'}{$column->name} = $column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 52 | push(@columns, $column); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | # Set or add auto-created method names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 52 | ▶ | if($methods || $add_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods or $add_methods
MC/DC0%0/2
$methods or $add_methods
$methods
$add_methods
Truth table33%1/3
A or B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | ▶ | my $auto_method_name = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | $methods ? 'auto_method_types' : 'add_auto_method_types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | ▶ | my $methods_arg = $methods || $add_methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$methods || $add_methods
MC/DC0%0/2
$methods || $add_methods
$methods
$add_methods
Truth table0%0/3
A || B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | ▶ | if(ref $methods_arg eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 0 | $methods = [ keys %$methods_arg ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | ▶ | while(my($type, $name) = each(%$methods_arg)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | ▶ | next unless(defined $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | $column->method_name($type => $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | $methods = $methods_arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 0 | $column->$auto_method_name($methods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 52 | ▶ | if(defined $alias) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 0 | $column->alias($alias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | $self->alias_column($name, $alias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 52 | ▶ | if(%triggers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 2 | ▶ | while(my($event, $value) = each(%triggers)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 3 | ▶ | Carp::croak "Missing code reference for $event trigger" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | unless($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 3 | ▶ | foreach my $code (ref $value eq 'ARRAY' ? @$value : $value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 4 | $column->add_trigger(event => $event, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | code => $code); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | Carp::croak "Invalid column name or specification: $_[0]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | # Handle as-yet undocumented smart modification defaults. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | # Smart modification is only relevant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 85 | foreach my $column (@columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 219 | ▶ | if($column->can('smart_modification') && !defined $column->{'smart_modification'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$column->can("smart_modification") and not defined $column->{"smart_modification"}
MC/DC0%0/2
$column->can("smart_modification") and not defined $column->{"smart_modification"}
$column->can("smart_modification")
not defined $column->{"smart_modification"}
Truth table33%1/3
A and not(B)
A= $column->can("smart_modification")B= not defined $column->{"smart_modification"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 219 | $column->smart_modification($self->default_smart_modification); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 85 | ▶ | if(@columns) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 85 | push(@{$self->{'columns_ordered'}}, @columns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 85 | $self->_clear_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 85 | ▶ | if(@nonpersistent_columns) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | push(@{$self->{'nonpersistent_columns_ordered'}}, @nonpersistent_columns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 0 | $self->_clear_nonpersistent_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 85 | ▶ | return wantarray ? (@columns, @nonpersistent_columns) : [ @columns, @nonpersistent_columns ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | sub relationship | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 57 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
relationship: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 57 | my($self, $name) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 57 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 1 | $self->delete_relationship($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 1 | $self->add_relationship($name => $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 57 | ▶ | return $self->{'relationships'}{$name} if($self->{'relationships'}{$name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 32 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | sub delete_relationship | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_relationship: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 1 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 1 | delete $self->{'relationships'}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | sub relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 201 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
relationships: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 201 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 201 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 26 | $self->delete_relationships; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 26 | $self->add_relationships(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | return wantarray ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 102 | ▶ | (sort { $a->name cmp $b->name } values %{$self->{'relationships'} ||= {}}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"relationships"} ||= {}
MC/DC100%1/1
$self->{"relationships"} ||= {}
$self->{"relationships"}
Truth table100%2/2
A
A= $self->{"relationships"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 0 | ▶ | [ sort { $a->name cmp $b->name } values %{$self->{'relationships'} ||= {}} ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->{"relationships"} ||= {}
MC/DC0%0/1
$self->{"relationships"} ||= {}
$self->{"relationships"}
Truth table50%1/2
A
A= $self->{"relationships"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | sub delete_relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 26 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_relationships: called CC=4 SCAR=16.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 26 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | # Delete everything except fk proxy relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 26 | ▶ | foreach my $name (keys %{$self->{'relationships'} || {}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'relationships'} || {}
MC/DC0%0/1
$self->{'relationships'} || {}
$self->{'relationships'}
Truth table50%1/2
A
A= $self->{'relationships'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | delete $self->{'relationships'}{$name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | ▶ | unless($self->{'relationships'}{$name}->foreign_key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 26 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | sub add_relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 74 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_relationships: called CC=19 SCAR=39.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 74 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 74 | my $class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 74 | ▶ | ARG: while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 74 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | # Relationship object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 74 | ▶ | if(UNIVERSAL::isa($name, 'Rose::DB::Object::Metadata::Relationship')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 32 | my $relationship = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 32 | ▶ | Carp::croak "Relationship $relationship lacks a name()" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | unless($relationship->name =~ /\S/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 32 | ▶ | if(defined $self->{'relationships'}{$relationship->name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 0 | Carp::croak $self->class, " already has a relationship named '", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | $relationship->name, "'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 32 | $relationship->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 32 | $self->{'relationships'}{$relationship->name} = $relationship; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 32 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | # Name and type only: recurse with hashref arg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 42 | ▶ | if(!ref $_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 15 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 15 | $self->add_relationships($name => { type => $type }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 15 | next ARG; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 27 | ▶ | if(UNIVERSAL::isa($_[0], 'Rose::DB::Object::Metadata::Relationship')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 1 | my $relationship = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 1 | $relationship->name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 1 | $relationship->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 1 | $self->{'relationships'}{$name} = $relationship; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | elsif(ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 26 | my $info = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 26 | ▶ | if(defined $self->{'relationships'}{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 0 | Carp::croak $self->class, " already has a relationship named '$name'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 26 | my $methods = delete $info->{'methods'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 26 | my $add_methods = delete $info->{'add_methods'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 26 | ▶ | if($methods && $add_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods and $add_methods
MC/DC0%0/2
$methods and $add_methods
$methods
$add_methods
Truth table33%1/3
A and B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | 0 | Carp::croak "Cannot specify both 'methods' and 'add_methods' - ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | "pick one or the other"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 26 | ▶ | my $type = $info->{'type'} or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | Carp::croak "Missing type parameter for relationship '$name'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 26 | my $relationship = $self->{'relationships'}{$name} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | $self->_build_relationship(name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | type => $type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | info => $info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | # Set or add auto-created method names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 26 | ▶ | if($methods || $add_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods or $add_methods
MC/DC0%0/2
$methods or $add_methods
$methods
$add_methods
Truth table33%1/3
A or B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 0 | ▶ | my $auto_method_name = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | $methods ? 'auto_method_types' : 'add_auto_method_types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | 0 | ▶ | my $methods_arg = $methods || $add_methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$methods || $add_methods
MC/DC0%0/2
$methods || $add_methods
$methods
$add_methods
Truth table0%0/3
A || B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 0 | ▶ | if(ref $methods_arg eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | $methods = [ keys %$methods_arg ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 0 | ▶ | while(my($type, $name) = each(%$methods_arg)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 0 | ▶ | next unless(defined $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 0 | $relationship->method_name($type => $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | 0 | $methods = $methods_arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 0 | $relationship->$auto_method_name($methods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | Carp::croak "Invalid relationship name or specification: $_[0]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | sub _build_relationship | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 26 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_relationship: called CC=9 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | 26 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 26 | my $class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 26 | ▶ | my $name = $args{'name'} or Carp::croak "Missing name parameter"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | 26 | ▶ | my $info = $args{'info'} or Carp::croak "Missing info parameter"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 26 | ▶ | my $type = $args{'type'} or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | Carp::croak "Missing type parameter for relationship '$name'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 26 | ▶ | my $relationship_class = $class->relationship_type_class($type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | or Carp::croak "No relationship class set for relationship type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 26 | ▶ | unless($self->relationship_class_is_loaded($relationship_class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 5 | $self->load_relationship_class($relationship_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 26 | ▶ | $Debug && warn $self->class, " - adding $name $relationship_class\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 26 | ▶ | my $relationship = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->convention_manager->auto_relationship($name, $relationship_class, $info) || $relationship_class->new(%$info, 'name', $name)
MC/DC0%0/2
$self->convention_manager->auto_relationship($name, $relationship_class, $info) || $relationship_class->new(%$info, 'name', $name)
$self->convention_manager->auto_relationship($name, $relationship_class, $info)
$relationship_class->new(%$info, 'name', $name)
Truth table33%1/3
A || B
A= $self->convention_manager->auto_relationship($name, $relationship_class, $info)B= $relationship_class->new(%$info, 'name', $name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | $self->convention_manager->auto_relationship($name, $relationship_class, $info) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | $relationship_class->new(%$info, name => $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 26 | ▶ | unless($relationship) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 0 | Carp::croak "$class - Incomplete relationship specification could not be ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | "completed by convention manager: $name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 26 | $relationship->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 26 | return $relationship; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 33 | ▶ | sub add_relationship { shift->add_relationships(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_relationship: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 61 | my %Class_Loaded; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | sub load_column_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 24 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_column_class: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 24 | my($self, $column_class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 24 | ▶ | unless(UNIVERSAL::isa($column_class, 'Rose::DB::Object::Metadata::Column')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 21 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | 21 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 21 | eval "require $column_class"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 21 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | 21 | ▶ | Carp::croak "Could not load column class '$column_class' - $error" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | if($error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 24 | $Class_Loaded{$column_class}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 52 | ▶ | sub column_class_is_loaded { $Class_Loaded{$_[1]} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_class_is_loaded: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | sub column_type_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 218 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_type_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 218 | my($class, $type) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 218 | return $class->_column_type_class(lc $type, @_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | sub delete_column_type_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_column_type_class: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 0 | my($class, $type) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 0 | return $class->_delete_column_type_class(lc $type, @_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | sub load_relationship_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_relationship_class: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 5 | my($self, $relationship_class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 5 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 5 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 5 | eval "require $relationship_class"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | 5 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | 5 | ▶ | Carp::croak "Could not load relationship class '$relationship_class' - $error" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | if($error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 5 | $Class_Loaded{$relationship_class}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 26 | ▶ | sub relationship_class_is_loaded { $Class_Loaded{$_[1]} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
relationship_class_is_loaded: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | sub add_foreign_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 44 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_foreign_keys: called CC=22 SCAR=42.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 44 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 44 | ▶ | ARG: while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 58 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | # Foreign key object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 58 | ▶ | if(UNIVERSAL::isa($name, 'Rose::DB::Object::Metadata::ForeignKey')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 26 | my $fk = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 26 | ▶ | Carp::croak "Foreign key $fk lacks a name()" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | unless($fk->name =~ /\S/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 26 | ▶ | if(defined $self->{'foreign_keys'}{$fk->name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 0 | Carp::croak $self->class, " already has a foreign key named '", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | $fk->name, "'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 26 | $fk->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 26 | $self->{'foreign_keys'}{$fk->name} = $fk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | 26 | ▶ | unless(defined $self->relationship($fk->name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 26 | $self->add_relationship( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | $self->relationship_type_class($fk->relationship_type)->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | parent => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | name => $fk->name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | class => $fk->class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | foreign_key => $fk)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 26 | next ARG; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | # Name only: try to get all the other info by convention | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 32 | ▶ | if(!ref $_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 26 | ▶ | if(my $fk = $self->convention_manager->auto_foreign_key($name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 26 | $self->add_foreign_keys($fk); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 26 | next ARG; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 0 | Carp::croak $self->class, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | " - Incomplete foreign key specification could not be ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | "completed by convention manager: $name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | # Name and hashref spec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 6 | ▶ | if(ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 6 | my $info = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | 6 | ▶ | if(defined $self->{'foreign_keys'}{$name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 0 | Carp::croak $self->class, " already has a foreign key named '$name'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 6 | my $methods = delete $info->{'methods'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 6 | my $add_methods = delete $info->{'add_methods'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 6 | ▶ | if($methods && $add_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods and $add_methods
MC/DC0%0/2
$methods and $add_methods
$methods
$add_methods
Truth table33%1/3
A and B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 0 | Carp::croak "Cannot specify both 'methods' and 'add_methods' - ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | "pick one or the other"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 6 | ▶ | $Debug && warn $self->class, " - adding $name foreign key\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 6 | ▶ | my $fk = $self->{'foreign_keys'}{$name} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->convention_manager->auto_foreign_key($name, $info) || 'Rose::DB::Object::Metadata::ForeignKey'->new(%$info, 'name', $name)
MC/DC0%0/2
$self->convention_manager->auto_foreign_key($name, $info) || 'Rose::DB::Object::Metadata::ForeignKey'->new(%$info, 'name', $name)
$self->convention_manager->auto_foreign_key($name, $info)
'Rose::DB::Object::Metadata::ForeignKey'->new(%$info, 'name', $name)
Truth table33%1/3
A || B
A= $self->convention_manager->auto_foreign_key($name, $info)B= 'Rose::DB::Object::Metadata::ForeignKey'->new(%$info, 'name', $name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | $self->convention_manager->auto_foreign_key($name, $info) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | Rose::DB::Object::Metadata::ForeignKey->new(%$info, name => $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 6 | $fk->parent($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | # Set or add auto-created method names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 6 | ▶ | if($methods || $add_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$methods or $add_methods
MC/DC0%0/2
$methods or $add_methods
$methods
$add_methods
Truth table33%1/3
A or B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | ▶ | my $auto_method_name = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | $methods ? 'auto_method_types' : 'add_auto_method_types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | ▶ | my $methods_arg = $methods || $add_methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$methods || $add_methods
MC/DC0%0/2
$methods || $add_methods
$methods
$add_methods
Truth table0%0/3
A || B
A= $methodsB= $add_methods
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 0 | ▶ | if(ref $methods_arg eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 0 | $methods = [ keys %$methods_arg ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | ▶ | while(my($type, $name) = each(%$methods_arg)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 0 | ▶ | next unless(defined $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 0 | $fk->method_name($type => $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 0 | $methods = $methods_arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 0 | $fk->$auto_method_name($methods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 6 | ▶ | unless(defined $self->relationship($name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 6 | $self->add_relationship( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | $self->relationship_type_class($fk->relationship_type)->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | class => $fk->class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | foreign_key => $fk)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 0 | Carp::croak "Invalid foreign key specification: $_[0]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 0 | ▶ | sub add_foreign_key { shift->add_foreign_keys(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_foreign_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | sub foreign_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
foreign_key: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | 4 | my($self, $name) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 4 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 0 | $self->delete_foreign_key($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 0 | $self->add_foreign_key($name => @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 4 | ▶ | return $self->{'foreign_keys'}{$name} if($self->{'foreign_keys'}{$name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | sub delete_foreign_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_foreign_key: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 0 | delete $self->{'foreign_keys'}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | sub delete_foreign_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 18 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_foreign_keys: called CC=4 SCAR=15.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 18 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | # Delete fk proxy relationship | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 18 | foreach my $fk (values %{$self->{'foreign_keys'}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 0 | foreach my $rel ($self->relationships) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 61 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 0 | ▶ | if($rel->foreign_key eq $fk) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 0 | $self->delete_relationship($rel->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | # Delete fks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | 18 | $self->{'foreign_keys'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 18 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | sub foreign_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 295 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
foreign_keys: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | 295 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 295 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | 18 | $self->delete_foreign_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 18 | $self->add_foreign_keys(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | return wantarray ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 130 | ▶ | (sort { $a->name cmp $b->name } values %{$self->{'foreign_keys'} ||= {}}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"foreign_keys"} ||= {}
MC/DC100%1/1
$self->{"foreign_keys"} ||= {}
$self->{"foreign_keys"}
Truth table100%2/2
A
A= $self->{"foreign_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 295 | ▶ | [ sort { $a->name cmp $b->name } values %{$self->{'foreign_keys'} ||= {}} ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->{"foreign_keys"} ||= {}
MC/DC0%0/1
$self->{"foreign_keys"} ||= {}
$self->{"foreign_keys"}
Truth table50%1/2
A
A= $self->{"foreign_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | sub initialize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=20 SCAR=36.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 77 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | 77 | my(%args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | 77 | ▶ | $Debug && warn $self->class, " - initialize\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 77 | ▶ | if(my $code = $self->pre_init_hook) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 0 | ▶ | foreach my $sub (ref $code eq 'ARRAY' ? @$code : $code) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 0 | $sub->($self, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 77 | ▶ | my $class = $self->class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | or Carp::croak "Missing class for metadata object $self"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | 77 | $self->sync_keys_to_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 77 | my $table = $self->table; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 77 | ▶ | Carp::croak "$class - Missing table name" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $table and $table =~ /\S/
MC/DC0%0/2
defined $table and $table =~ /\S/
defined $table
$table =~ /\S/
Truth table33%1/3
A and B
A= defined $tableB= $table =~ /\S/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | unless(defined $table && $table =~ /\S/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | 77 | my @pk = $self->primary_key_column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 77 | ▶ | Carp::croak "$class - Missing primary key for table '$table'" unless(@pk); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 77 | $self->init_primary_key_column_info; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 77 | my @column_names = $self->column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 77 | ▶ | Carp::croak "$class - No columns defined for for table '$table'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | unless(@column_names); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 77 | foreach my $name ($self->primary_key_column_names) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 79 | ▶ | my $column = $self->column($name) or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | Carp::croak "Could not find column for primary key column name '$name'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 79 | ▶ | if($column->is_lazy) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | 0 | Carp::croak "Column '$name' cannot be lazy: cannot load primary key ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | "columns on demand"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | 77 | $self->make_methods(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | 76 | $self->register_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 76 | ▶ | unless($args{'passive'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | # Retry deferred stuff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | 76 | $self->retry_deferred_tasks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 76 | $self->retry_deferred_foreign_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 76 | $self->retry_deferred_relationships; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | 75 | $self->refresh_lazy_column_tracking; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | 75 | ▶ | unless($args{'stay_connected'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | 75 | $self->db(undef); # make sure to ditch any db we may have retained | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 75 | $self->is_initialized(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | 75 | ▶ | $Debug && warn $self->class, " - initialized\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 75 | ▶ | if(my $code = $self->post_init_hook) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 0 | ▶ | foreach my $sub (ref $code eq 'ARRAY' ? @$code : $code) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | 0 | $sub->($self, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | # Regardless of cache priming, call this to ensure it's initialized, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | # since it is very likely to be used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | 75 | $self->key_column_accessor_method_names_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 75 | ▶ | $self->prime_caches if($self->auto_prime_caches); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 75 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | 61 | ▶ | use constant NULL_CATALOG => "\0"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 61 | ▶ | use constant NULL_SCHEMA => "\0"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | sub register_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_class: called CC=10 SCAR=23.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 76 | ▶ | my $class = $self->class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | or Carp::croak "Missing class for metadata object $self"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 76 | my $db = $self->db; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | 76 | my $catalog = $self->select_catalog($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | 76 | ▶ | my $schema = $db ? ($db->registration_schema || $self->select_schema($db)) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$db->registration_schema or $self->select_schema($db)
MC/DC50%1/2
$db->registration_schema or $self->select_schema($db)
$db->registration_schema
$self->select_schema($db)
Truth table66%2/3
A or B
A= $db->registration_schemaB= $self->select_schema($db)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | $self->select_schema($db);; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | 76 | ▶ | $catalog = NULL_CATALOG unless(defined $catalog); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | 76 | ▶ | $schema = NULL_SCHEMA unless(defined $schema); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | 76 | ▶ | my $default_schema = $db ? $db->default_implicit_schema : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | 76 | ▶ | my $table = $self->table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | or Carp::croak "Missing table for metadata object $self"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | 76 | ▶ | $table = lc $table if($db->likes_lowercase_table_names); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 76 | my $reg = $self->registry_key->class_registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | # Combine keys using $;, which is "\034" (0x1C) by default. But just to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | # make sure, I'll localize it. What I'm looking for is a value that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | # won't show up in a catalog, schema, or table name, so I'm guarding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | # against someone changing it to "-" (or whatever) elsewhere in the code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 76 | local $; = "\034"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | # Register with all available information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | # Ug, have to store lowercase versions too because MySQL sometimes returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | # lowercase names for tables that are actually mixed case. Grrr... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | $reg->{'catalog-schema-table',$catalog,$schema,$table} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | $reg->{'table',$table} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | $reg->{'lc-catalog-schema-table',$catalog,$schema,lc $table} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | 76 | $reg->{'lc-table',lc $table} = $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 76 | ▶ | $reg->{'catalog-schema-table',$catalog,$default_schema,$table} = $class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | if(defined $default_schema); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | 76 | push(@{$reg->{'classes'}}, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 76 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | 230 | ▶ | sub registry_key { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registry_key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | sub registered_classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | 152 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registered_classes: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | 152 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | 152 | my $reg = $self->registry_key->class_registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | 152 | ▶ | return wantarray ? @{$reg->{'classes'} ||= []} : $reg->{'classes'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$reg->{"classes"} ||= []
MC/DC100%1/1
$reg->{"classes"} ||= []
$reg->{"classes"}
Truth table100%2/2
A
A= $reg->{"classes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | sub unregister_all_classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unregister_all_classes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | 0 | $self->registry_key->class_registry({}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | sub class_for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
class_for: called CC=20 SCAR=36.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 2 | my($self_or_class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 2 | ▶ | my $self = ref($self_or_class) ? $self_or_class : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | 2 | ▶ | my $class = ref($self) || $self_or_class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $self || $self_or_class
MC/DC0%0/2
ref $self || $self_or_class
ref $self
$self_or_class
Truth table66%2/3
A || B
A= ref $selfB= $self_or_class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | 2 | ▶ | my $db = $self ? $self->db : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | 2 | my $catalog = $args{'catalog'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | 2 | my $schema = $args{'schema'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | 2 | ▶ | $catalog = NULL_CATALOG unless(defined $catalog); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | 2 | ▶ | $schema = NULL_SCHEMA unless(defined $schema); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | 2 | ▶ | my $default_schema = $db ? $db->default_implicit_schema : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | 2 | ▶ | $default_schema = NULL_SCHEMA unless(defined $default_schema); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 2 | ▶ | my $table = $args{'table'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | or Carp::croak "Missing required table parameter"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | 2 | ▶ | $table = lc $table if($db && $db->likes_lowercase_table_names); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$db and $db->likes_lowercase_table_names
MC/DC50%1/2
$db and $db->likes_lowercase_table_names
$db
$db->likes_lowercase_table_names
Truth table66%2/3
A and B
A= $dbB= $db->likes_lowercase_table_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 2 | my $reg = $class->registry_key->class_registry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | # Combine keys using $;, which is "\034" (0x1C) by default. But just to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | # make sure, we'll localize it. What we're looking for is a value that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | # wont' show up in a catalog, schema, or table name, so I'm guarding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | # against someone changing it to "-" elsewhere in the code or whatever. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 2 | local $; = "\034"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | my $f_class = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | $reg->{'catalog-schema-table',$catalog,$schema,$table} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | $reg->{'catalog-schema-table',$catalog,$default_schema,$table} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | 2 | ▶ | ($schema eq NULL_SCHEMA && $default_schema eq NULL_SCHEMA ? $reg->{'lc-table',$table} : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
$$reg{join $;, 'catalog-schema-table', $catalog, $schema, $table} || $$reg{join $;, 'catalog-schema-table', $catalog, $default_schema, $table} || ($schema eq "\000" && $default_schema eq "\000" ? $$reg{join $;, 'lc-table', $table} : undef)
$$reg{join $;, "catalog-schema-table", $catalog, $schema, $table} or $$reg{join $;, "catalog-schema-table", $catalog, $default_schema, $table}
$schema eq "\0" and $default_schema eq "\0"
MC/DC0%0/4
$$reg{join $;, 'catalog-schema-table', $catalog, $schema, $table} || $$reg{join $;, 'catalog-schema-table', $catalog, $default_schema, $table} || ($schema eq "\000" && $default_schema eq "\000" ? $$reg{join $;, 'lc-table', $table} : undef)
$$reg{join $;, "catalog-schema-table", $catalog, $schema, $table}
$$reg{join $;, "catalog-schema-table", $catalog, $default_schema, $table}
$schema eq "\0"
$default_schema eq "\0"
Truth table40%2/5
A or B || C and D
A= $$reg{join $;, "catalog-schema-table", $catalog, $schema, $table}B= $$reg{join $;, "catalog-schema-table", $catalog, $default_schema, $table}C= $schema eq "\0"D= $default_schema eq "\0"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | # Ug, have to check lowercase versions too because MySQL sometimes returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | # lowercase names for tables that are actually mixed case. Grrr... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | 2 | ▶ | unless($f_class) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | 0 | $table = lc $table; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | $reg->{'lc-catalog-schema-table',$catalog,$schema,$table} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | $reg->{'lc-catalog-schema-table',$catalog,$default_schema,$table} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | 0 | ▶ | ($schema eq NULL_SCHEMA && $default_schema eq NULL_SCHEMA ? $reg->{'lc-table',$table} : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$$reg{join $;, 'lc-catalog-schema-table', $catalog, $schema, $table} || $$reg{join $;, 'lc-catalog-schema-table', $catalog, $default_schema, $table} || ($schema eq "\000" && $default_schema eq "\000" ? $$reg{join $;, 'lc-table', $table} : undef)
$$reg{join $;, "lc-catalog-schema-table", $catalog, $schema, $table} or $$reg{join $;, "lc-catalog-schema-table", $catalog, $default_schema, $table}
$schema eq "\0" and $default_schema eq "\0"
MC/DC0%0/4
$$reg{join $;, 'lc-catalog-schema-table', $catalog, $schema, $table} || $$reg{join $;, 'lc-catalog-schema-table', $catalog, $default_schema, $table} || ($schema eq "\000" && $default_schema eq "\000" ? $$reg{join $;, 'lc-table', $table} : undef)
$$reg{join $;, "lc-catalog-schema-table", $catalog, $schema, $table}
$$reg{join $;, "lc-catalog-schema-table", $catalog, $default_schema, $table}
$schema eq "\0"
$default_schema eq "\0"
Truth table0%0/5
A or B || C and D
A= $$reg{join $;, "lc-catalog-schema-table", $catalog, $schema, $table}B= $$reg{join $;, "lc-catalog-schema-table", $catalog, $default_schema, $table}C= $schema eq "\0"D= $default_schema eq "\0"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | 2 | return $f_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | #sub made_method_for_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | # (@_ > 2) ? ($_[0]->{'made_methods'}{$_[1]} = $_[2]) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | # $_[0]->{'made_methods'}{$_[1]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | sub make_column_methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_column_methods: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | 77 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | 77 | my(%args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | 77 | my $class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 77 | $args{'target_class'} = $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 77 | my $aliases = $self->column_aliases; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | 77 | ▶ | while(my($column_name, $alias) = each(%$aliases)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 1 | $self->column($column_name)->alias($alias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | 77 | foreach my $column ($self->columns_ordered) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | 194 | ▶ | unless($column->validate_specification) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 0 | Carp::croak "Column specification for column '", $column->name, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | "' in class ", $self->class, " is invalid: ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | $column->error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 194 | my $name = $column->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 194 | my $method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | 194 | foreach my $type ($column->auto_method_types) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | 194 | ▶ | $method = $self->method_name_from_column_name($name, $type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | or Carp::croak "No method name defined for column '$name' ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | "method type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | 194 | ▶ | if(my $reason = $self->method_name_is_reserved($method, $class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 1 | Carp::croak "Cannot create method '$method' - $reason ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | "Use alias_column() to map it to another name." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | 193 | $column->method_name($type => $method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | #$Debug && warn $self->class, " - make methods for column $name\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | 193 | $column->make_methods(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | # XXX: Re-enabling the ability to alias primary keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | #if($column->is_primary_key_member && $column->alias && $column->alias ne $column->name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | # Carp::croak "Primary key columns cannot be aliased (the culprit: '$name')"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | #if($method ne $name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | # # Primary key columns can be aliased, but we make a column-named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | # # method anyway. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | # foreach my $column ($self->primary_key_column_names) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | # if($name eq $column) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | # if(my $reason = $self->method_name_is_reserved($name, $class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | # Carp::croak | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | # "Cannot create method for primary key column '$name' ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | # "- $reason Although primary keys may be aliased, doing ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | # "so will not avoid conflicts with reserved method names ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | # "because a method named after the primary key column ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | # "itself must also be created."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | # no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | # *{"${class}::$name"} = \&{"${class}::$method"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | 76 | $self->_clear_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | # Initialize method name hashes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | 76 | $self->column_accessor_method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | 76 | $self->column_mutator_method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | 76 | $self->column_rw_method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | # This rule is relaxed for now... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | # Must have an rw accessor for every column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | #my $columns = $self->columns_ordered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | #unless(keys %methods == @$columns) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | # Carp::croak "Rose::DB::Object-derived objects are required to have ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | # "a 'get_set' method for every column. This class (", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | # $self->class, ") has ", scalar @$columns, "column", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | # (@$columns == 1 ? '' : 's'), " and ", scalar keys %methods, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | # " method", (scalar keys %methods == 1 ? '' : 's'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | 76 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | sub make_nonpersistent_column_methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_nonpersistent_column_methods: called CC=6 SCAR=28.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | 76 | my(%args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | 76 | my $class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | 76 | $args{'target_class'} = $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | 76 | foreach my $column ($self->nonpersistent_columns_ordered) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | 0 | ▶ | unless($column->validate_specification) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | 0 | Carp::croak "Column specification for column '", $column->name, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | "' in class ", $self->class, " is invalid: ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | $column->error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | 0 | my $name = $column->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | 0 | my $method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | 0 | foreach my $type ($column->auto_method_types) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | 0 | ▶ | $method = $self->method_name_from_column_name($name, $type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | or Carp::croak "No method name defined for column '$name' ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | "method type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | 0 | ▶ | if(my $reason = $self->method_name_is_reserved($method, $class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | 0 | Carp::croak "Cannot create method '$method' - $reason ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | "Use alias_column() to map it to another name." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | 0 | $column->method_name($type => $method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | #$Debug && warn $self->class, " - make methods for column $name\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | 0 | $column->make_methods(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | 76 | $self->_clear_nonpersistent_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | # Initialize method name hashes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 76 | $self->nonpersistent_column_accessor_method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | 76 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | sub make_foreign_key_methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_foreign_key_methods: called CC=20 SCAR=40.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | 76 | my(%args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | #$self->retry_deferred_foreign_keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | 76 | my $class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | 76 | my $meta_class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | 76 | $args{'target_class'} = $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | 76 | foreach my $foreign_key ($self->foreign_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | #next unless($foreign_key->is_ready_to_make_methods); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | 32 | foreach my $type ($foreign_key->auto_method_types) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | 64 | ▶ | my $method = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$foreign_key->method_name($type) || $foreign_key->build_method_name_for_type($type) || Carp::croak(q[No method name defined for foreign key '], $foreign_key->name, "' method type '${type}'")
$foreign_key->method_name($type) or $foreign_key->build_method_name_for_type($type)
MC/DC0%0/2
$foreign_key->method_name($type) || $foreign_key->build_method_name_for_type($type) || Carp::croak(q[No method name defined for foreign key '], $foreign_key->name, "' method type '${type}'")
$foreign_key->method_name($type)
$foreign_key->build_method_name_for_type($type)
Truth table33%1/3
A or B
A= $foreign_key->method_name($type)B= $foreign_key->build_method_name_for_type($type)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | $foreign_key->method_name($type) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | $foreign_key->build_method_name_for_type($type) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | Carp::croak "No method name defined for foreign key '", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | $foreign_key->name, "' method type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 64 | ▶ | if(my $reason = $self->method_name_is_reserved($method, $class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | 0 | Carp::croak "Cannot create method '$method' - $reason ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | "Choose a different foreign key name." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | 64 | $foreign_key->method_name($type => $method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | 32 | ▶ | if($self->auto_load_related_classes && (my $fclass = $foreign_key->class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->auto_load_related_classes and my $fclass = $foreign_key->class
MC/DC0%0/2
$self->auto_load_related_classes and my $fclass = $foreign_key->class
$self->auto_load_related_classes
my $fclass = $foreign_key->class
Truth table33%1/3
A and B
A= $self->auto_load_related_classesB= my $fclass = $foreign_key->class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | 32 | ▶ | unless($fclass->isa('Rose::DB::Object')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | 0 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | 0 | eval "require $fclass"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | 0 | ▶ | $Debug && print STDERR "FK REQUIRES $fclass - $error\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | 0 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | # XXX: Need to distinguish recoverable errors from unrecoverable errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | 0 | ▶ | if($error !~ /\.pm in \@INC/ && !UNIVERSAL::isa($error, 'Rose::DB::Object::Exception::ClassNotReady')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$error =~ /\.pm in \@INC/ or UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
MC/DC0%0/2
$error =~ /\.pm in \@INC/ or UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
$error =~ /\.pm in \@INC/
UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
Truth table0%0/3
A or B
A= $error =~ /\.pm in \@INC/B= UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | 0 | Carp::confess "Could not load $fclass - $error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | # We may need to defer the creation of some foreign key methods until | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | # all the required pieces are loaded. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | 32 | ▶ | if($foreign_key->is_ready_to_make_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | 20 | ▶ | if($Debug && !$args{'preserve_existing'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$Rose::DB::Object::Metadata::Debug and not $args{"preserve_existing"}
MC/DC0%0/2
$Rose::DB::Object::Metadata::Debug and not $args{"preserve_existing"}
$Rose::DB::Object::Metadata::Debug
not $args{"preserve_existing"}
Truth table33%1/3
A and not(B)
A= $Rose::DB::Object::Metadata::DebugB= not $args{"preserve_existing"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | 0 | warn $self->class, " - make methods for foreign key ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | $foreign_key->name, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | 20 | $foreign_key->make_methods(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | # Confirm that no info is missing. This prevents an improperly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | # configured foreign_key from being deferred "forever" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | 12 | $foreign_key->sanity_check; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 12 | ▶ | $Debug && warn $self->class, " - defer foreign key ", $foreign_key->name, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | 12 | $foreign_key->deferred_make_method_args(\%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | 12 | $meta_class->add_deferred_foreign_key($foreign_key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | # Keep foreign keys and their corresponding relationships in sync. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | 32 | my $fk_id = $foreign_key->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | 32 | my $fk_rel_type = $foreign_key->relationship_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | 32 | foreach my $relationship ($self->relationships) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | 60 | ▶ | next unless($relationship->type eq $fk_rel_type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | 60 | ▶ | if($fk_id eq $relationship->id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | 32 | $relationship->foreign_key($foreign_key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | 76 | $self->retry_deferred_foreign_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | 76 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | 61 | our @Deferred_Tasks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | sub deferred_tasks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deferred_tasks: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | 0 | ▶ | return wantarray ? @Deferred_Tasks : \@Deferred_Tasks; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | sub add_deferred_tasks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_deferred_tasks: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | 0 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | 0 | ARG: foreach my $arg (@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | 0 | foreach my $task (@Deferred_Tasks) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | next ARG if($arg->{'class'} eq $task->{'class'} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | 0 | ▶ | $arg->{'method'} eq $task->{'method'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg->{"class"} eq $task->{"class"} and $arg->{"method"} eq $task->{"method"}
MC/DC0%0/2
$arg->{"class"} eq $task->{"class"} and $arg->{"method"} eq $task->{"method"}
$arg->{"class"} eq $task->{"class"}
$arg->{"method"} eq $task->{"method"}
Truth table0%0/3
A and B
A= $arg->{"class"} eq $task->{"class"}B= $arg->{"method"} eq $task->{"method"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | 0 | push(@Deferred_Tasks, $arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | 0 | ▶ | sub add_deferred_task { shift->add_deferred_tasks(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_deferred_task: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | sub has_deferred_tasks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_deferred_tasks: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | 0 | my $class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | 0 | my $meta_class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | # Search among the deferred tasks too (icky) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | 0 | foreach my $task ($meta_class->deferred_tasks) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | 0 | ▶ | if($task->{'class'} eq $class) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | sub retry_deferred_tasks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
retry_deferred_tasks: called CC=4 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | 76 | my @tasks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | 76 | foreach my $task (@Deferred_Tasks) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | 0 | my $code = $task->{'code'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | 0 | my $check = $task->{'check'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | 0 | $code->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | 0 | ▶ | unless($check->()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | 0 | push(@tasks, $task); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | 76 | ▶ | if(join(',', sort @Deferred_Tasks) ne join(',', sort @tasks)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | 0 | @Deferred_Tasks = @tasks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | 61 | our @Deferred_Foreign_Keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | sub deferred_foreign_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | 152 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deferred_foreign_keys: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | 152 | ▶ | return wantarray ? @Deferred_Foreign_Keys : \@Deferred_Foreign_Keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | sub has_deferred_foreign_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_deferred_foreign_keys: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | 0 | my $class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | 0 | my $meta_class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | 0 | foreach my $fk ($meta_class->deferred_foreign_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | 0 | ▶ | return 1 if($fk->class eq $class); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | # Search among the deferred tasks too (icky) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | 0 | foreach my $task ($meta_class->deferred_tasks) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | 0 | ▶ | if($task->{'class'} eq $class && $task->{'method'} eq 'auto_init_foreign_keys') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$task->{"class"} eq $class and $task->{"method"} eq "auto_init_foreign_keys"
MC/DC0%0/2
$task->{"class"} eq $class and $task->{"method"} eq "auto_init_foreign_keys"
$task->{"class"} eq $class
$task->{"method"} eq "auto_init_foreign_keys"
Truth table0%0/3
A and B
A= $task->{"class"} eq $classB= $task->{"method"} eq "auto_init_foreign_keys"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | sub has_outstanding_metadata_tasks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2220 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_outstanding_metadata_tasks: called CC=6 SCAR=33.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2221 | 12 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2223 | 12 | ▶ | return $self->{'has_outstanding_metadata_tasks'} = shift if(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2225 | 0 | ▶ | if(defined $self->{'has_outstanding_metadata_tasks'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2226 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2227 | 0 | return $self->{'has_outstanding_metadata_tasks'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2230 | 0 | ▶ | if($self->has_deferred_foreign_keys || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->has_deferred_foreign_keys or $self->has_deferred_relationships or $self->has_deferred_tasks
$self->has_deferred_foreign_keys or $self->has_deferred_relationships
MC/DC0%0/3
$self->has_deferred_foreign_keys or $self->has_deferred_relationships or $self->has_deferred_tasks
$self->has_deferred_foreign_keys
$self->has_deferred_relationships
$self->has_deferred_tasks
Truth table0%0/4
A or B or C
A= $self->has_deferred_foreign_keysB= $self->has_deferred_relationshipsC= $self->has_deferred_tasks
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2231 | $self->has_deferred_relationships || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2232 | $self->has_deferred_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2233 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2234 | 0 | return $self->{'has_outstanding_metadata_tasks'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2237 | 0 | return $self->{'has_outstanding_metadata_tasks'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2240 | sub add_deferred_foreign_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2241 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_deferred_foreign_keys: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2242 | 12 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2244 | 12 | my $check = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2246 | 12 | ARG: foreach my $arg (@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2247 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2248 | 12 | foreach my $fk (@Deferred_Foreign_Keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2249 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2250 | 0 | ▶ | next ARG if($fk->id eq $arg->id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2253 | 12 | $arg->parent->has_outstanding_metadata_tasks(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2254 | 12 | push(@Deferred_Foreign_Keys, $arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2258 | 12 | ▶ | sub add_deferred_foreign_key { shift->add_deferred_foreign_keys(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_deferred_foreign_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2260 | sub retry_deferred_foreign_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2261 | 152 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
retry_deferred_foreign_keys: called CC=10 SCAR=25.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2262 | 152 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2264 | 152 | my $meta_class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2266 | 152 | my @foreign_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2268 | # Check to see if any deferred foreign keys are ready now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2269 | 152 | foreach my $foreign_key ($meta_class->deferred_foreign_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2270 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2271 | # XXX: this is not necessary, so it's commented out for now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2272 | # Try to rebuild the relationship using the convention manager, since | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2273 | # new info may be available now. Otherwise, leave it as-is. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2274 | # $foreign_key = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2275 | # $self->convention_manager->auto_foreign_key( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2276 | # $def_fk->name, scalar $def_fk->spec_hash) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2277 | # $def_fk; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2279 | 36 | ▶ | if($foreign_key->is_ready_to_make_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2280 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2281 | 12 | ▶ | $Debug && warn $foreign_key->parent->class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2282 | " - (Retry) make methods for foreign key ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2283 | $foreign_key->name, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2285 | 12 | ▶ | my $args = $foreign_key->deferred_make_method_args || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$foreign_key->deferred_make_method_args || {}
MC/DC0%0/1
$foreign_key->deferred_make_method_args || {}
$foreign_key->deferred_make_method_args
Truth table50%1/2
A
A= $foreign_key->deferred_make_method_args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2286 | 12 | $foreign_key->make_methods(%$args); #, preserve_existing => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2288 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2289 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2290 | 24 | push(@foreign_keys, $foreign_key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2294 | 152 | ▶ | if(join(',', sort @Deferred_Foreign_Keys) ne join(',', sort @foreign_keys)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2295 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2296 | 12 | @Deferred_Foreign_Keys = @foreign_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2299 | # Retry relationship auto-init for all other classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2300 | 152 | foreach my $class ($self->registered_classes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2301 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2302 | 4926 | my $meta = $class->meta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2303 | 4926 | ▶ | next unless($meta->allow_auto_initialization && $meta->has_outstanding_metadata_tasks); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$meta->allow_auto_initialization and $meta->has_outstanding_metadata_tasks
MC/DC0%0/2
$meta->allow_auto_initialization and $meta->has_outstanding_metadata_tasks
$meta->allow_auto_initialization
$meta->has_outstanding_metadata_tasks
Truth table33%1/3
A and B
A= $meta->allow_auto_initializationB= $meta->has_outstanding_metadata_tasks
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2304 | 0 | ▶ | $meta->auto_init_relationships(%{ $meta->auto_init_args || {} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$meta->auto_init_args || {}
MC/DC0%0/1
$meta->auto_init_args || {}
$meta->auto_init_args
Truth table0%0/2
A
A= $meta->auto_init_args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2305 | restore_types => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2309 | sub make_relationship_methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2310 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_relationship_methods: called CC=35 SCAR=40.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2311 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2312 | 76 | my(%args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2314 | #$self->retry_deferred_relationships; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2316 | 76 | my $meta_class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2317 | 76 | my $class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2319 | 76 | $args{'target_class'} = $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2321 | 76 | my $preserve_existing_arg = $args{'preserve_existing'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2323 | 76 | REL: foreach my $relationship ($self->relationships) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2324 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2325 | 58 | ▶ | next if($args{'name'} && $relationship->name ne $args{'name'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"name"} and $relationship->name ne $args{"name"}
MC/DC0%0/2
$args{"name"} and $relationship->name ne $args{"name"}
$args{"name"}
$relationship->name ne $args{"name"}
Truth table33%1/3
A and B
A= $args{"name"}B= $relationship->name ne $args{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2326 | #next unless($relationship->is_ready_to_make_methods); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2328 | 58 | foreach my $type ($relationship->auto_method_types) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2329 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2330 | 134 | ▶ | my $method = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$relationship->method_name($type) || $relationship->build_method_name_for_type($type) || Carp::croak(q[No method name defined for relationship '], $relationship->name, "' method type '${type}'")
$relationship->method_name($type) or $relationship->build_method_name_for_type($type)
MC/DC0%0/2
$relationship->method_name($type) || $relationship->build_method_name_for_type($type) || Carp::croak(q[No method name defined for relationship '], $relationship->name, "' method type '${type}'")
$relationship->method_name($type)
$relationship->build_method_name_for_type($type)
Truth table66%2/3
A or B
A= $relationship->method_name($type)B= $relationship->build_method_name_for_type($type)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2331 | $relationship->method_name($type) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2332 | $relationship->build_method_name_for_type($type) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2333 | Carp::croak "No method name defined for relationship '", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2334 | $relationship->name, "' method type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2336 | 134 | ▶ | if(my $reason = $self->method_name_is_reserved($method, $class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2337 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2338 | 0 | Carp::croak "Cannot create method '$method' - $reason ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2339 | "Choose a different relationship name." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2342 | 134 | $relationship->method_name($type => $method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2344 | # Initialize/reset preserve_existing flag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2345 | 134 | ▶ | if($self->is_auto_initializating) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2346 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2347 | 0 | ▶ | $args{'preserve_existing'} = $preserve_existing_arg || $self->allow_auto_initialization; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$preserve_existing_arg || $self->allow_auto_initialization
MC/DC0%0/2
$preserve_existing_arg || $self->allow_auto_initialization
$preserve_existing_arg
$self->allow_auto_initialization
Truth table0%0/3
A || B
A= $preserve_existing_argB= $self->allow_auto_initialization
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2350 | 134 | ▶ | delete $args{'replace_existing'} if($args{'preserve_existing'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2352 | # If a corresponding foreign key exists, the preserve any existing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2353 | # methods with the same names. This is a crude way to ensure that we | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2354 | # can have a foreign key and a corresponding relationship without any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2355 | # method name clashes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2356 | 134 | ▶ | if($relationship->can('id')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2357 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2358 | 134 | my $rel_id = $relationship->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2360 | 134 | FK: foreach my $fk ($self->foreign_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2361 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2362 | 92 | ▶ | if($rel_id eq $fk->id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2363 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2364 | 64 | $args{'preserve_existing'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2365 | 64 | delete $args{'replace_existing'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2366 | 64 | last FK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2372 | 58 | ▶ | if($self->auto_load_related_classes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2373 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2374 | 58 | ▶ | if($relationship->can('class')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2375 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2376 | 44 | my $fclass = $relationship->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2378 | 44 | ▶ | unless($fclass->isa('Rose::DB::Object') && $fclass->meta->is_initialized) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$fclass->isa("Rose::DB::Object") and $fclass->meta->is_initialized
MC/DC50%1/2
$fclass->isa("Rose::DB::Object") and $fclass->meta->is_initialized
$fclass->isa("Rose::DB::Object")
$fclass->meta->is_initialized
Truth table66%2/3
A and B
A= $fclass->isa("Rose::DB::Object")B= $fclass->meta->is_initialized
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2379 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2380 | 12 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2382 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2383 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2384 | 12 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2385 | 12 | eval "require $fclass"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2386 | 12 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2389 | 12 | ▶ | $Debug && print STDERR "REL ", $relationship->name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2390 | " REQUIRES $fclass - $error\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2392 | 12 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2393 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2394 | # XXX: Need to distinguish recoverable errors from unrecoverable errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2395 | 12 | ▶ | if($error !~ /\.pm in \@INC/ && !UNIVERSAL::isa($error, 'Rose::DB::Object::Exception::ClassNotReady')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$error =~ /\.pm in \@INC/ or UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
MC/DC0%0/2
$error =~ /\.pm in \@INC/ or UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
$error =~ /\.pm in \@INC/
UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
Truth table33%1/3
A or B
A= $error =~ /\.pm in \@INC/B= UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2396 | #if($error =~ /syntax error at |requires explicit package name|not allowed while "strict|already has a relationship named|Can't modify constant item/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2397 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2398 | 0 | Carp::confess "Could not load $fclass - $error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2404 | 58 | ▶ | if($relationship->can('map_class')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2405 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2406 | 14 | my $map_class = $relationship->map_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2408 | 14 | ▶ | unless($map_class->isa('Rose::DB::Object') && $map_class->meta->is_initialized) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$map_class->isa("Rose::DB::Object") and $map_class->meta->is_initialized
MC/DC50%1/2
$map_class->isa("Rose::DB::Object") and $map_class->meta->is_initialized
$map_class->isa("Rose::DB::Object")
$map_class->meta->is_initialized
Truth table66%2/3
A and B
A= $map_class->isa("Rose::DB::Object")B= $map_class->meta->is_initialized
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2409 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2410 | 2 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2412 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2413 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2414 | 2 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2415 | 2 | eval "require $map_class"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2416 | 2 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2419 | 2 | ▶ | $Debug && print STDERR "REL ", $relationship->name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2420 | " REQUIRES $map_class - $error\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2422 | 2 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2423 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2424 | # XXX: Need to distinguish recoverable errors from unrecoverable errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2425 | 2 | ▶ | if($error !~ /\.pm in \@INC/ && !UNIVERSAL::isa($error, 'Rose::DB::Object::Exception::ClassNotReady')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$error =~ /\.pm in \@INC/ or UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
MC/DC0%0/2
$error =~ /\.pm in \@INC/ or UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
$error =~ /\.pm in \@INC/
UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
Truth table33%1/3
A or B
A= $error =~ /\.pm in \@INC/B= UNIVERSAL::isa($error, "Rose::DB::Object::Exception::ClassNotReady")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2426 | #if($error =~ /syntax error at |requires explicit package name|not allowed while "strict|already has a relationship named|Can't modify constant item/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2427 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2428 | 0 | Carp::confess "Could not load $map_class - $error"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2435 | # We may need to defer the creation of some relationship methods until | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2436 | # all the required pieces are loaded. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2437 | 58 | ▶ | if($relationship->is_ready_to_make_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2438 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2439 | 44 | ▶ | if($Debug && !$args{'preserve_existing'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$Rose::DB::Object::Metadata::Debug and not $args{"preserve_existing"}
MC/DC0%0/2
$Rose::DB::Object::Metadata::Debug and not $args{"preserve_existing"}
$Rose::DB::Object::Metadata::Debug
not $args{"preserve_existing"}
Truth table33%1/3
A and not(B)
A= $Rose::DB::Object::Metadata::DebugB= not $args{"preserve_existing"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2440 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2441 | 0 | warn $self->class, " - make methods for relationship ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2442 | $relationship->name, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2445 | 44 | $relationship->make_methods(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2447 | ▶ | elsif(!$relationship->can('foreign_key') || !$relationship->foreign_key) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$relationship->can('foreign_key') && $relationship->foreign_key
MC/DC50%1/2
$relationship->can('foreign_key') && $relationship->foreign_key
$relationship->can('foreign_key')
$relationship->foreign_key
Truth table66%2/3
A && B
A= $relationship->can('foreign_key')B= $relationship->foreign_key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2448 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2449 | # Confirm that no info is missing. This prevents an improperly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2450 | # configured relationship from being deferred "forever" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2451 | 2 | $relationship->sanity_check; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2453 | 2 | ▶ | $Debug && warn $self->class, " - defer relationship ", $relationship->name, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2455 | 2 | $relationship->deferred_make_method_args(\%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2456 | 2 | $meta_class->add_deferred_relationship($relationship); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2460 | #$self->retry_deferred_relationships; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2462 | 76 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2465 | 61 | our @Deferred_Relationships; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2467 | sub deferred_relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2468 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deferred_relationships: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2469 | 76 | ▶ | return wantarray ? @Deferred_Relationships : \@Deferred_Relationships; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2472 | sub has_deferred_relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2473 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_deferred_relationships: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2474 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2476 | 0 | my $class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2477 | 0 | my $meta_class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2479 | 0 | foreach my $rel ($meta_class->deferred_relationships) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2480 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2481 | 0 | ▶ | if(($rel->can('class') && $rel->class eq $class) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$rel->can("class") and $rel->class eq $class or $rel->can("map_class") and $rel->map_class eq $class
$rel->can("class") and $rel->class eq $class
$rel->can("map_class") and $rel->map_class eq $class
MC/DC0%0/4
$rel->can("class") and $rel->class eq $class or $rel->can("map_class") and $rel->map_class eq $class
$rel->can("class")
$rel->class eq $class
$rel->can("map_class")
$rel->map_class eq $class
Truth table0%0/7
A and B or C and D
A= $rel->can("class")B= $rel->class eq $classC= $rel->can("map_class")D= $rel->map_class eq $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2482 | ($rel->can('map_class') && $rel->map_class eq $class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2483 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2484 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2488 | # Search among the deferred tasks too (icky) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2489 | 0 | foreach my $task ($meta_class->deferred_tasks) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2490 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2491 | 0 | ▶ | if($task->{'class'} eq $class && $task->{'method'} eq 'auto_init_relationships') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$task->{"class"} eq $class and $task->{"method"} eq "auto_init_relationships"
MC/DC0%0/2
$task->{"class"} eq $class and $task->{"method"} eq "auto_init_relationships"
$task->{"class"} eq $class
$task->{"method"} eq "auto_init_relationships"
Truth table0%0/3
A and B
A= $task->{"class"} eq $classB= $task->{"method"} eq "auto_init_relationships"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2492 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2493 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2497 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2498 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2500 | sub add_deferred_relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2501 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_deferred_relationships: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2502 | 2 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2504 | 2 | ARG: foreach my $arg (@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2505 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2506 | 2 | foreach my $rel (@Deferred_Relationships) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2507 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2508 | 1 | ▶ | next ARG if($rel->id eq $arg->id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2511 | 2 | push(@Deferred_Relationships, $arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2515 | 2 | ▶ | sub add_deferred_relationship { shift->add_deferred_relationships(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_deferred_relationship: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2517 | sub retry_deferred_relationships | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2518 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
retry_deferred_relationships: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2519 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2521 | 76 | my $meta_class = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2523 | 76 | my @relationships; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2525 | # Check to see if any deferred relationships are ready now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2526 | 76 | foreach my $relationship ($self->deferred_relationships) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2527 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2528 | # Try to rebuild the relationship using the convention manager, since | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2529 | # new info may be available now. Otherwise, leave it as-is. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2530 | 7 | my $rebuild_rel = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2531 | $self->convention_manager->auto_relationship( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2532 | $relationship->name, ref $relationship, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2533 | scalar $relationship->spec_hash); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2535 | 7 | ▶ | if($rebuild_rel) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2536 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2537 | # XXX: This is pretty evil. I need some sort of copy operator, but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2538 | # XXX: a straight hash copy will do for now... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2539 | 7 | %$relationship = %$rebuild_rel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2542 | 7 | ▶ | if($relationship->is_ready_to_make_methods) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2543 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2544 | 2 | ▶ | $Debug && warn $relationship->parent->class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2545 | " - (Retry) make methods for relationship ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2546 | $relationship->name, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2548 | 2 | ▶ | my $args = $relationship->deferred_make_method_args || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$relationship->deferred_make_method_args || {}
MC/DC0%0/1
$relationship->deferred_make_method_args || {}
$relationship->deferred_make_method_args
Truth table50%1/2
A
A= $relationship->deferred_make_method_args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2549 | 2 | $args->{'preserve_existing'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2550 | 2 | delete $args->{'replace_existing'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2552 | 2 | $relationship->make_methods(%$args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2554 | # Reassign to list in case we rebuild above | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2555 | 1 | $relationship->parent->relationship($relationship->name => $relationship); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2557 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2558 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2559 | 5 | push(@relationships, $relationship); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2563 | 75 | ▶ | if(join(',', sort @Deferred_Relationships) ne join(',', sort @relationships)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2564 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2565 | 1 | @Deferred_Relationships = @relationships; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2568 | # Retry relationship auto-init for all other classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2569 | #foreach my $class ($self->registered_classes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2570 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2571 | # next unless($class->meta->allow_auto_initialization && $meta->has_outstanding_metadata_tasks); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2572 | # $self->auto_init_relationships(restore_types => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2573 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2576 | sub make_methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2577 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_methods: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2578 | 77 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2580 | 77 | $self->make_column_methods(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2581 | 76 | $self->make_nonpersistent_column_methods(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2582 | 76 | $self->make_foreign_key_methods(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2583 | 76 | $self->make_relationship_methods(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2586 | sub generate_primary_key_values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2587 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_primary_key_values: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2588 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2590 | 0 | ▶ | if(my $code = $self->primary_key_generator) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2591 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2592 | 0 | return $code->($self, $db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2595 | 0 | my @ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2597 | 0 | my $seqs = $self->fq_primary_key_sequence_names(db => $db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2599 | 0 | ▶ | if($seqs && @$seqs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$seqs and @$seqs
MC/DC0%0/2
$seqs and @$seqs
$seqs
@$seqs
Truth table0%0/3
A and B
A= $seqsB= @$seqs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2600 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2601 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2603 | 0 | foreach my $seq (@$seqs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2604 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2605 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2607 | 0 | ▶ | unless(defined $seq) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2608 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2609 | 0 | push(@ids, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2610 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2613 | 0 | my $id = $db->next_value_in_sequence($seq); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2615 | 0 | ▶ | unless($id) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2616 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2617 | 0 | $self->error("Could not generate primary key for ", $self->class, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2618 | " column '", ($self->primary_key_column_names)[$i], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2619 | "' by selecting the next value in the sequence ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2620 | "'$seq' - $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2621 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2624 | 0 | push(@ids, $id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2627 | 0 | return @ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2629 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2630 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2631 | 0 | return $db->generate_primary_key_values(scalar @{$self->primary_key_column_names}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2635 | sub generate_primary_key_value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2636 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_primary_key_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2637 | 0 | my @ids = shift->generate_primary_key_values(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2638 | 0 | return $ids[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2641 | sub generate_primary_key_placeholders | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2642 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_primary_key_placeholders: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2643 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2644 | 0 | return $db->generate_primary_key_placeholders(scalar @{$self->primary_key_column_names}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2647 | sub primary_key_column_accessor_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2648 | 84 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_column_accessor_names: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2649 | 84 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2651 | 84 | ▶ | if($self->{'primary_key_column_accessor_names'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2652 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2653 | 0 | return @{$self->{'primary_key_column_accessor_names'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2656 | 84 | my @column_names = $self->primary_key_column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2657 | 84 | my @columns = grep { defined } map { $self->column($_) } @column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2659 | 84 | ▶ | return unless(@column_names == @columns); # not ready yet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2661 | 78 | my @methods = grep { defined } map { $self->column_accessor_method_name($_) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2662 | @column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2664 | 78 | ▶ | return unless(@methods); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2665 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2666 | 1 | $self->{'primary_key_column_accessor_names'} = \@methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2667 | 1 | return @methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2668 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2670 | sub primary_key_column_mutator_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2671 | 84 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_column_mutator_names: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2672 | 84 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2674 | 84 | ▶ | if($self->{'primary_key_column_mutator_names'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2675 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2676 | 0 | return @{$self->{'primary_key_column_mutator_names'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2679 | 84 | my @column_names = $self->primary_key_column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2680 | 84 | my @columns = grep { defined } map { $self->column($_) } @column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2682 | 84 | ▶ | return unless(@column_names == @columns); # not ready yet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2684 | 78 | my @methods = grep { defined } map { $self->column_mutator_method_name($_) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2685 | @column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2687 | 78 | ▶ | return unless(@methods); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2689 | 1 | $self->{'primary_key_column_mutator_names'} = \@methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2690 | 1 | return @methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2693 | sub fq_primary_key_sequence_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2694 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fq_primary_key_sequence_names: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2695 | 0 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2697 | 0 | ▶ | my $db_id = $args{'db'}{'id'} || ($self->{'db_id'} ||= $self->init_db_id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$args{'db'}{'id'} || ($self->{'db_id'} ||= $self->init_db_id)
$self->{"db_id"} ||= $self->init_db_id
MC/DC0%0/2
$args{'db'}{'id'} || ($self->{'db_id'} ||= $self->init_db_id)
$args{'db'}{'id'}
($self->{'db_id'} ||= $self->init_db_id)
MC/DC0%0/2
$self->{"db_id"} ||= $self->init_db_id
$self->{"db_id"}
$self->init_db_id
Truth table0%0/3
A || B
A= $args{'db'}{'id'}B= ($self->{'db_id'} ||= $self->init_db_id)
Truth table0%0/3
A ||= B
A= $self->{"db_id"}B= $self->init_db_id
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2699 | 0 | ▶ | if(defined $self->{'fq_primary_key_sequence_names'}{$db_id}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2700 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2701 | 0 | ▶ | my $seqs = $self->{'fq_primary_key_sequence_names'}{$db_id} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2702 | 0 | ▶ | return wantarray ? @$seqs : $seqs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2705 | 0 | ▶ | my $db = $args{'db'} or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2706 | die "Cannot generate fully-qualified primary key sequence name without db argument"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2708 | 0 | my @seqs = $self->primary_key_sequence_names($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2710 | 0 | ▶ | if(@seqs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2711 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2712 | 0 | $self->primary_key->sequence_names(@seqs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2714 | # Add schema and catalog information only if it isn't present | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2715 | # XXX: crappy check - just looking for a '.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2716 | 0 | foreach my $seq (@seqs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2717 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2718 | 0 | ▶ | if(defined $seq && index($seq, '.') < 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $seq and index($seq, ".") == -1
MC/DC0%0/2
defined $seq and index($seq, ".") == -1
defined $seq
index($seq, ".") == -1
Truth table0%0/3
A and B
A= defined $seqB= index($seq, ".") == -1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2719 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2720 | 0 | $seq = $db->quote_identifier_for_sequence($self->select_catalog($db), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2721 | $self->select_schema($db), $seq); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2725 | 0 | $self->{'fq_primary_key_sequence_names'}{$db->{'id'}} = \@seqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2726 | 0 | ▶ | return wantarray ? @seqs : \@seqs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2727 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2729 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2732 | sub refresh_primary_key_sequence_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2733 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh_primary_key_sequence_names: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2734 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2735 | 0 | ▶ | my $db_id = UNIVERSAL::isa($db, 'Rose::DB') ? $db->id : $db; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2736 | 0 | $self->{'fq_primary_key_sequence_names'}{$db_id} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2737 | 0 | $self->{'primary_key_sequence_names'}{$db_id} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2738 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2739 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2741 | sub primary_key_sequence_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2742 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_sequence_names: not called CC=24 SCAR=64.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2743 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2745 | 0 | my($db, $db_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2747 | 0 | ▶ | $db = shift if(UNIVERSAL::isa($_[0], 'Rose::DB')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2748 | 0 | ▶ | $db_id = $db ? $db->{'id'} : $self->init_db_id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2750 | # Set pk sequence names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2751 | 0 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2752 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2753 | # Clear fully-qualified pk values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2754 | 0 | $self->{'fq_primary_key_sequence_names'}{$db_id} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2756 | 0 | ▶ | my $ret = $self->{'primary_key_sequence_names'}{$db_id} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ == 1 and ref $_[0]
MC/DC0%0/2
@_ == 1 and ref $_[0]
@_ == 1
ref $_[0]
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2757 | (@_ == 1 && ref $_[0]) ? $_[0] : [ @_ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2759 | # Push down into pk metadata object too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2760 | 0 | ▶ | $self->primary_key->sequence_names(($db ? $db : ()), @$ret); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2762 | 0 | ▶ | return wantarray ? @$ret : $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2765 | 0 | ▶ | if($self->{'primary_key_sequence_names'}{$db_id}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2766 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2767 | 0 | my $ret = $self->{'primary_key_sequence_names'}{$db_id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2768 | 0 | ▶ | return wantarray ? @$ret : $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2769 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2771 | # Init pk sequence names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2773 | # Start by considering the list of sequence names stored in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2774 | # primary key metadata object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2775 | 0 | my @pks = $self->primary_key_column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2776 | 0 | my $seqs = $self->primary_key->sequence_names($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2777 | 0 | my @seqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2779 | 0 | ▶ | if($seqs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2780 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2781 | # If each pk column has a defined sequence name, accept them as-is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2782 | 0 | ▶ | if(@pks == grep { defined } @$seqs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2783 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2784 | 0 | $self->{'primary_key_sequence_names'}{$db_id} = $seqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2785 | 0 | ▶ | return wantarray ? @$seqs : $seqs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2786 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2787 | else # otherwise, use them as a starting point | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2788 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2789 | 0 | @seqs = @$seqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2791 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2793 | 0 | ▶ | unless($db) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2794 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2795 | 0 | die "Cannot generate primary key sequence name without db argument"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2796 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2799 | 0 | my $cm = $self->convention_manager; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2800 | 0 | ▶ | my $table = $self->table or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2801 | Carp::croak "Cannot generate primary key sequence name without table name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2802 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2803 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2805 | 0 | foreach my $column ($self->primary_key_columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2806 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2807 | 0 | my $seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2809 | # Go the extra mile and look up the sequence name (if any) for scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2810 | # pk columns. These pk columns were probably set using the columns() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2811 | # shortcut $meta->columns(qw(foo bar baz)) rather than the "long way" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2812 | # with type information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2813 | 0 | ▶ | if($column->type eq 'scalar') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2814 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2815 | 0 | $seq = $self->_sequence_name($db, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2816 | $self->select_catalog($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2817 | $self->select_schema($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2818 | $table, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2819 | $column); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2821 | # Set auto-created serial column sequence names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2822 | ▶ | elsif($column->type =~ /^(?:big)?serial$/ && $db->use_auto_sequence_name) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$column->type =~ /^(?:big)?serial$/ and $db->use_auto_sequence_name
MC/DC0%0/2
$column->type =~ /^(?:big)?serial$/ and $db->use_auto_sequence_name
$column->type =~ /^(?:big)?serial$/
$db->use_auto_sequence_name
Truth table0%0/3
A and B
A= $column->type =~ /^(?:big)?serial$/B= $db->use_auto_sequence_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2823 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2824 | 0 | $seq = $cm->auto_column_sequence_name($table, $column, $db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2827 | 0 | ▶ | unless(exists $seqs[$i] && defined $seqs[$i]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $seqs[$i] and defined $seqs[$i]
MC/DC0%0/2
exists $seqs[$i] and defined $seqs[$i]
exists $seqs[$i]
defined $seqs[$i]
Truth table0%0/3
A and B
A= exists $seqs[$i]B= defined $seqs[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2828 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2829 | 0 | ▶ | $seqs[$i] = $seq if(defined $seq); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2832 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2834 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2835 | # Only save if it looks like the class setup is finished | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2836 | 0 | ▶ | if($self->is_initialized) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2837 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2838 | 0 | $self->{'primary_key_sequence_names'}{$db->{'id'}} = \@seqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2841 | 0 | ▶ | return wantarray ? @seqs : \@seqs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2844 | sub _sequence_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2845 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sequence_name: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2846 | 0 | my($self, $db, $catalog, $schema, $table, $column) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2847 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2848 | # XXX: This is only beneficial in PostgreSQL right now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2849 | 0 | ▶ | return unless($db->driver eq 'pg'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2851 | 0 | ▶ | $table = lc $table if($db->likes_lowercase_table_names); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2853 | 0 | my($col_info, $error); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2855 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2856 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2857 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2858 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2859 | eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2860 | 0 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2861 | 0 | my $dbh = $db->dbh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2863 | 0 | local $dbh->{'RaiseError'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2864 | 0 | local $dbh->{'PrintError'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2866 | 0 | ▶ | my $sth = $dbh->column_info($catalog, $schema, $table, $column) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2867 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2868 | 0 | $sth->execute; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2869 | 0 | $col_info = $sth->fetchrow_hashref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2870 | 0 | $sth->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2871 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2873 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2874 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2876 | 0 | ▶ | return if($error || !$col_info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$error or not $col_info
MC/DC0%0/2
$error or not $col_info
$error
not $col_info
Truth table0%0/3
A or not(B)
A= $errorB= not $col_info
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2878 | 0 | $db->refine_dbi_column_info($col_info, $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2880 | 0 | my $seq = $col_info->{'rdbo_default_value_sequence_name'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2882 | 0 | my $implicit_schema = $db->default_implicit_schema; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2884 | # Strip off default implicit schema unless a schema is explicitly specified | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2885 | 0 | ▶ | if(defined $seq && defined $implicit_schema && !defined $schema) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $seq and defined $implicit_schema and not defined $schema
defined $seq and defined $implicit_schema
MC/DC0%0/3
defined $seq and defined $implicit_schema and not defined $schema
defined $seq
defined $implicit_schema
not defined $schema
Truth table0%0/4
A and B and not(C)
A= defined $seqB= defined $implicit_schemaC= not defined $schema
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2886 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2887 | 0 | $seq =~ s/^$implicit_schema\.//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2888 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2890 | 0 | return $seq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2893 | sub column_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2894 | 537 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_names: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2895 | 537 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2896 | 537 | ▶ | $self->{'column_names'} ||= [ map { $_->name } $self->columns_ordered ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"column_names"} ||= [map({$_->name;} $self->columns_ordered)]
MC/DC100%1/1
$self->{"column_names"} ||= [map({$_->name;} $self->columns_ordered)]
$self->{"column_names"}
Truth table100%2/2
A
A= $self->{"column_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2897 | 537 | ▶ | return wantarray ? @{$self->{'column_names'}} : $self->{'column_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2900 | sub nonpersistent_column_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2901 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_column_names: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2902 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2903 | 0 | ▶ | $self->{'nonpersistent_column_names'} ||= [ map { $_->name } $self->nonpersistent_columns_ordered ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"nonpersistent_column_names"} ||= [map({$_->name;} $self->nonpersistent_columns_ordered)]
MC/DC0%0/1
$self->{"nonpersistent_column_names"} ||= [map({$_->name;} $self->nonpersistent_columns_ordered)]
$self->{"nonpersistent_column_names"}
Truth table50%1/2
A
A= $self->{"nonpersistent_column_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2904 | 76 | ▶ | return wantarray ? @{$self->{'nonpersistent_column_names'}} : $self->{'nonpersistent_column_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2905 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2907 | sub nonlazy_column_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2908 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonlazy_column_names: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2909 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2910 | 0 | ▶ | $self->{'nonlazy_column_names'} ||= [ map { $_->name } $self->nonlazy_columns ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"nonlazy_column_names"} ||= [map({$_->name;} $self->nonlazy_columns)]
MC/DC0%0/1
$self->{"nonlazy_column_names"} ||= [map({$_->name;} $self->nonlazy_columns)]
$self->{"nonlazy_column_names"}
Truth table0%0/2
A
A= $self->{"nonlazy_column_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2911 | 0 | ▶ | return wantarray ? @{$self->{'nonlazy_column_names'}} : $self->{'nonlazy_column_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2912 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2913 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2914 | sub lazy_column_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2915 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lazy_column_names: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2916 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2917 | 0 | ▶ | $self->{'lazy_column_names'} ||= [ map { $_->name } $self->lazy_columns ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"lazy_column_names"} ||= [map({$_->name;} $self->lazy_columns)]
MC/DC0%0/1
$self->{"lazy_column_names"} ||= [map({$_->name;} $self->lazy_columns)]
$self->{"lazy_column_names"}
Truth table0%0/2
A
A= $self->{"lazy_column_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2918 | 0 | ▶ | return wantarray ? @{$self->{'lazy_column_names'}} : $self->{'lazy_column_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2921 | sub nonlazy_column_names_string_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2922 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonlazy_column_names_string_sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2923 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2924 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2925 | return $self->{'nonlazy_column_names_string_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2926 | 0 | ▶ | join(', ', map { $_->name_sql($db) } $self->nonlazy_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"nonlazy_column_names_string_sql"}{$db->{"id"}} ||= join(", ", map({$_->name_sql($db);} $self->nonlazy_columns))
MC/DC0%0/2
$self->{"nonlazy_column_names_string_sql"}{$db->{"id"}} ||= join(", ", map({$_->name_sql($db);} $self->nonlazy_columns))
$self->{"nonlazy_column_names_string_sql"}{$db->{"id"}}
join(", ", map({$_->name_sql($db);} $self->nonlazy_columns))
Truth table0%0/3
A ||= B
A= $self->{"nonlazy_column_names_string_sql"}{$db->{"id"}}B= join(", ", map({$_->name_sql($db);} $self->nonlazy_columns))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2929 | sub column_names_string_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2930 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_names_string_sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2931 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2933 | return $self->{'column_names_string_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2934 | 0 | ▶ | join(', ', map { $_->name_sql($db) } $self->columns_ordered); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"column_names_string_sql"}{$db->{"id"}} ||= join(", ", map({$_->name_sql($db);} $self->columns_ordered))
MC/DC0%0/2
$self->{"column_names_string_sql"}{$db->{"id"}} ||= join(", ", map({$_->name_sql($db);} $self->columns_ordered))
$self->{"column_names_string_sql"}{$db->{"id"}}
join(", ", map({$_->name_sql($db);} $self->columns_ordered))
Truth table0%0/3
A ||= B
A= $self->{"column_names_string_sql"}{$db->{"id"}}B= join(", ", map({$_->name_sql($db);} $self->columns_ordered))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2935 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2937 | sub column_names_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2938 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_names_sql: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2939 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2941 | my $list = $self->{'column_names_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2942 | 0 | ▶ | [ map { $_->name_sql($db) } $self->columns_ordered ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"column_names_sql"}{$db->{"id"}} ||= [map({$_->name_sql($db);} $self->columns_ordered)]
MC/DC0%0/1
$self->{"column_names_sql"}{$db->{"id"}} ||= [map({$_->name_sql($db);} $self->columns_ordered)]
$self->{"column_names_sql"}{$db->{"id"}}
Truth table0%0/2
A
A= $self->{"column_names_sql"}{$db->{"id"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2944 | 0 | ▶ | return wantarray ? @$list : $list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2947 | sub select_nonlazy_columns_string_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2948 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_nonlazy_columns_string_sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2949 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2951 | return $self->{'select_nonlazy_columns_string_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2952 | 0 | ▶ | join(', ', @{ scalar $self->select_nonlazy_columns_sql($db) }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"select_nonlazy_columns_string_sql"}{$db->{"id"}} ||= join(", ", @{scalar $self->select_nonlazy_columns_sql($db);})
MC/DC0%0/2
$self->{"select_nonlazy_columns_string_sql"}{$db->{"id"}} ||= join(", ", @{scalar $self->select_nonlazy_columns_sql($db);})
$self->{"select_nonlazy_columns_string_sql"}{$db->{"id"}}
join(", ", @{scalar $self->select_nonlazy_columns_sql($db);})
Truth table0%0/3
A ||= B
A= $self->{"select_nonlazy_columns_string_sql"}{$db->{"id"}}B= join(", ", @{scalar $self->select_nonlazy_columns_sql($db);})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2954 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2955 | sub select_columns_string_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2956 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_columns_string_sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2957 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2959 | return $self->{'select_columns_string_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2960 | 0 | ▶ | join(', ', @{ scalar $self->select_columns_sql($db) }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"select_columns_string_sql"}{$db->{"id"}} ||= join(", ", @{scalar $self->select_columns_sql($db);})
MC/DC0%0/2
$self->{"select_columns_string_sql"}{$db->{"id"}} ||= join(", ", @{scalar $self->select_columns_sql($db);})
$self->{"select_columns_string_sql"}{$db->{"id"}}
join(", ", @{scalar $self->select_columns_sql($db);})
Truth table0%0/3
A ||= B
A= $self->{"select_columns_string_sql"}{$db->{"id"}}B= join(", ", @{scalar $self->select_columns_sql($db);})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2963 | sub select_columns_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2964 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_columns_sql: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2965 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2967 | 0 | my $list = $self->{'select_columns_sql'}{$db->{'id'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2969 | 0 | ▶ | unless($list) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2970 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2971 | 0 | my $table = $self->table; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2972 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2973 | 0 | ▶ | if($self->sql_qualify_column_names_on_load) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2974 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2975 | 0 | $list = [ map { $_->select_sql($db, $table) } $self->columns_ordered ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2976 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2977 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2978 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2979 | 0 | $list = [ map { $_->select_sql($db) } $self->columns_ordered ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2982 | 0 | $self->{'select_columns_sql'}{$db->{'id'}} = $list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2985 | 0 | ▶ | return wantarray ? @$list : $list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2986 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2987 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2988 | sub select_nonlazy_columns_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2989 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_nonlazy_columns_sql: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2990 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2991 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2992 | 0 | my $list = $self->{'select_nonlazy_columns_sql'}{$db->{'id'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2994 | 0 | ▶ | unless($list) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2995 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2996 | 0 | my $table = $self->table; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2997 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2998 | 0 | ▶ | if($self->sql_qualify_column_names_on_load) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2999 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3000 | 0 | $list = [ map { $_->select_sql($db, $table) } $self->nonlazy_columns ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3002 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3003 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3004 | 0 | $list = [ map { $_->select_sql($db) } $self->nonlazy_columns ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3005 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3006 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3007 | 0 | $self->{'select_nonlazy_columns_sql'}{$db->{'id'}} = $list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3010 | 0 | ▶ | return wantarray ? @$list : $list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3013 | sub method_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3014 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_column: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3015 | 0 | my($self, $method) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3017 | 0 | ▶ | unless(defined $self->{'method_columns'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3018 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3019 | 0 | foreach my $column ($self->columns_ordered) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3020 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3021 | 0 | foreach my $type ($column->defined_method_types) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3022 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3023 | 0 | ▶ | if(my $method = $column->method_name($type)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3024 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3025 | 0 | $self->{'method_column'}{$method} = $column; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3027 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3028 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3029 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3031 | 0 | return $self->{'method_column'}{$method}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3034 | sub column_rw_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3035 | 154 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_rw_method_names: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3036 | 154 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3037 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3038 | $self->{'column_rw_method_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3039 | 154 | ▶ | [ map { $self->column_rw_method_name($_) } $self->column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"column_rw_method_names"} ||= [map({$self->column_rw_method_name($_);} $self->column_names)]
MC/DC100%1/1
$self->{"column_rw_method_names"} ||= [map({$self->column_rw_method_name($_);} $self->column_names)]
$self->{"column_rw_method_names"}
Truth table100%2/2
A
A= $self->{"column_rw_method_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3041 | 0 | return wantarray ? @{$self->{'column_rw_method_names'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3042 | 154 | ▶ | $self->{'column_rw_method_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3043 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3045 | sub column_accessor_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3046 | 153 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_accessor_method_names: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3047 | 153 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3049 | $self->{'column_accessor_method_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3050 | 153 | ▶ | [ map { $self->column_accessor_method_name($_) } $self->column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"column_accessor_method_names"} ||= [map({$self->column_accessor_method_name($_);} $self->column_names)]
MC/DC0%0/1
$self->{"column_accessor_method_names"} ||= [map({$self->column_accessor_method_name($_);} $self->column_names)]
$self->{"column_accessor_method_names"}
Truth table50%1/2
A
A= $self->{"column_accessor_method_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3051 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3052 | 0 | return wantarray ? @{$self->{'column_accessor_method_names'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3053 | 153 | ▶ | $self->{'column_accessor_method_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3054 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3056 | sub nonpersistent_column_accessor_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3057 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_column_accessor_method_names: called CC=3 SCAR=13.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3058 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3060 | $self->{'nonpersistent_column_accessor_method_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3061 | 0 | ▶ | [ map { $self->nonpersistent_column_accessor_method_name($_) } $self->nonpersistent_column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"nonpersistent_column_accessor_method_names"} ||= [map({$self->nonpersistent_column_accessor_method_name($_);} $self->nonpersistent_column_names)]
MC/DC0%0/1
$self->{"nonpersistent_column_accessor_method_names"} ||= [map({$self->nonpersistent_column_accessor_method_name($_);} $self->nonpersistent_column_names)]
$self->{"nonpersistent_column_accessor_method_names"}
Truth table50%1/2
A
A= $self->{"nonpersistent_column_accessor_method_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3063 | 0 | return wantarray ? @{$self->{'nonpersistent_column_accessor_method_names'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3064 | 76 | ▶ | $self->{'nonpersistent_column_accessor_method_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3065 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3067 | sub nonlazy_column_accessor_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3068 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonlazy_column_accessor_method_names: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3069 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3070 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3071 | $self->{'nonlazy_column_accessor_method_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3072 | 0 | ▶ | [ map { $self->column_accessor_method_name($_) } $self->nonlazy_column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"nonlazy_column_accessor_method_names"} ||= [map({$self->column_accessor_method_name($_);} $self->nonlazy_column_names)]
MC/DC0%0/1
$self->{"nonlazy_column_accessor_method_names"} ||= [map({$self->column_accessor_method_name($_);} $self->nonlazy_column_names)]
$self->{"nonlazy_column_accessor_method_names"}
Truth table0%0/2
A
A= $self->{"nonlazy_column_accessor_method_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3073 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3074 | 0 | return wantarray ? @{$self->{'nonlazy_column_accessor_method_names'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3075 | 0 | ▶ | $self->{'nonlazy_column_accessor_method_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3076 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3077 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3078 | sub column_mutator_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3079 | 153 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_mutator_method_names: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3080 | 153 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3082 | $self->{'column_mutator_method_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3083 | 153 | ▶ | [ map { $self->column_mutator_method_name($_) } $self->column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"column_mutator_method_names"} ||= [map({$self->column_mutator_method_name($_);} $self->column_names)]
MC/DC0%0/1
$self->{"column_mutator_method_names"} ||= [map({$self->column_mutator_method_name($_);} $self->column_names)]
$self->{"column_mutator_method_names"}
Truth table50%1/2
A
A= $self->{"column_mutator_method_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3085 | 0 | return wantarray ? @{$self->{'column_mutator_method_names'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3086 | 153 | ▶ | $self->{'column_mutator_method_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3087 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3088 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3089 | sub nonpersistent_column_mutator_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3090 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_column_mutator_method_names: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3091 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3092 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3093 | $self->{'nonpersistent_column_mutator_method_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3094 | 0 | ▶ | [ map { $self->nonpersistent_column_mutator_method_name($_) } $self->nonpersistent_column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"nonpersistent_column_mutator_method_names"} ||= [map({$self->nonpersistent_column_mutator_method_name($_);} $self->nonpersistent_column_names)]
MC/DC0%0/1
$self->{"nonpersistent_column_mutator_method_names"} ||= [map({$self->nonpersistent_column_mutator_method_name($_);} $self->nonpersistent_column_names)]
$self->{"nonpersistent_column_mutator_method_names"}
Truth table0%0/2
A
A= $self->{"nonpersistent_column_mutator_method_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3096 | 0 | return wantarray ? @{$self->{'nonpersistent_column_mutator_method_names'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3097 | 0 | ▶ | $self->{'nonpersistent_column_mutator_method_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3098 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3100 | sub nonlazy_column_mutator_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3101 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonlazy_column_mutator_method_names: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3102 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3104 | $self->{'nonlazy_column_mutator_method_names'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3105 | 0 | ▶ | [ map { $self->column_mutator_method_name($_) } $self->nonlazy_column_names ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"nonlazy_column_mutator_method_names"} ||= [map({$self->column_mutator_method_name($_);} $self->nonlazy_column_names)]
MC/DC0%0/1
$self->{"nonlazy_column_mutator_method_names"} ||= [map({$self->column_mutator_method_name($_);} $self->nonlazy_column_names)]
$self->{"nonlazy_column_mutator_method_names"}
Truth table0%0/2
A
A= $self->{"nonlazy_column_mutator_method_names"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3107 | 0 | return wantarray ? @{$self->{'nonlazy_column_mutator_method_names'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3108 | 0 | ▶ | $self->{'nonlazy_column_mutator_method_names'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3111 | sub column_db_value_hash_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3112 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_db_value_hash_keys: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3113 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3115 | $self->{'column_db_value_hash_keys'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3116 | 0 | ▶ | { map { $_->mutator_method_name => $_->db_value_hash_key } $self->columns_ordered }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"column_db_value_hash_keys"} ||= {map({$_->mutator_method_name, $_->db_value_hash_key;} $self->columns_ordered)}
MC/DC0%0/1
$self->{"column_db_value_hash_keys"} ||= {map({$_->mutator_method_name, $_->db_value_hash_key;} $self->columns_ordered)}
$self->{"column_db_value_hash_keys"}
Truth table0%0/2
A
A= $self->{"column_db_value_hash_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3118 | 0 | return wantarray ? %{$self->{'column_db_value_hash_keys'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3119 | 0 | ▶ | $self->{'column_db_value_hash_keys'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3122 | sub nonlazy_column_db_value_hash_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3123 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonlazy_column_db_value_hash_keys: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3124 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3126 | $self->{'nonlazy_column_db_value_hash_keys'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3127 | 0 | ▶ | { map { $_->mutator_method_name => $_->db_value_hash_key } $self->nonlazy_columns }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"nonlazy_column_db_value_hash_keys"} ||= {map({$_->mutator_method_name, $_->db_value_hash_key;} $self->nonlazy_columns)}
MC/DC0%0/1
$self->{"nonlazy_column_db_value_hash_keys"} ||= {map({$_->mutator_method_name, $_->db_value_hash_key;} $self->nonlazy_columns)}
$self->{"nonlazy_column_db_value_hash_keys"}
Truth table0%0/2
A
A= $self->{"nonlazy_column_db_value_hash_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3129 | 0 | return wantarray ? %{$self->{'nonlazy_column_db_value_hash_keys'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3130 | 0 | ▶ | $self->{'nonlazy_column_db_value_hash_keys'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3133 | sub primary_key_column_db_value_hash_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3134 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_column_db_value_hash_keys: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3135 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3137 | $self->{'primary_key_column_db_value_hash_keys'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3138 | 0 | ▶ | [ map { $_->db_value_hash_key } $self->primary_key_columns ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"primary_key_column_db_value_hash_keys"} ||= [map({$_->db_value_hash_key;} $self->primary_key_columns)]
MC/DC0%0/1
$self->{"primary_key_column_db_value_hash_keys"} ||= [map({$_->db_value_hash_key;} $self->primary_key_columns)]
$self->{"primary_key_column_db_value_hash_keys"}
Truth table0%0/2
A
A= $self->{"primary_key_column_db_value_hash_keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3140 | 0 | return wantarray ? @{$self->{'primary_key_column_db_value_hash_keys'}} : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3141 | 0 | ▶ | $self->{'primary_key_column_db_value_hash_keys'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3144 | sub alias_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3145 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alias_column: called CC=5 SCAR=16.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3146 | 1 | my($self, $name, $new_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3148 | 1 | ▶ | Carp::croak "Usage: alias_column(column name, new name)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3149 | unless(@_ == 3); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3151 | Carp::croak "No such column '$name' in table ", $self->table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3152 | 1 | ▶ | unless($self->{'columns'}{$name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3154 | 1 | ▶ | Carp::cluck "Pointless alias for '$name' to '$new_name' for table ", $self->table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3155 | unless($name ne $new_name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3157 | # XXX: Allow primary keys to be aliased | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3158 | # XXX: Was disabled because the Manager was not happy with this. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3159 | #foreach my $column ($self->primary_key_column_names) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3160 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3161 | # if($name eq $column) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3162 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3163 | # Carp::croak "Primary key columns cannot be aliased (the culprit: '$name')"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3164 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3165 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3167 | 1 | $self->_clear_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3169 | 1 | ▶ | if(my $column = $self->column($name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3170 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3171 | 1 | $column->method_name($new_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3174 | 1 | $self->{'column_aliases'}{$name} = $new_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3177 | sub column_aliases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3178 | 116 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_aliases: called CC=3 SCAR=17.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3179 | 116 | ▶ | return $_[0]->{'column_aliases'} unless(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3180 | 0 | ▶ | return $_[0]->{'column_aliases'} = (ref $_[1] eq 'HASH') ? $_[1] : { @_[1 .. $#_] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3183 | sub column_accessor_method_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3184 | 731 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_accessor_method_name: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3185 | 731 | ▶ | $_[0]->{'column_accessor_method'}{$_[1]} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_[0]{"column_accessor_method"}{$_[1]} ||= $_[0]->column($_[1]) ? $_[0]->column($_[1])->accessor_method_name : undef
MC/DC100%2/2
$_[0]{"column_accessor_method"}{$_[1]} ||= $_[0]->column($_[1]) ? $_[0]->column($_[1])->accessor_method_name : undef
$_[0]{"column_accessor_method"}{$_[1]}
$_[0]->column($_[1]) ? $_[0]->column($_[1])->accessor_method_name : undef
Truth table100%3/3
A ||= B
A= $_[0]{"column_accessor_method"}{$_[1]}B= $_[0]->column($_[1]) ? $_[0]->column($_[1])->accessor_method_name : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3186 | ($_[0]->column($_[1]) ? $_[0]->column($_[1])->accessor_method_name : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3189 | sub nonpersistent_column_accessor_method_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3190 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_column_accessor_method_name: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3191 | 0 | ▶ | $_[0]->{'nonpersistent_column_accessor_method'}{$_[1]} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0]{"nonpersistent_column_accessor_method"}{$_[1]} ||= $_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->accessor_method_name : undef
MC/DC0%0/2
$_[0]{"nonpersistent_column_accessor_method"}{$_[1]} ||= $_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->accessor_method_name : undef
$_[0]{"nonpersistent_column_accessor_method"}{$_[1]}
$_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->accessor_method_name : undef
Truth table0%0/3
A ||= B
A= $_[0]{"nonpersistent_column_accessor_method"}{$_[1]}B= $_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->accessor_method_name : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3192 | ($_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->accessor_method_name : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3195 | 0 | ▶ | sub column_accessor_method_names_hash { shift->{'column_accessor_method'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_accessor_method_names_hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3197 | 0 | ▶ | sub nonpersistent_column_accessor_method_names_hash { shift->{'nonpersistent_column_accessor_method'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_column_accessor_method_names_hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3199 | sub key_column_accessor_method_names_hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3200 | 75 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key_column_accessor_method_names_hash: called CC=5 SCAR=17.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3201 | 75 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3203 | 75 | ▶ | return $self->{'key_column_accessor_method'} if($self->{'key_column_accessor_method'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3205 | 75 | foreach my $column (grep { ref } $self->primary_key_columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3206 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3207 | 77 | $self->{'key_column_accessor_method'}{$column->name} = $column->accessor_method_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3210 | 75 | foreach my $uk ($self->unique_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3211 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3212 | 0 | foreach my $column (grep { ref } $uk->columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3213 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3214 | 0 | $self->{'key_column_accessor_method'}{$column->name} = $column->accessor_method_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3218 | 75 | return $self->{'key_column_accessor_method'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3221 | sub column_mutator_method_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3222 | 503 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_mutator_method_name: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3223 | 503 | ▶ | $_[0]->{'column_mutator_method'}{$_[1]} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_[0]{"column_mutator_method"}{$_[1]} ||= $_[0]->column($_[1]) ? $_[0]->column($_[1])->mutator_method_name : undef
MC/DC100%2/2
$_[0]{"column_mutator_method"}{$_[1]} ||= $_[0]->column($_[1]) ? $_[0]->column($_[1])->mutator_method_name : undef
$_[0]{"column_mutator_method"}{$_[1]}
$_[0]->column($_[1]) ? $_[0]->column($_[1])->mutator_method_name : undef
Truth table100%3/3
A ||= B
A= $_[0]{"column_mutator_method"}{$_[1]}B= $_[0]->column($_[1]) ? $_[0]->column($_[1])->mutator_method_name : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3224 | ($_[0]->column($_[1]) ? $_[0]->column($_[1])->mutator_method_name : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3227 | sub nonpersistent_column_mutator_method_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3228 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonpersistent_column_mutator_method_name: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3229 | 0 | ▶ | $_[0]->{'nonpersistent_column_mutator_method'}{$_[1]} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0]{"nonpersistent_column_mutator_method"}{$_[1]} ||= $_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->mutator_method_name : undef
MC/DC0%0/2
$_[0]{"nonpersistent_column_mutator_method"}{$_[1]} ||= $_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->mutator_method_name : undef
$_[0]{"nonpersistent_column_mutator_method"}{$_[1]}
$_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->mutator_method_name : undef
Truth table0%0/3
A ||= B
A= $_[0]{"nonpersistent_column_mutator_method"}{$_[1]}B= $_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->mutator_method_name : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3230 | ($_[0]->nonpersistent_column($_[1]) ? $_[0]->nonpersistent_column($_[1])->mutator_method_name : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3233 | 0 | ▶ | sub column_mutator_method_names_hash { shift->{'column_mutator_method'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_mutator_method_names_hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3235 | sub column_rw_method_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3236 | 369 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_rw_method_name: called CC=2 SCAR=9.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3237 | 369 | ▶ | $_[0]->{'column_rw_method'}{$_[1]} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_[0]{"column_rw_method"}{$_[1]} ||= $_[0]->column($_[1])->rw_method_name
MC/DC0%0/2
$_[0]{"column_rw_method"}{$_[1]} ||= $_[0]->column($_[1])->rw_method_name
$_[0]{"column_rw_method"}{$_[1]}
$_[0]->column($_[1])->rw_method_name
Truth table33%1/3
A ||= B
A= $_[0]{"column_rw_method"}{$_[1]}B= $_[0]->column($_[1])->rw_method_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3238 | $_[0]->column($_[1])->rw_method_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3241 | 0 | ▶ | sub column_rw_method_names_hash { shift->{'column_rw_method'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_rw_method_names_hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3243 | sub fq_table_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3244 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fq_table_sql: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3245 | 1 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3246 | return $self->{'fq_table_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3247 | 1 | ▶ | join('.', grep { defined } ($self->select_catalog($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"fq_table_sql"}{$db->{"id"}} ||= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->auto_quote_table_name($self->table)))
MC/DC0%0/2
$self->{"fq_table_sql"}{$db->{"id"}} ||= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->auto_quote_table_name($self->table)))
$self->{"fq_table_sql"}{$db->{"id"}}
join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->auto_quote_table_name($self->table)))
Truth table33%1/3
A ||= B
A= $self->{"fq_table_sql"}{$db->{"id"}}B= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->auto_quote_table_name($self->table)))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3248 | $self->select_schema($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3249 | $db->auto_quote_table_name($self->table))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3252 | sub fqq_table_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3253 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fqq_table_sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3254 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3255 | return $self->{'fq_table_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3256 | 0 | ▶ | join('.', grep { defined } ($self->select_catalog($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"fq_table_sql"}{$db->{"id"}} ||= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->quote_table_name($self->table)))
MC/DC0%0/2
$self->{"fq_table_sql"}{$db->{"id"}} ||= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->quote_table_name($self->table)))
$self->{"fq_table_sql"}{$db->{"id"}}
join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->quote_table_name($self->table)))
Truth table0%0/3
A ||= B
A= $self->{"fq_table_sql"}{$db->{"id"}}B= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $db->quote_table_name($self->table)))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3257 | $self->select_schema($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3258 | $db->quote_table_name($self->table))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3261 | sub fq_table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3262 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fq_table: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3263 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3264 | return $self->{'fq_table'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3265 | 0 | ▶ | join('.', grep { defined } ($self->select_catalog($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"fq_table"}{$db->{"id"}} ||= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $self->table))
MC/DC0%0/2
$self->{"fq_table"}{$db->{"id"}} ||= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $self->table))
$self->{"fq_table"}{$db->{"id"}}
join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $self->table))
Truth table0%0/3
A ||= B
A= $self->{"fq_table"}{$db->{"id"}}B= join(".", grep({defined $_;} $self->select_catalog($db), $self->select_schema($db), $self->table))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3266 | $self->select_schema($db), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3267 | $self->table)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3270 | sub load_all_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3271 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_all_sql: not called CC=4 SCAR=25.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3272 | 0 | my($self, $key_columns, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3274 | 0 | ▶ | $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key_columns ||= $self->primary_key_column_names
MC/DC0%0/2
$key_columns ||= $self->primary_key_column_names
$key_columns
$self->primary_key_column_names
Truth table0%0/3
A ||= B
A= $key_columnsB= $self->primary_key_column_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3276 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3277 | return $self->{'load_all_sql'}{$db->{'id'}}{join("\0", @$key_columns)} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3278 | 'SELECT ' . $self->select_columns_string_sql($db) . ' FROM ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3279 | $self->fq_table_sql($db) . ' WHERE ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3280 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3281 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3282 | 0 | ▶ | my $c = $self->column($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"load_all_sql"}{$db->{"id"}}{join "\0", @$key_columns} ||= 'SELECT ' . $self->select_columns_string_sql($db) . ' FROM ' . $self->fq_table_sql($db) . ' WHERE ' . join(" AND ", map({my $c = $self->column($_);
($self->sql_qualify_column_names_on_load ? $db->auto_quote_column_with_table($c->name_sql, $self->table) : $c->name_sql($db)) . ' = ' . $c->query_placeholder_sql($db);} @$key_columns))
MC/DC0%0/1
$self->{"load_all_sql"}{$db->{"id"}}{join "\0", @$key_columns} ||= 'SELECT ' . $self->select_columns_string_sql($db) . ' FROM ' . $self->fq_table_sql($db) . ' WHERE ' . join(" AND ", map({my $c = $self->column($_);
($self->sql_qualify_column_names_on_load ? $db->auto_quote_column_with_table($c->name_sql, $self->table) : $c->name_sql($db)) . ' = ' . $c->query_placeholder_sql($db);} @$key_columns))
$self->{"load_all_sql"}{$db->{"id"}}{join "\0", @$key_columns}
Truth table0%0/2
A
A= $self->{"load_all_sql"}{$db->{"id"}}{join "\0", @$key_columns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3284 | 0 | ▶ | ($self->sql_qualify_column_names_on_load ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3285 | $db->auto_quote_column_with_table($c->name_sql, $self->table) : $c->name_sql($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3286 | ' = ' . $c->query_placeholder_sql($db) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3288 | @$key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3291 | sub load_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3292 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_sql: not called CC=4 SCAR=25.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3293 | 0 | my($self, $key_columns, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3295 | 0 | ▶ | $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key_columns ||= $self->primary_key_column_names
MC/DC0%0/2
$key_columns ||= $self->primary_key_column_names
$key_columns
$self->primary_key_column_names
Truth table0%0/3
A ||= B
A= $key_columnsB= $self->primary_key_column_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3297 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3298 | return $self->{'load_sql'}{$db->{'id'}}{join("\0", @$key_columns)} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3299 | 'SELECT ' . $self->select_nonlazy_columns_string_sql($db) . ' FROM ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3300 | $self->fq_table_sql($db) . ' WHERE ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3301 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3302 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3303 | 0 | ▶ | my $c = $self->column($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"load_sql"}{$db->{"id"}}{join "\0", @$key_columns} ||= 'SELECT ' . $self->select_nonlazy_columns_string_sql($db) . ' FROM ' . $self->fq_table_sql($db) . ' WHERE ' . join(" AND ", map({my $c = $self->column($_);
($self->sql_qualify_column_names_on_load ? $db->auto_quote_column_with_table($c->name_sql, $self->table) : $c->name_sql($db)) . ' = ' . $c->query_placeholder_sql($db);} @$key_columns))
MC/DC0%0/1
$self->{"load_sql"}{$db->{"id"}}{join "\0", @$key_columns} ||= 'SELECT ' . $self->select_nonlazy_columns_string_sql($db) . ' FROM ' . $self->fq_table_sql($db) . ' WHERE ' . join(" AND ", map({my $c = $self->column($_);
($self->sql_qualify_column_names_on_load ? $db->auto_quote_column_with_table($c->name_sql, $self->table) : $c->name_sql($db)) . ' = ' . $c->query_placeholder_sql($db);} @$key_columns))
$self->{"load_sql"}{$db->{"id"}}{join "\0", @$key_columns}
Truth table0%0/2
A
A= $self->{"load_sql"}{$db->{"id"}}{join "\0", @$key_columns}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3304 | 0 | ▶ | ($self->sql_qualify_column_names_on_load ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3305 | $db->auto_quote_column_with_table($c->name_sql, $self->table) : $c->name_sql($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3306 | ' = ' . $c->query_placeholder_sql($db) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3308 | @$key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3311 | sub load_all_sql_with_null_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3312 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_all_sql_with_null_key: not called CC=3 SCAR=20.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3313 | 0 | my($self, $key_columns, $key_values, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3315 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3317 | 0 | my $fq = $self->sql_qualify_column_names_on_load; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3318 | 0 | my $table = $self->table; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3320 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3321 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3322 | 'SELECT ' . $self->select_columns_string_sql($db) . ' FROM ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3323 | $self->fq_table_sql($db) . ' WHERE ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3324 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3325 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3326 | 0 | my $c = $self->column($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3327 | 0 | ▶ | ($fq ? $db->auto_quote_column_with_table($c->name_sql, $table) : $c->name_sql($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3328 | (defined $key_values->[$i++] ? ' = ' . $c->query_placeholder_sql : ' IS NULL') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3330 | @$key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3333 | sub load_sql_with_null_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3334 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_sql_with_null_key: not called CC=3 SCAR=20.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3335 | 0 | my($self, $key_columns, $key_values, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3337 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3339 | 0 | my $fq = $self->sql_qualify_column_names_on_load; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3340 | 0 | my $table = $self->table; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3342 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3343 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3344 | 'SELECT ' . $self->select_nonlazy_columns_string_sql($db) . ' FROM ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3345 | $self->fq_table_sql($db) . ' WHERE ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3346 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3347 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3348 | 0 | my $c = $self->column($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3349 | 0 | ▶ | ($fq ? $db->auto_quote_column_with_table($c->name_sql, $table) : $c->name_sql($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3350 | (defined $key_values->[$i++] ? ' = ' . $c->query_placeholder_sql : ' IS NULL') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3352 | @$key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3355 | sub update_all_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3356 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_all_sql: not called CC=3 SCAR=21.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3357 | 0 | my($self, $key_columns, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3359 | 0 | ▶ | $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key_columns ||= $self->primary_key_column_names
MC/DC0%0/2
$key_columns ||= $self->primary_key_column_names
$key_columns
$self->primary_key_column_names
Truth table0%0/3
A ||= B
A= $key_columnsB= $self->primary_key_column_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3361 | 0 | my $cache_key = "$db->{'id'}:" . join("\0", @$key_columns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3363 | return $self->{'update_all_sql'}{$cache_key} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3364 | 0 | ▶ | if($self->{'update_all_sql'}{$cache_key}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3366 | 0 | my %key = map { ($_ => 1) } @$key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3368 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3369 | return $self->{'update_all_sql'}{$cache_key} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3370 | 'UPDATE ' . $self->fq_table_sql($db) . " SET \n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3371 | join(",\n", map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3372 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3373 | 0 | ' ' . $_->name_sql($db) . ' = ' . $_->update_placeholder_sql($db) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3375 | 0 | grep { !$key{$_->name} } $self->columns_ordered) . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3376 | "\nWHERE " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3377 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3378 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3379 | 0 | my $c = $self->column($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3380 | 0 | $c->name_sql($db) . ' = ' . $c->query_placeholder_sql | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3382 | @$key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3385 | 61 | ▶ | use constant LAZY_LOADED_KEY => lazy_column_values_loaded_key(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3387 | sub update_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3388 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_sql: not called CC=7 SCAR=37.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3389 | 0 | my($self, $obj, $key_columns, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3391 | 0 | ▶ | $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key_columns ||= $self->primary_key_column_names
MC/DC0%0/2
$key_columns ||= $self->primary_key_column_names
$key_columns
$self->primary_key_column_names
Truth table0%0/3
A ||= B
A= $key_columnsB= $self->primary_key_column_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3393 | 0 | my %key = map { ($_ => 1) } @$key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3395 | 61 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3397 | my @columns = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3398 | 0 | ▶ | grep { !$key{$_->name} && (!$_->lazy || $obj->{LAZY_LOADED_KEY()}{$_->name}) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
!$key{$_->name} && (!$_->lazy || $obj->{'__xrdbopriv_lazy_loaded'}{$_->name})
not $_->lazy or $obj->{"__xrdbopriv_lazy_loaded"}{$_->name}
MC/DC0%0/3
!$key{$_->name} && (!$_->lazy || $obj->{'__xrdbopriv_lazy_loaded'}{$_->name})
!$key{$_->name}
not $_->lazy
$obj->{"__xrdbopriv_lazy_loaded"}{$_->name}
Truth table0%0/4
not(A) && not(B) or C
A= !$key{$_->name}B= not $_->lazyC= $obj->{"__xrdbopriv_lazy_loaded"}{$_->name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3399 | $self->columns_ordered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3401 | 0 | my @exec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3403 | 0 | ▶ | unless($self->dbi_requires_bind_param($db)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3404 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3405 | 0 | my $method_name = $self->column_accessor_method_names_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3407 | 0 | foreach my $column (@columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3408 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3409 | 0 | my $method = $method_name->{$column->{'name'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3410 | 0 | push(@exec, $obj->$method()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3414 | return (($self->{'update_sql_prefix'}{$db->{'id'}} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3415 | $self->init_update_sql_prefix($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3416 | join(",\n", map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3417 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3418 | 0 | ' ' . $_->name_sql($db) . ' = ' . $_->update_placeholder_sql($db) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3420 | @columns) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3421 | "\nWHERE " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3422 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3423 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3424 | 0 | ▶ | my $c = $self->column($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'update_sql_prefix'}{$db->{'id'}} || $self->init_update_sql_prefix($db)
MC/DC0%0/2
$self->{'update_sql_prefix'}{$db->{'id'}} || $self->init_update_sql_prefix($db)
$self->{'update_sql_prefix'}{$db->{'id'}}
$self->init_update_sql_prefix($db)
Truth table0%0/3
A || B
A= $self->{'update_sql_prefix'}{$db->{'id'}}B= $self->init_update_sql_prefix($db)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3425 | 0 | $c->name_sql($db) . ' = ' . $c->query_placeholder_sql($db) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3427 | @$key_columns), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3428 | \@exec, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3429 | \@columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3432 | sub init_update_sql_prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3433 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_update_sql_prefix: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3434 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3435 | 0 | return $self->{'update_sql_prefix'}{$db->{'id'}} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3436 | 'UPDATE ' . $self->fq_table_sql($db) . " SET \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3439 | sub update_changes_only_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3440 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_changes_only_sql: not called CC=5 SCAR=31.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3441 | 0 | my($self, $obj, $key_columns, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3443 | 0 | ▶ | $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key_columns ||= $self->primary_key_column_names
MC/DC0%0/2
$key_columns ||= $self->primary_key_column_names
$key_columns
$self->primary_key_column_names
Truth table0%0/3
A ||= B
A= $key_columnsB= $self->primary_key_column_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3445 | 0 | my %key = map { ($_ => 1) } @$key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3447 | 0 | ▶ | my @modified = map { $self->column($_) } grep { !$key{$_} } keys %{$obj->{MODIFIED_COLUMNS()} || {}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
$obj->{'__xrdbopriv_modified_columns'} || {}
$obj->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= $obj->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3449 | 0 | ▶ | return unless(@modified); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3451 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3452 | return ($self->{'update_sql_prefix'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3453 | 'UPDATE ' . $self->fq_table_sql($db) . " SET \n") . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3454 | join(",\n", map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3455 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3456 | 0 | ' ' . $_->name_sql($db) . ' = ' . $_->update_placeholder_sql($db) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3458 | @modified) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3459 | "\nWHERE " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3460 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3461 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3462 | 0 | my $c = $self->column($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3463 | 0 | $c->name_sql($db) . ' = ' . $c->query_placeholder_sql($db) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3465 | @$key_columns), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3466 | 0 | ▶ | [ map { my $m = $_->accessor_method_name; $obj->$m() } @modified ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"update_sql_prefix"}{$db->{"id"}} ||= 'UPDATE ' . $self->fq_table_sql($db) . " SET \n"
MC/DC0%0/1
$self->{"update_sql_prefix"}{$db->{"id"}} ||= 'UPDATE ' . $self->fq_table_sql($db) . " SET \n"
$self->{"update_sql_prefix"}{$db->{"id"}}
Truth table0%0/2
A
A= $self->{"update_sql_prefix"}{$db->{"id"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3467 | \@modified; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3470 | # This is nonsensical right now because the primary key always has to be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3471 | # non-null, and any update will use the primary key instead of a unique | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3472 | # key. But I'll leave the code here (commented out) just in case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3473 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3474 | # sub update_all_sql_with_null_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3475 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3476 | # my($self, $key_columns, $key_values, $db) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3477 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3478 | # my %key = map { ($_ => 1) } @$key_columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3479 | # my $i = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3480 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3481 | # no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3482 | # return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3483 | # 'UPDATE ' . $self->fq_table_sql($db) . " SET \n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3484 | # join(",\n", map { ' ' . $self->column($_)->name_sql($db) . ' = ?' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3485 | # grep { !$key{$_} } $self->column_names) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3486 | # "\nWHERE " . join(' AND ', map { defined $key_values->[$i++] ? "$_ = ?" : "$_ IS NULL" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3487 | # map { $self->column($_)->name_sql($db) } @$key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3488 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3489 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3490 | # Ditto for this version of update_sql_with_inlining which handles null keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3491 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3492 | # sub update_sql_with_inlining | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3493 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3494 | # my($self, $obj, $key_columns, $key_values) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3495 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3496 | # my $db = $obj->db or Carp::croak "Missing db"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3497 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3498 | # $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3499 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3500 | # my %key = map { ($_ => 1) } @$key_columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3501 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3502 | # my @bind; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3503 | # my @updates; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3504 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3505 | # foreach my $column (grep { !$key{$_} } $self->columns_ordered) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3506 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3507 | # my $method = $self->column_method($column->name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3508 | # my $value = $obj->$method(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3509 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3510 | # if($column->should_inline_value($db, $value)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3511 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3512 | # push(@updates, ' ' . $column->name_sql($db) . " = $value"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3513 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3514 | # else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3515 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3516 | # push(@updates, ' ' . $column->name_sql($db) . ' = ?'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3517 | # push(@bind, $value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3518 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3519 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3520 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3521 | # my $i = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3522 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3523 | # no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3524 | # return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3525 | # ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3526 | # ($self->{'update_sql_with_inlining_start'} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3527 | # 'UPDATE ' . $self->fq_table_sql($db) . " SET \n") . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3528 | # join(",\n", @updates) . "\nWHERE " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3529 | # join(' AND ', map { defined $key_values->[$i++] ? "$_ = ?" : "$_ IS NULL" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3530 | # map { $self->column($_)->name_sql($db) } @$key_columns), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3531 | # \@bind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3532 | # ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3533 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3535 | sub update_sql_with_inlining | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3536 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_sql_with_inlining: not called CC=10 SCAR=45.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3537 | 0 | my($self, $obj, $key_columns) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3539 | 0 | ▶ | my $db = $obj->db or Carp::croak "Missing db"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3541 | 0 | ▶ | $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key_columns ||= $self->primary_key_column_names
MC/DC0%0/2
$key_columns ||= $self->primary_key_column_names
$key_columns
$self->primary_key_column_names
Truth table0%0/3
A ||= B
A= $key_columnsB= $self->primary_key_column_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3543 | 0 | my %key = map { ($_ => 1) } @$key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3545 | 0 | my(@bind, @updates, @bind_params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3547 | 0 | my $do_bind_params = $self->dbi_requires_bind_param($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3549 | 0 | foreach my $column (grep { !$key{$_} && (!$_->{'lazy'} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3550 | 0 | ▶ | $obj->{LAZY_LOADED_KEY()}{$_->{'name'}}) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
!$key{$_} && (!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}})
not $_->{"lazy"} or $obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
MC/DC0%0/3
!$key{$_} && (!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}})
!$key{$_}
not $_->{"lazy"}
$obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
Truth table0%0/4
not(A) && not(B) or C
A= !$key{$_}B= not $_->{"lazy"}C= $obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3551 | $self->columns_ordered) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3552 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3553 | 0 | my $method = $self->column_accessor_method_name($column->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3554 | 0 | my $value = $obj->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3556 | 0 | ▶ | if($column->should_inline_value($db, $value)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3557 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3558 | 0 | push(@updates, $column->name_sql($db) . " = $value"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3560 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3561 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3562 | 0 | push(@updates, $column->name_sql($db) . ' = ' . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3563 | $column->update_placeholder_sql($db)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3564 | 0 | push(@bind, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3566 | 0 | ▶ | if($do_bind_params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3567 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3568 | 0 | push(@bind_params, $column->dbi_bind_param_attrs($db)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3573 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3575 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3576 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3577 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3578 | ($self->{'update_sql_with_inlining_start'}{$db->{'id'}} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3579 | $self->init_update_sql_with_inlining_start($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3580 | join(",\n", @updates) . "\nWHERE " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3581 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3582 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3583 | 0 | ▶ | my $c = $self->column($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'update_sql_with_inlining_start'}{$db->{'id'}} || $self->init_update_sql_with_inlining_start($db)
MC/DC0%0/2
$self->{'update_sql_with_inlining_start'}{$db->{'id'}} || $self->init_update_sql_with_inlining_start($db)
$self->{'update_sql_with_inlining_start'}{$db->{'id'}}
$self->init_update_sql_with_inlining_start($db)
Truth table0%0/3
A || B
A= $self->{'update_sql_with_inlining_start'}{$db->{'id'}}B= $self->init_update_sql_with_inlining_start($db)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3584 | 0 | ▶ | $c->name_sql($db) . ' = ' . $c->query_placeholder_sql($db) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3586 | @$key_columns), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3587 | \@bind, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3588 | ($do_bind_params ? \@bind_params : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3589 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3592 | sub init_update_sql_with_inlining_start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3593 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_update_sql_with_inlining_start: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3594 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3595 | 0 | return $self->{'update_sql_with_inlining_start'}{$db->{'id'}} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3596 | 'UPDATE ' . $self->fq_table_sql($db) . " SET \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3599 | sub update_changes_only_sql_with_inlining | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3600 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_changes_only_sql_with_inlining: not called CC=10 SCAR=45.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3601 | 0 | my($self, $obj, $key_columns) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3603 | 0 | ▶ | my $db = $obj->db or Carp::croak "Missing db"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3605 | 0 | ▶ | $key_columns ||= $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key_columns ||= $self->primary_key_column_names
MC/DC0%0/2
$key_columns ||= $self->primary_key_column_names
$key_columns
$self->primary_key_column_names
Truth table0%0/3
A ||= B
A= $key_columnsB= $self->primary_key_column_names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3607 | 0 | my %key = map { ($_ => 1) } @$key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3609 | 0 | my $modified = $obj->{MODIFIED_COLUMNS()}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3611 | 0 | my(@bind, @updates, @bind_params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3613 | 0 | my $do_bind_params = $self->dbi_requires_bind_param($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3615 | 0 | ▶ | foreach my $column (grep { !$key{$_->{'name'}} && $modified->{$_->{'name'}} } $self->columns_ordered) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
!$key{$_->{'name'}} && $$modified{$_->{'name'}}
MC/DC0%0/2
!$key{$_->{'name'}} && $$modified{$_->{'name'}}
!$key{$_->{'name'}}
$$modified{$_->{'name'}}
Truth table0%0/3
not(A) && B
A= !$key{$_->{'name'}}B= $$modified{$_->{'name'}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3616 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3617 | 0 | my $method = $self->column_accessor_method_name($column->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3618 | 0 | my $value = $obj->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3620 | 0 | ▶ | if($column->should_inline_value($db, $value)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3621 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3622 | 0 | push(@updates, ' ' . $column->name_sql($db) . " = $value"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3624 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3625 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3626 | 0 | push(@updates, $column->name_sql($db) . ' = ' . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3627 | $column->update_placeholder_sql($db)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3628 | 0 | push(@bind, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3630 | 0 | ▶ | if($do_bind_params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3631 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3632 | 0 | push(@bind_params, $column->dbi_bind_param_attrs($db)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3637 | 0 | ▶ | return unless(@updates); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3639 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3641 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3642 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3643 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3644 | ($self->{'update_sql_with_inlining_start'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3645 | 'UPDATE ' . $self->fq_table_sql($db) . " SET \n") . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3646 | join(",\n", @updates) . "\nWHERE " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3647 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3648 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3649 | 0 | ▶ | my $c = $self->column($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"update_sql_with_inlining_start"}{$db->{"id"}} ||= 'UPDATE ' . $self->fq_table_sql($db) . " SET \n"
MC/DC0%0/1
$self->{"update_sql_with_inlining_start"}{$db->{"id"}} ||= 'UPDATE ' . $self->fq_table_sql($db) . " SET \n"
$self->{"update_sql_with_inlining_start"}{$db->{"id"}}
Truth table0%0/2
A
A= $self->{"update_sql_with_inlining_start"}{$db->{"id"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3650 | 0 | ▶ | $c->name_sql($db) . ' = ' . $c->query_placeholder_sql($db) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3652 | @$key_columns), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3653 | \@bind, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3654 | ($do_bind_params ? \@bind_params : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3655 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3658 | sub insert_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3659 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_sql: not called CC=2 SCAR=10.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3660 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3662 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3663 | return $self->{'insert_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3664 | 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3665 | 0 | ▶ | join(",\n", map { " $_" } $self->column_names_sql($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"insert_sql"}{$db->{"id"}} ||= 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n" . join(",\n", map({" $_";} $self->column_names_sql($db))) . "\n)\nVALUES\n(\n" . $self->insert_columns_placeholders_sql($db) . "\n)"
MC/DC0%0/1
$self->{"insert_sql"}{$db->{"id"}} ||= 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n" . join(",\n", map({" $_";} $self->column_names_sql($db))) . "\n)\nVALUES\n(\n" . $self->insert_columns_placeholders_sql($db) . "\n)"
$self->{"insert_sql"}{$db->{"id"}}
Truth table0%0/2
A
A= $self->{"insert_sql"}{$db->{"id"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3666 | "\n)\nVALUES\n(\n" . $self->insert_columns_placeholders_sql($db) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3667 | "\n)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3668 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3670 | sub insert_changes_only_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3671 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_changes_only_sql: not called CC=6 SCAR=34.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3672 | 0 | my($self, $obj, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3674 | 0 | ▶ | my $modified = $obj->{MODIFIED_COLUMNS()} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
$obj->{'__xrdbopriv_modified_columns'} || {}
$obj->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= $obj->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3675 | 0 | ▶ | my @modified = grep { $modified->{$_->{'name'}} || $_->default_exists } $self->columns_ordered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$$modified{$_->{'name'}} || $_->default_exists
MC/DC0%0/2
$$modified{$_->{'name'}} || $_->default_exists
$$modified{$_->{'name'}}
$_->default_exists
Truth table0%0/3
A || B
A= $$modified{$_->{'name'}}B= $_->default_exists
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3677 | 0 | ▶ | unless(@modified) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3678 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3679 | # Make a last-ditch attempt to insert with no modified columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3680 | # using the DEFAULT keyword on an arbitrary column. This works | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3681 | # in MySQL and PostgreSQL. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3682 | 0 | ▶ | if($db->supports_arbitrary_defaults_on_insert) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3683 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3684 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3685 | 0 | 'INSERT INTO ' . $self->fq_table_sql($db) . ' (' . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3686 | ($self->columns_ordered)[-1]->name_sql($db) . ') VALUES (DEFAULT)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3687 | []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3689 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3690 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3691 | 0 | Carp::croak "Cannot insert row into table '", $self->table, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3692 | "' - No columns have modified or default values"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3696 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3697 | return ($self->{'insert_changes_only_sql_prefix'}{$db->{'id'}} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3698 | $self->init_insert_changes_only_sql_prefix($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3699 | 0 | join(",\n", map { $_->name_sql($db) } @modified) . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3700 | "\n)\nVALUES\n(\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3701 | 0 | join(",\n", map { $_->insert_placeholder_sql($db) } @modified) . "\n)", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3702 | 0 | ▶ | [ map { my $m = $_->accessor_method_name; $obj->$m() } @modified ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'insert_changes_only_sql_prefix'}{$db->{'id'}} || $self->init_insert_changes_only_sql_prefix($db)
MC/DC0%0/2
$self->{'insert_changes_only_sql_prefix'}{$db->{'id'}} || $self->init_insert_changes_only_sql_prefix($db)
$self->{'insert_changes_only_sql_prefix'}{$db->{'id'}}
$self->init_insert_changes_only_sql_prefix($db)
Truth table0%0/3
A || B
A= $self->{'insert_changes_only_sql_prefix'}{$db->{'id'}}B= $self->init_insert_changes_only_sql_prefix($db)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3703 | \@modified; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3706 | sub init_insert_changes_only_sql_prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3707 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_insert_changes_only_sql_prefix: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3708 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3709 | 0 | return $self->{'insert_changes_only_sql_prefix'}{$db->{'id'}} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3710 | 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3711 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3712 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3714 | sub insert_columns_placeholders_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3715 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_columns_placeholders_sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3716 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3717 | return $self->{'insert_columns_placeholders_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3718 | 0 | ▶ | join(",\n", map { ' ' . $_->insert_placeholder_sql($db) } $self->columns_ordered) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"insert_columns_placeholders_sql"}{$db->{"id"}} ||= join(",\n", map({' ' . $_->insert_placeholder_sql($db);} $self->columns_ordered))
MC/DC0%0/2
$self->{"insert_columns_placeholders_sql"}{$db->{"id"}} ||= join(",\n", map({' ' . $_->insert_placeholder_sql($db);} $self->columns_ordered))
$self->{"insert_columns_placeholders_sql"}{$db->{"id"}}
join(",\n", map({' ' . $_->insert_placeholder_sql($db);} $self->columns_ordered))
Truth table0%0/3
A ||= B
A= $self->{"insert_columns_placeholders_sql"}{$db->{"id"}}B= join(",\n", map({' ' . $_->insert_placeholder_sql($db);} $self->columns_ordered))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3721 | sub insert_and_on_duplicate_key_update_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3722 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_and_on_duplicate_key_update_sql: not called CC=14 SCAR=52.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3723 | 0 | my($self, $obj, $db, $changes_only) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3725 | 0 | my(@columns, @names, @bind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3727 | 0 | ▶ | if($obj->{STATE_IN_DB()}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3728 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3729 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3731 | @columns = $changes_only ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3732 | 0 | (map { $self->column($_) } grep { !$seen{$_}++ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3733 | ($self->primary_key_column_names, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3734 | 0 | ▶ | keys %{$obj->{MODIFIED_COLUMNS()} || {}})) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
$obj->{'__xrdbopriv_modified_columns'} || {}
$obj->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= $obj->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3735 | 0 | ▶ | (grep { (!$_->{'lazy'} || $obj->{LAZY_LOADED_KEY()}{$_->{'name'}}) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
MC/DC0%0/2
!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
!$_->{'lazy'}
$obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
Truth table0%0/3
not(A) || B
A= !$_->{'lazy'}B= $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3736 | $self->columns_ordered); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3738 | 0 | @names = map { $_->name_sql($db) } @columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3740 | 0 | foreach my $column (@columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3741 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3742 | 0 | my $method = $self->column_accessor_method_name($column->{'name'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3743 | 0 | push(@bind, $obj->$method()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3746 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3747 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3748 | 0 | my %skip; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3750 | 0 | my @key_columns = $self->primary_key_column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3751 | 0 | my @key_methods = $self->primary_key_column_accessor_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3752 | 0 | my @key_values = grep { defined } map { $obj->$_() } @key_methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3754 | 0 | ▶ | unless(@key_values) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3755 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3756 | 0 | @skip{@key_columns} = (1) x @key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3759 | 0 | foreach my $uk ($self->unique_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3760 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3761 | 0 | @key_columns = $uk->columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3762 | 0 | @key_methods = map { $_->accessor_method_name } @key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3763 | 0 | @key_values = grep { defined } map { $obj->$_() } @key_methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3765 | 0 | ▶ | unless(@key_values) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3766 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3767 | 0 | @skip{@key_columns} = (1) x @key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3769 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3771 | @columns = $changes_only ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3772 | 0 | ▶ | (map { $self->column($_) } grep { !$skip{"$_"} } keys %{$obj->{MODIFIED_COLUMNS()} || {}}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
$obj->{'__xrdbopriv_modified_columns'} || {}
$obj->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= $obj->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3773 | 0 | ▶ | (grep { !$skip{"$_"} && (!$_->{'lazy'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3774 | 0 | ▶ | $obj->{LAZY_LOADED_KEY()}{$_->{'name'}}) } $self->columns_ordered); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
!$skip{"$_"} && (!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}})
not $_->{"lazy"} or $obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
MC/DC0%0/3
!$skip{"$_"} && (!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}})
!$skip{"$_"}
not $_->{"lazy"}
$obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
Truth table0%0/4
not(A) && not(B) or C
A= !$skip{"$_"}B= not $_->{"lazy"}C= $obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3776 | 0 | @names = map { $_->name_sql($db) } @columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3778 | 0 | foreach my $column (@columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3779 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3780 | 0 | my $method = $self->column_accessor_method_name($column->{'name'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3781 | 0 | push(@bind, $obj->$method()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3785 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3786 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3787 | 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3788 | join(",\n", @names) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3789 | "\n)\nVALUES\n(\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3790 | 0 | join(",\n", map { $_->insert_placeholder_sql($db) } @columns) . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3791 | "\n)\nON DUPLICATE KEY UPDATE\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3792 | join(",\n", map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3793 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3794 | 0 | $_->name_sql($db) . ' = ' . $_->update_placeholder_sql($db) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3796 | @columns), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3797 | [ @bind, @bind ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3798 | [ @columns, @columns ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3799 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3801 | sub insert_sql_with_inlining | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3802 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_sql_with_inlining: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3803 | 0 | my($self, $obj) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3805 | 0 | ▶ | my $db = $obj->db or Carp::croak "Missing db"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3807 | 0 | my(@bind, @places, @bind_params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3809 | 0 | my $do_bind_params = $self->dbi_requires_bind_param($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3811 | 0 | foreach my $column ($self->columns_ordered) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3812 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3813 | 0 | my $method = $self->column_accessor_method_name($column->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3814 | 0 | my $value = $obj->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3816 | 0 | ▶ | if($column->should_inline_value($db, $value)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3817 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3818 | 0 | push(@places, " $value"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3820 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3821 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3822 | 0 | push(@places, $column->insert_placeholder_sql($db)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3823 | 0 | push(@bind, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3825 | 0 | ▶ | if($do_bind_params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3826 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3827 | 0 | push(@bind_params, $column->dbi_bind_param_attrs($db)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3828 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3832 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3833 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3834 | 0 | ▶ | ($self->{'insert_sql_with_inlining_start'}{$db->{'id'}} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{'insert_sql_with_inlining_start'}{$db->{'id'}} || $self->init_insert_sql_with_inlining_start($db)
MC/DC0%0/2
$self->{'insert_sql_with_inlining_start'}{$db->{'id'}} || $self->init_insert_sql_with_inlining_start($db)
$self->{'insert_sql_with_inlining_start'}{$db->{'id'}}
$self->init_insert_sql_with_inlining_start($db)
Truth table0%0/3
A || B
A= $self->{'insert_sql_with_inlining_start'}{$db->{'id'}}B= $self->init_insert_sql_with_inlining_start($db)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3835 | $self->init_insert_sql_with_inlining_start($db)) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3836 | join(",\n", @places) . "\n)", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3837 | \@bind, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3838 | ($do_bind_params ? \@bind_params : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3839 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3840 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3842 | sub init_insert_sql_with_inlining_start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3843 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_insert_sql_with_inlining_start: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3844 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3845 | $self->{'insert_sql_with_inlining_start'}{$db->{'id'}} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3846 | 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3847 | 0 | join(",\n", map { " $_" } $self->column_names_sql($db)) . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3848 | "\n)\nVALUES\n(\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3849 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3851 | sub insert_and_on_duplicate_key_update_with_inlining_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3852 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_and_on_duplicate_key_update_with_inlining_sql: not called CC=16 SCAR=55.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3853 | 0 | my($self, $obj, $db, $changes_only) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3855 | 0 | my(@columns, @names); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3857 | 0 | my $do_bind_params = $self->dbi_requires_bind_param($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3858 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3859 | 0 | ▶ | if($obj->{STATE_IN_DB()}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3860 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3861 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3862 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3863 | @columns = $changes_only ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3864 | 0 | (map { $self->column($_) } grep { !$seen{$_}++ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3865 | ($self->primary_key_column_names, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3866 | 0 | ▶ | keys %{$obj->{MODIFIED_COLUMNS()} || {}})) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
$obj->{'__xrdbopriv_modified_columns'} || {}
$obj->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= $obj->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3867 | 0 | ▶ | (grep { (!$_->{'lazy'} || $obj->{LAZY_LOADED_KEY()}{$_->{'name'}}) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
MC/DC0%0/2
!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
!$_->{'lazy'}
$obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
Truth table0%0/3
not(A) || B
A= !$_->{'lazy'}B= $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3868 | $self->columns_ordered); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3870 | 0 | @names = map { $_->name_sql($db) } @columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3872 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3873 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3874 | 0 | my %skip; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3876 | 0 | my @key_columns = $self->primary_key_column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3877 | 0 | my @key_methods = $self->primary_key_column_accessor_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3878 | 0 | my @key_values = grep { defined } map { $obj->$_() } @key_methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3880 | 0 | ▶ | unless(@key_values) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3881 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3882 | 0 | @skip{@key_columns} = (1) x @key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3885 | 0 | foreach my $uk ($self->unique_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3886 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3887 | 0 | @key_columns = $uk->columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3888 | 0 | @key_methods = map { $_->accessor_method_name } @key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3889 | 0 | @key_values = grep { defined } map { $obj->$_() } @key_methods; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3891 | 0 | ▶ | unless(@key_values) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3892 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3893 | 0 | @skip{@key_columns} = (1) x @key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3897 | @columns = $changes_only ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3898 | 0 | ▶ | (map { $self->column($_) } grep { !$skip{"$_"} } keys %{$obj->{MODIFIED_COLUMNS()} || {}}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
$obj->{'__xrdbopriv_modified_columns'} || {}
$obj->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= $obj->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3899 | 0 | ▶ | (grep { !$skip{"$_"} && (!$_->{'lazy'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3900 | 0 | ▶ | $obj->{LAZY_LOADED_KEY()}{$_->{'name'}}) } $self->columns_ordered); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
!$skip{"$_"} && (!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}})
not $_->{"lazy"} or $obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
MC/DC0%0/3
!$skip{"$_"} && (!$_->{'lazy'} || $obj->{'__xrdbopriv_lazy_loaded'}{$_->{'name'}})
!$skip{"$_"}
not $_->{"lazy"}
$obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
Truth table0%0/4
not(A) && not(B) or C
A= !$skip{"$_"}B= not $_->{"lazy"}C= $obj->{"__xrdbopriv_lazy_loaded"}{$_->{"name"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3901 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3902 | 0 | @names = map { $_->name_sql($db) } @columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3905 | 0 | my(@bind, @places, @bind_params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3907 | 0 | foreach my $column (@columns) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3908 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3909 | 0 | my $name = $column->{'name'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3910 | 0 | my $method = $self->column_accessor_method_name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3911 | 0 | my $value = $obj->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3913 | 0 | ▶ | if($column->should_inline_value($db, $value)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3914 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3915 | 0 | push(@places, [ $name, $column->inline_value_sql($value) ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3916 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3917 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3918 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3919 | 0 | push(@places, [ $name, $column->insert_placeholder_sql($_) ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3920 | 0 | push(@bind, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3922 | 0 | ▶ | if($do_bind_params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3923 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3924 | 0 | push(@bind_params, $column->dbi_bind_param_attrs($db)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3925 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3926 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3929 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3930 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3931 | 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3932 | join(",\n", @names) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3933 | 0 | "\n)\nVALUES\n(\n" . join(",\n", map { $_->[1] } @places) . "\n)\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3934 | "ON DUPLICATE KEY UPDATE\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3935 | 0 | ▶ | join(",\n", map { "$_->[0] = $_->[1]" } @places), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3936 | [ @bind, @bind ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3937 | ($do_bind_params ? \@bind_params : ()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3940 | sub insert_changes_only_sql_with_inlining | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3941 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_changes_only_sql_with_inlining: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3942 | 0 | my($self, $obj) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3944 | 0 | ▶ | my $db = $obj->db or Carp::croak "Missing db"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3945 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3946 | 0 | ▶ | my $modified = $obj->{MODIFIED_COLUMNS()} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$obj->{'__xrdbopriv_modified_columns'} || {}
MC/DC0%0/1
$obj->{'__xrdbopriv_modified_columns'} || {}
$obj->{'__xrdbopriv_modified_columns'}
Truth table0%0/2
A
A= $obj->{'__xrdbopriv_modified_columns'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3947 | 0 | ▶ | my @modified = grep { $modified->{$_->{'name'}} || $_->default_exists } $self->columns_ordered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$$modified{$_->{'name'}} || $_->default_exists
MC/DC0%0/2
$$modified{$_->{'name'}} || $_->default_exists
$$modified{$_->{'name'}}
$_->default_exists
Truth table0%0/3
A || B
A= $$modified{$_->{'name'}}B= $_->default_exists
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3949 | 0 | ▶ | unless(@modified) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3950 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3951 | # Make a last-ditch attempt to insert with no modified columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3952 | # using the DEFAULT keyword on an arbitrary column. This works | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3953 | # in MySQL and PostgreSQL. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3954 | 0 | ▶ | if($db->supports_arbitrary_defaults_on_insert) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3955 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3956 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3957 | 0 | 'INSERT INTO ' . $self->fq_table_sql($db) . ' (' . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3958 | ($self->columns_ordered)[-1]->name_sql($db) . ') VALUES (DEFAULT)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3959 | []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3961 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3962 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3963 | 0 | Carp::croak "Cannot insert row into table '", $self->table, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3964 | "' - No columns have modified or default values"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3965 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3966 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3968 | 0 | my(@bind, @places, @bind_params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3970 | 0 | my $do_bind_params = $self->dbi_requires_bind_param($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3972 | 0 | foreach my $column (@modified) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3973 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3974 | 0 | my $method = $self->column_accessor_method_name($column->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3975 | 0 | my $value = $obj->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3976 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3977 | 0 | ▶ | if($column->should_inline_value($db, $value)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3978 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3979 | 0 | push(@places, " $value"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3981 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3982 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3983 | 0 | push(@places, $column->insert_placeholder_sql($db)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3984 | 0 | push(@bind, $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3985 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3986 | 0 | ▶ | if($do_bind_params) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3987 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3988 | 0 | push(@bind_params, $column->dbi_bind_param_attrs($db)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3989 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3991 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3993 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3994 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3995 | 'INSERT INTO ' . $self->fq_table_sql($db) . "\n(\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3996 | 0 | ▶ | join(",\n", map { $_->name_sql($db) } @modified) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3997 | "\n)\nVALUES\n(\n" . join(",\n", @places) . "\n)", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3998 | \@bind, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3999 | ($do_bind_params ? \@bind_params : ()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4000 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4002 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4003 | sub delete_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4004 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4005 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4006 | return $self->{'delete_sql'}{$db->{'id'}} ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4007 | 'DELETE FROM ' . $self->fq_table_sql($db) . ' WHERE ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4008 | join(' AND ', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4009 | 0 | ▶ | map { $_->name_sql($db) . ' = ' . $_->query_placeholder_sql($db) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"delete_sql"}{$db->{"id"}} ||= 'DELETE FROM ' . $self->fq_table_sql($db) . ' WHERE ' . join(" AND ", map({$_->name_sql($db) . ' = ' . $_->query_placeholder_sql($db);} $self->primary_key_columns))
MC/DC0%0/1
$self->{"delete_sql"}{$db->{"id"}} ||= 'DELETE FROM ' . $self->fq_table_sql($db) . ' WHERE ' . join(" AND ", map({$_->name_sql($db) . ' = ' . $_->query_placeholder_sql($db);} $self->primary_key_columns))
$self->{"delete_sql"}{$db->{"id"}}
Truth table0%0/2
A
A= $self->{"delete_sql"}{$db->{"id"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4010 | $self->primary_key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4013 | sub get_column_value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4014 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_column_value: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4015 | 0 | my($self, $object, $column) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4016 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4017 | 0 | ▶ | my $db = $object->db or Carp::confess $object->error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4018 | 0 | ▶ | my $dbh = $db->dbh or Carp::confess $db->error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4019 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4020 | 0 | ▶ | my $sql = $self->{'get_column_sql_tmpl'}{$db->{'id'}} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'get_column_sql_tmpl'}{$db->{'id'}} || $self->init_get_column_sql_tmpl($db)
MC/DC0%0/2
$self->{'get_column_sql_tmpl'}{$db->{'id'}} || $self->init_get_column_sql_tmpl($db)
$self->{'get_column_sql_tmpl'}{$db->{'id'}}
$self->init_get_column_sql_tmpl($db)
Truth table0%0/3
A || B
A= $self->{'get_column_sql_tmpl'}{$db->{'id'}}B= $self->init_get_column_sql_tmpl($db)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4021 | $self->init_get_column_sql_tmpl($db); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4023 | 0 | $sql =~ s/__COLUMN__/$column->name_sql($db)/e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4025 | my @key_values = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4026 | 0 | map { $object->$_() } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4027 | 0 | map { $self->column_accessor_method_name($_) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4028 | $self->primary_key_column_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4029 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4030 | 0 | my($value, $error); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4032 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4033 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4034 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4036 | eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4037 | 0 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4038 | 0 | ▶ | ($Debug || $Rose::DB::Object::Debug) && warn "$sql (@key_values)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Rose::DB::Object::Metadata::Debug or $Rose::DB::Object::Debug
MC/DC0%0/2
$Rose::DB::Object::Metadata::Debug or $Rose::DB::Object::Debug
$Rose::DB::Object::Metadata::Debug
$Rose::DB::Object::Debug
Truth table0%0/3
A or B
A= $Rose::DB::Object::Metadata::DebugB= $Rose::DB::Object::Debug
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4039 | 0 | my $sth = $dbh->prepare($sql); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4040 | 0 | $sth->execute(@key_values); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4041 | 0 | $sth->bind_columns(\$value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4042 | 0 | $sth->fetch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4043 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4045 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4046 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4048 | 0 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4049 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4050 | 0 | Carp::croak "Could not lazily-load column value for column '", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4051 | $column->name, "' - $error"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4052 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4054 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4055 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4057 | sub init_get_column_sql_tmpl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4058 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_get_column_sql_tmpl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4059 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4060 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4061 | 0 | my $key_columns = $self->primary_key_column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4062 | 0 | my %key = map { ($_ => 1) } @$key_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4064 | return $self->{'get_column_sql_tmpl'}{$db->{'id'}} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4065 | 'SELECT __COLUMN__ FROM ' . $self->fq_table_sql($db) . ' WHERE ' . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4066 | join(' AND ', map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4067 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4068 | 0 | my $c = $self->column($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4069 | 0 | $c->name_sql($db) . ' = ' . $c->query_placeholder_sql($db) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4070 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4071 | @$key_columns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4073 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4074 | sub refresh_lazy_column_tracking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4075 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh_lazy_column_tracking: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4076 | 77 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4077 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4078 | 77 | $self->_clear_column_generated_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4080 | # Initialize method name hashes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4081 | 77 | $self->column_accessor_method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4082 | 77 | $self->column_mutator_method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4083 | 77 | $self->column_rw_method_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4085 | 77 | return $self->{'has_lazy_columns'} = grep { $_->lazy } $self->columns_ordered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4086 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4087 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4088 | sub has_lazy_columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4089 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_lazy_columns: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4090 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4091 | 0 | ▶ | return $self->{'has_lazy_columns'} if(defined $self->{'has_lazy_columns'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4092 | 0 | return $self->{'has_lazy_columns'} = grep { $_->lazy } $self->columns_ordered; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4093 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4095 | sub prime_all_caches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4096 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prime_all_caches: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4097 | 0 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4099 | 0 | foreach my $obj_class ($class->registered_classes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4100 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4101 | 0 | $obj_class->meta->prime_caches(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4105 | sub prime_caches | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4106 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prime_caches: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4107 | 0 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4109 | 0 | my @methods = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4110 | qw(column_names num_columns nonlazy_column_names lazy_column_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4111 | column_rw_method_names column_accessor_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4112 | nonlazy_column_accessor_method_names column_mutator_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4113 | nonlazy_column_mutator_method_names nonlazy_column_db_value_hash_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4114 | primary_key_column_db_value_hash_keys column_db_value_hash_keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4115 | column_accessor_method_names column_mutator_method_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4116 | column_rw_method_names key_column_accessor_method_names_hash); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4118 | 0 | foreach my $method (@methods) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4119 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4120 | 0 | $self->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4123 | 0 | ▶ | my $db = $args{'db'} || $self->class->init_db; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'db'} || $self->class->init_db
MC/DC0%0/2
$args{'db'} || $self->class->init_db
$args{'db'}
$self->class->init_db
Truth table0%0/3
A || B
A= $args{'db'}B= $self->class->init_db
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4125 | 0 | $self->method_column('nonesuch'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4126 | 0 | $self->fq_primary_key_sequence_names(db => $db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4128 | 0 | @methods = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4129 | qw(dbi_requires_bind_param fq_table fq_table_sql init_get_column_sql_tmpl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4130 | delete_sql primary_key_sequence_names insert_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4131 | init_insert_sql_with_inlining_start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4132 | init_insert_changes_only_sql_prefix init_update_sql_prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4133 | init_update_sql_with_inlining_start column_names_string_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4134 | nonlazy_column_names_string_sql select_nonlazy_columns_string_sql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4135 | select_columns_string_sql select_columns_sql select_nonlazy_columns_sql); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4137 | 0 | foreach my $method (@methods) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4138 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4139 | 0 | $self->$method($db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4142 | 0 | undef @methods; # reclaim memory? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4144 | 0 | foreach my $key ($self->primary_key, $self->unique_keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4145 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4146 | 0 | foreach my $method (qw(update_all_sql load_sql load_all_sql)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4147 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4148 | 0 | $self->$method(scalar $key->columns, $db); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4153 | sub _clear_table_generated_values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4154 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clear_table_generated_values: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4155 | 5 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4157 | 5 | $self->{'fq_table'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4158 | 5 | $self->{'fq_table_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4159 | 5 | $self->{'get_column_sql_tmpl'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4160 | 5 | $self->{'load_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4161 | 5 | $self->{'load_all_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4162 | 5 | $self->{'delete_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4163 | 5 | $self->{'fq_primary_key_sequence_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4164 | 5 | $self->{'primary_key_sequence_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4165 | 5 | $self->{'insert_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4166 | 5 | $self->{'insert_sql_with_inlining_start'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4167 | 5 | $self->{'insert_changes_only_sql_prefix'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4168 | 5 | $self->{'update_sql_prefix'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4169 | 5 | $self->{'update_sql_with_inlining_start'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4170 | 5 | $self->{'update_all_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4173 | sub _clear_column_generated_values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4174 | 316 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clear_column_generated_values: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4175 | 316 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4177 | 316 | $self->{'fq_table'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4178 | 316 | $self->{'fq_table_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4179 | 316 | $self->{'column_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4180 | 316 | $self->{'num_columns'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4181 | 316 | $self->{'nonlazy_column_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4182 | 316 | $self->{'lazy_column_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4183 | 316 | $self->{'column_names_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4184 | 316 | $self->{'get_column_sql_tmpl'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4185 | 316 | $self->{'column_names_string_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4186 | 316 | $self->{'nonlazy_column_names_string_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4187 | 316 | $self->{'column_rw_method_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4188 | 316 | $self->{'column_accessor_method_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4189 | 316 | $self->{'nonlazy_column_accessor_method_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4190 | 316 | $self->{'column_mutator_method_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4191 | 316 | $self->{'nonlazy_column_mutator_method_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4192 | 316 | $self->{'nonlazy_column_db_value_hash_keys'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4193 | 316 | $self->{'primary_key_column_db_value_hash_keys'}= undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4194 | 316 | $self->{'primary_key_column_names_or_aliases'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4195 | 316 | $self->{'column_db_value_hash_keys'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4196 | 316 | $self->{'select_nonlazy_columns_string_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4197 | 316 | $self->{'select_columns_string_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4198 | 316 | $self->{'select_columns_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4199 | 316 | $self->{'select_nonlazy_columns_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4200 | 316 | $self->{'method_columns'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4201 | 316 | $self->{'column_accessor_method'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4202 | 316 | $self->{'key_column_accessor_method'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4203 | 316 | $self->{'column_rw_method'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4204 | 316 | $self->{'load_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4205 | 316 | $self->{'load_all_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4206 | 316 | $self->{'update_all_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4207 | 316 | $self->{'update_sql_prefix'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4208 | 316 | $self->{'insert_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4209 | 316 | $self->{'insert_sql_with_inlining_start'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4210 | 316 | $self->{'update_sql_with_inlining_start'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4211 | 316 | $self->{'insert_changes_only_sql_prefix'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4212 | 316 | $self->{'delete_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4213 | 316 | $self->{'insert_columns_placeholders_sql'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4214 | 316 | $self->{'dbi_requires_bind_param'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4215 | 316 | $self->{'key_column_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4218 | sub _clear_nonpersistent_column_generated_values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4219 | 76 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clear_nonpersistent_column_generated_values: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4220 | 76 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4222 | 76 | $self->{'nonpersistent_column_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4223 | 76 | $self->{'nonpersistent_column_accessor_method_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4224 | 76 | $self->{'nonpersistent_column_accessor_method'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4225 | 76 | $self->{'nonpersistent_column_mutator_method_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4226 | 76 | $self->{'nonpersistent_column_mutator_method'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4229 | sub _clear_primary_key_column_generated_values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4230 | 84 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clear_primary_key_column_generated_values: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4231 | 84 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4232 | 84 | $self->{'primary_key_column_accessor_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4233 | 84 | $self->{'primary_key_column_mutator_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4234 | 84 | $self->{'key_column_accessor_method'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4235 | 84 | $self->{'primary_key_column_names_or_aliases'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4236 | 84 | $self->{'key_column_names'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4239 | sub method_name_is_reserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4240 | 392 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name_is_reserved: called CC=10 SCAR=31.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4241 | 392 | my($self, $name, $class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4243 | 392 | ▶ | if(!defined $class && UNIVERSAL::isa($self, __PACKAGE__)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $class and UNIVERSAL::isa($self, __PACKAGE__)
MC/DC0%0/2
not defined $class and UNIVERSAL::isa($self, __PACKAGE__)
not defined $class
UNIVERSAL::isa($self, __PACKAGE__)
Truth table33%1/3
not(A) and B
A= not defined $classB= UNIVERSAL::isa($self, __PACKAGE__)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4244 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4245 | 0 | ▶ | $class ||= $self->class or die "Missing class!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class ||= $self->class
MC/DC0%0/2
$class ||= $self->class
$class
$self->class
Truth table0%0/3
A ||= B
A= $classB= $self->class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4248 | 392 | ▶ | Carp::confess "Missing method name argument in call to method_name_is_reserved()" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4249 | unless(defined $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4251 | 392 | ▶ | if(index($name, PRIVATE_PREFIX) == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4252 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4253 | 0 | return "The method prefix '", PRIVATE_PREFIX, "' is reserved." | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4255 | ▶ | elsif($name =~ /^(?:meta|dbh?|_?init_db|error|not_found|load|save|update|insert|delete|DESTROY)$/ || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$name =~ /^(?:meta|dbh?|_?init_db|error|not_found|load|save|update|insert|delete|DESTROY)$/ or $class->isa("Rose::DB::Object::Cached") and $name =~ /^(?:remember|forget(?:_all)?)$/
$class->isa("Rose::DB::Object::Cached") and $name =~ /^(?:remember|forget(?:_all)?)$/
MC/DC33%1/3
$name =~ /^(?:meta|dbh?|_?init_db|error|not_found|load|save|update|insert|delete|DESTROY)$/ or $class->isa("Rose::DB::Object::Cached") and $name =~ /^(?:remember|forget(?:_all)?)$/
$name =~ /^(?:meta|dbh?|_?init_db|error|not_found|load|save|update|insert|delete|DESTROY)$/
$class->isa("Rose::DB::Object::Cached")
$name =~ /^(?:remember|forget(?:_all)?)$/
Truth table50%2/4
A or B and C
A= $name =~ /^(?:meta|dbh?|_?init_db|error|not_found|load|save|update|insert|delete|DESTROY)$/B= $class->isa("Rose::DB::Object::Cached")C= $name =~ /^(?:remember|forget(?:_all)?)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4256 | ($class->isa('Rose::DB::Object::Cached') && $name =~ /^(?:remember|forget(?:_all)?)$/)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4257 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4258 | 1 | return "This method name is reserved for use by the $class API." | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4261 | 391 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4264 | sub method_name_from_column_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4265 | 194 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name_from_column_name: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4266 | 194 | my($self, $column_name, $method_type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4268 | 194 | ▶ | my $column = $self->column($column_name) || $self->nonpersistent_column($column_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->column($column_name) || $self->nonpersistent_column($column_name)
MC/DC0%0/2
$self->column($column_name) || $self->nonpersistent_column($column_name)
$self->column($column_name)
$self->nonpersistent_column($column_name)
Truth table33%1/3
A || B
A= $self->column($column_name)B= $self->nonpersistent_column($column_name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4269 | or Carp::confess "No such column: $column_name"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4271 | 194 | return $self->method_name_from_column($column, $method_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4274 | sub method_name_from_column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4275 | 194 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name_from_column: called CC=5 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4276 | 194 | my($self, $column, $method_type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4278 | 194 | my $default_name = $column->build_method_name_for_type($method_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4280 | 194 | ▶ | my $method_name = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$column->method_name($method_type) || $self->convention_manager->auto_column_method_name($method_type, $column, $default_name, $self->class) || $default_name
$column->method_name($method_type) or $self->convention_manager->auto_column_method_name($method_type, $column, $default_name, $self->class)
MC/DC0%0/3
$column->method_name($method_type) || $self->convention_manager->auto_column_method_name($method_type, $column, $default_name, $self->class) || $default_name
$column->method_name($method_type)
$self->convention_manager->auto_column_method_name($method_type, $column, $default_name, $self->class)
$default_name
Truth table75%3/4
A or B || C
A= $column->method_name($method_type)B= $self->convention_manager->auto_column_method_name($method_type, $column, $default_name, $self->class)C= $default_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4281 | $column->method_name($method_type) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4282 | $self->convention_manager->auto_column_method_name($method_type, $column, $default_name, $self->class) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4283 | $default_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4285 | 194 | ▶ | if(my $code = $self->column_name_to_method_name_mapper) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4286 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4287 | 0 | my $column_name = $column->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4288 | 0 | local $_ = $method_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4289 | 0 | $method_name = $code->($self, $column_name, $method_type, $method_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4291 | 0 | ▶ | unless(defined $method_name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4292 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4293 | 0 | Carp::croak "column_name_to_method_name_mapper() returned undef ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4294 | "for column name '$column_name' method type '$method_type'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4298 | 194 | return $method_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4301 | sub dbi_requires_bind_param | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4302 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dbi_requires_bind_param: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4303 | 0 | my($self, $db) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4305 | return $self->{'dbi_requires_bind_param'}{$db->{'id'}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4306 | 0 | ▶ | if(defined $self->{'dbi_requires_bind_param'}{$db->{'id'}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4308 | 0 | foreach my $column ($self->columns_ordered) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4309 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4310 | 0 | ▶ | if($column->dbi_requires_bind_param($db)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4311 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4312 | 0 | return $self->{'dbi_requires_bind_param'}{$db->{'id'}} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4316 | 0 | return $self->{'dbi_requires_bind_param'}{$db->{'id'}} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4319 | sub make_manager_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4320 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_manager_class: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4321 | 2 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4323 | 2 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4325 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4326 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4327 | 2 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4328 | 2 | ▶ | eval { eval $self->perl_manager_class(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4329 | 2 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4332 | 2 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4333 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4334 | 1 | Carp::croak "Could not make manager class - $error\nThe Perl code used was:\n\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4335 | $self->perl_manager_class(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4339 | sub perl_manager_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4340 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
perl_manager_class: called CC=17 SCAR=30.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4341 | 4 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4343 | 3 | my %args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4345 | 3 | ▶ | if(@_ == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4346 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4347 | 0 | $args{'base_name'} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4349 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4350 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4351 | 3 | %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4354 | 3 | ▶ | $args{'base_name'} ||= $self->convention_manager->auto_manager_base_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{"base_name"} ||= $self->convention_manager->auto_manager_base_name
MC/DC0%0/2
$args{"base_name"} ||= $self->convention_manager->auto_manager_base_name
$args{"base_name"}
$self->convention_manager->auto_manager_base_name
Truth table33%1/3
A ||= B
A= $args{"base_name"}B= $self->convention_manager->auto_manager_base_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4355 | 3 | ▶ | $args{'class'} ||= $self->convention_manager->auto_manager_class_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{"class"} ||= $self->convention_manager->auto_manager_class_name
MC/DC0%0/2
$args{"class"} ||= $self->convention_manager->auto_manager_class_name
$args{"class"}
$self->convention_manager->auto_manager_class_name
Truth table33%1/3
A ||= B
A= $args{"class"}B= $self->convention_manager->auto_manager_class_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4357 | 3 | ▶ | unless($args{'class'} =~ /^\w+(?:::\w+)*$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4358 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4359 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4360 | Carp::croak "Missing or invalid class", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4361 | 0 | ▶ | (length $args{'class'} ? ": '$args{'class'}'" : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4364 | 3 | ▶ | unless($args{'isa'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4365 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4366 | 3 | my @def = $self->default_manager_base_class; # may return multiple classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4367 | 3 | ▶ | $args{'isa'} = (@def == 1 && ref $def[0]) ? $def[0] : \@def; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@def == 1 and ref $def[0]
MC/DC0%0/2
@def == 1 and ref $def[0]
@def == 1
ref $def[0]
Truth table33%1/3
A and B
A= @def == 1B= ref $def[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4370 | 3 | ▶ | $args{'isa'} = [ $args{'isa'} ] unless(ref $args{'isa'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4372 | 3 | my($isa, $ok); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4374 | 3 | foreach my $class (@{$args{'isa'}}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4375 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4376 | 3 | ▶ | unless($class =~ /^\w+(?:::\w+)*$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4377 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4378 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4379 | 0 | Carp::croak "Invalid isa class: '$class'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4382 | 61 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4383 | 3 | ▶ | $isa .= "use $class;\n" unless($class !~ /^Rose::DB::/ && %{"${class}::"}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $class =~ /^Rose::DB::/ and %{"${class}::";}
MC/DC50%1/2
not $class =~ /^Rose::DB::/ and %{"${class}::";}
not $class =~ /^Rose::DB::/
%{"${class}::";}
Truth table66%2/3
not(A) and B
A= not $class =~ /^Rose::DB::/B= %{"${class}::";}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4385 | 3 | ▶ | $ok = 1 if(UNIVERSAL::isa($class, 'Rose::DB::Object::Manager')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4388 | 3 | ▶ | unless($ok) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4389 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4390 | Carp::croak | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4391 | "None of these classes inherit from Rose::DB::Object::Manager: ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4392 | 2 | join(', ', @{$args{'isa'}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4395 | 1 | $isa .= "our \@ISA = qw(@{$args{'isa'}});"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4397 | 61 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4398 | 1 | ▶ | if(@{"$args{'class'}::ISA"}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4399 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4400 | 0 | Carp::croak "Can't override class $args{'class'} which already ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4401 | "appears to be defined."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4404 | 1 | my $object_class = $self->class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4406 | 1 | return<<"EOF"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4407 | package $args{'class'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4409 | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4411 | $isa | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4413 | sub object_class { '$object_class' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4415 | __PACKAGE__->make_manager_methods('$args{'base_name'}'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4417 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4418 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4421 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4422 | # Automatic metadata setup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4423 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4425 | 61 | our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4427 | 0 | ▶ | sub DESTROY { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4429 | sub AUTOLOAD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4430 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4431 | 0 | ▶ | if($AUTOLOAD =~ /::((?:auto_(?!helper)|(?:default_)?perl_)\w*)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4432 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4433 | 0 | my $method = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4434 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4435 | 0 | $self->init_auto_helper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4437 | 0 | ▶ | unless($self->can($method)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4438 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4439 | 0 | Carp::croak "No such method '$method' in class ", ref($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4442 | 0 | return $self->$method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4445 | 0 | Carp::confess "No such method: $AUTOLOAD"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4448 | sub auto_helper_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4449 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auto_helper_class: called CC=6 SCAR=25.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4450 | 2 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4452 | 2 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4453 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4454 | 0 | my $driver = lc shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4455 | 0 | ▶ | return $self->auto_helper_classes->{$driver} = shift if(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4456 | 0 | return $self->auto_helper_classes->{$driver}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4458 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4459 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4460 | 2 | ▶ | my $db = $self->db or die "Missing db"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4461 | return $self->auto_helper_classes->{$db->driver} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4462 | 2 | ▶ | $self->auto_helper_classes->{'generic'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$self->auto_helper_classes->{$db->driver} || $self->auto_helper_classes->{'generic'} || Carp::croak(q[Don't know how to auto-initialize using driver '], $db->driver, q['])
$self->auto_helper_classes->{$db->driver} or $self->auto_helper_classes->{"generic"}
MC/DC0%0/2
$self->auto_helper_classes->{$db->driver} || $self->auto_helper_classes->{'generic'} || Carp::croak(q[Don't know how to auto-initialize using driver '], $db->driver, q['])
$self->auto_helper_classes->{$db->driver}
$self->auto_helper_classes->{"generic"}
Truth table33%1/3
A or B
A= $self->auto_helper_classes->{$db->driver}B= $self->auto_helper_classes->{"generic"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4463 | Carp::croak "Don't know how to auto-initialize using driver '", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4464 | $db->driver, "'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4468 | 61 | my %Rebless; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4470 | sub init_auto_helper | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4471 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_auto_helper: called CC=13 SCAR=26.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4472 | 1 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4474 | 1 | ▶ | unless($self->isa($self->auto_helper_class)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4475 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4476 | 1 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4478 | 1 | my $auto_helper_class = $self->auto_helper_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4480 | 61 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4481 | 1 | ▶ | unless(@{"${auto_helper_class}::ISA"}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4482 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4483 | 1 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4485 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4486 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4487 | 1 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4488 | 1 | eval "use $auto_helper_class"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4489 | 1 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4492 | 1 | ▶ | Carp::croak "Could not load '$auto_helper_class' - $error" if($error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4495 | 1 | $self->original_class($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4497 | REBLESS: # Do slightly evil re-blessing magic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4498 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4499 | # Check cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4500 | 1 | ▶ | if(my $new_class = $Rebless{$class,$auto_helper_class}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4501 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4502 | 0 | bless $self, $new_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4504 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4505 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4506 | # Special, simple case for Rose::DB::Object::Metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4507 | 1 | ▶ | if($class eq __PACKAGE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4508 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4509 | 0 | bless $self, $auto_helper_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4511 | else # Handle Rose::DB::Object::Metadata subclasses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4512 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4513 | # If this is a default Rose::DB driver class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4514 | 1 | ▶ | if(index($auto_helper_class, 'Rose::DB::') == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4515 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4516 | # Make a new metadata class based on the current class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4517 | 1 | my $new_class = $class . '::__RoseDBObjectMetadataPrivate__::' . $auto_helper_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4519 | # Pull all the auto-helper's methods up into the new class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4520 | # unless they're already defined by the original class. This | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4521 | # is ugly, I know, but remember that it's all an implementation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4522 | # detail that could change at any time :) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4523 | IMPORT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4524 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4525 | 61 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4526 | 1 | local(*auto_symbol, *existing_symbol); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4528 | 1 | ▶ | while(my($name, $value) = each(%{"${auto_helper_class}::"})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4529 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4530 | 61 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4532 | 11 | ▶ | next if($name =~ /^[A-Z]+$/); # skip BEGIN, DESTROY, etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4534 | 8 | *auto_symbol = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4535 | 8 | *existing_symbol = *{"${class}::$name"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4537 | 8 | ▶ | if(defined &auto_symbol && !defined &existing_symbol) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined &Rose::DB::Object::Metadata::auto_symbol and not defined &Rose::DB::Object::Metadata::existing_symbol
MC/DC50%1/2
defined &Rose::DB::Object::Metadata::auto_symbol and not defined &Rose::DB::Object::Metadata::existing_symbol
defined &Rose::DB::Object::Metadata::auto_symbol
not defined &Rose::DB::Object::Metadata::existing_symbol
Truth table66%2/3
A and not(B)
A= defined &Rose::DB::Object::Metadata::auto_symbolB= not defined &Rose::DB::Object::Metadata::existing_symbol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4538 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4539 | 2 | ▶ | $Debug && warn "IMPORT $name INTO $new_class FROM $auto_helper_class\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4540 | 2 | *{"${new_class}::$name"} = \&auto_symbol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4541 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4545 | 61 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4546 | 1 | @{"${new_class}::ISA"} = ($class, $auto_helper_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4548 | 1 | bless $self, $new_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4550 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4551 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4552 | # Otherwise use the (apparently custom) metadata class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4553 | 0 | bless $self, $auto_helper_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4554 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4557 | # Cache value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4558 | 1 | $Rebless{$class,$auto_helper_class} = ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4563 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4566 | sub map_record_method_key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4567 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_record_method_key: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4568 | 1 | my($self, $method) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4570 | 1 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4571 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4572 | 1 | return $self->{'map_record_method_key'}{$method} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4575 | 0 | return $self->{'map_record_method_key'}{$method}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4578 | sub column_undef_overrides_default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4579 | 297 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
column_undef_overrides_default: called CC=4 SCAR=17.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4580 | 297 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4582 | 297 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4583 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4584 | 0 | ▶ | return $self->{'column_undef_overrides_default'} = $_[0] ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4587 | return $self->{'column_undef_overrides_default'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4588 | 297 | ▶ | if(defined $self->{'column_undef_overrides_default'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4590 | 297 | return $self->{'column_undef_overrides_default'} = ref($self)->default_column_undef_overrides_default; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4593 | 61 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4595 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||