| 1 | # the contents of this file are Copyright (c) 2009 Daniel Norman | ||||||||||||||||||||
| 2 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||
| 3 | # modify it under the terms of the GNU General Public License as | ||||||||||||||||||||
| 4 | # published by the Free Software Foundation. | ||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | package DBR::Config::ScanDB; | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 18 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 18 | ▶ | use base 'DBR::Common'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 18 | ▶ | use DBR::Config::Field; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 18 | ▶ | use DBR::Config::Schema; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 17 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||
| 14 | 17 | my( $package ) = shift; | |||||||||||||||||||
| 15 | 17 | my %params = @_; | |||||||||||||||||||
| 16 | my $self = { | ||||||||||||||||||||
| 17 | session => $params{session}, | ||||||||||||||||||||
| 18 | conf_instance => $params{conf_instance}, | ||||||||||||||||||||
| 19 | scan_instance => $params{scan_instance}, | ||||||||||||||||||||
| 20 | 17 | }; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 17 | bless( $self, $package ); | |||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 17 | ▶ | return $self->_error('session object must be specified') unless $self->{session}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | 17 | ▶ | return $self->_error('conf_instance object must be specified') unless $self->{conf_instance}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 17 | ▶ | return $self->_error('scan_instance object must be specified') unless $self->{scan_instance}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | $self->{schema_id} = $self->{scan_instance}->schema_id or | ||||||||||||||||||||
| 29 | 17 | ▶ | return $self->_error('Cannot scan an instance that has no schema'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 17 | return( $self ); | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 17 | ▶ | sub scan{ | ||||||||||||||||||
|
Subroutine
scan: called CC=8 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||
| 35 | 17 | my $self = shift; | |||||||||||||||||||
| 36 | 17 | my %params = @_; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 17 | ▶ | my $tables = $self->scan_tables() || die "failed to scan tables"; | ||||||||||||||||||
|
Condition50%1/2
$self->scan_tables || die('failed to scan tables')
MC/DC0%0/1
$self->scan_tables || die('failed to scan tables')
$self->scan_tables
Truth table50%1/2
A
A= $self->scan_tables
| |||||||||||||||||||||
| 39 | 17 | my $pkeys = $self->scan_pkeys(); # || die "failed to scan primary keys"; | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 17 | foreach my $table (@{$tables}){ | |||||||||||||||||||
| 42 | 41 | ▶ | print "Scanning $table\n" if $params{pretty}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 41 | ▶ | my $fields = $self->scan_fields($table) or return $self->_error( "failed to describe table" ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | 41 | ▶ | my $pkey = $pkeys ? $pkeys->{$table} : $self->scan_pkeys( $table ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 41 | ▶ | $self->update_table($fields,$table,$pkey) or return $self->_error("failed to update table"); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | #HACK - the scanner should load up the in-memory representation at the same time | ||||||||||||||||||||
| 51 | DBR::Config::Schema->load( | ||||||||||||||||||||
| 52 | session => $self->{session}, | ||||||||||||||||||||
| 53 | schema_id => $self->{schema_id}, | ||||||||||||||||||||
| 54 | instance => $self->{conf_instance}, | ||||||||||||||||||||
| 55 | 17 | ▶ | ) or die "Failed to reload schema"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 17 | return 1; | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 17 | ▶ | sub scan_pkeys { | ||||||||||||||||||
|
Subroutine
scan_pkeys: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||
| 62 | 17 | my $self = shift; | |||||||||||||||||||
| 63 | 17 | my $table = shift; # undef for all | |||||||||||||||||||
| 64 | #print "SCAN_PKEYS called with table=[$table]\n"; | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 17 | ▶ | my $dbh = $self->{scan_instance}->connect('dbh') || die "failed to connect to scanned db"; | ||||||||||||||||||
|
Condition50%1/2
$self->{'scan_instance'}->connect('dbh') || die('failed to connect to scanned db')
MC/DC0%0/1
$self->{'scan_instance'}->connect('dbh') || die('failed to connect to scanned db')
$self->{'scan_instance'}->connect('dbh')
Truth table50%1/2
A
A= $self->{'scan_instance'}->connect('dbh')
| |||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 17 | my $sth; | |||||||||||||||||||
| 69 | 17 | local $dbh->{PrintError} = 0; | |||||||||||||||||||
| 70 | 17 | local $^W = 0; | |||||||||||||||||||
| 71 | 17 | eval { $sth= $dbh->primary_key_info(undef,undef,$table); }; | |||||||||||||||||||
| 72 | 17 | ▶ | return $self->_error('failed call to primary_key_info') unless $sth; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 17 | my %map = (); | |||||||||||||||||||
| 75 | 17 | ▶ | while (my $row = $sth->fetchrow_hashref()) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 76 | 41 | ▶ | next unless $row->{PK_NAME} eq 'PRIMARY KEY'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 77 | 41 | ▶ | my $table = $row->{TABLE_NAME} or return $self->_error('no TABLE_NAME!'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 78 | 41 | ▶ | my $field = $row->{COLUMN_NAME} or return $self->_error('no COLUMN_NAME!'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 79 | 41 | $map{$table}->{$field} = 1; | |||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 17 | $sth->finish(); | |||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | 17 | return \%map; | |||||||||||||||||||
| 85 | } | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 17 | ▶ | sub scan_tables{ | ||||||||||||||||||
|
Subroutine
scan_tables: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||
| 88 | 17 | my $self = shift; | |||||||||||||||||||
| 89 | 17 | ▶ | my $dbh = $self->{scan_instance}->connect('dbh') || die "failed to connect to scanned db"; | ||||||||||||||||||
|
Condition50%1/2
$self->{'scan_instance'}->connect('dbh') || die('failed to connect to scanned db')
MC/DC0%0/1
$self->{'scan_instance'}->connect('dbh') || die('failed to connect to scanned db')
$self->{'scan_instance'}->connect('dbh')
Truth table50%1/2
A
A= $self->{'scan_instance'}->connect('dbh')
| |||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 17 | ▶ | return $self->_error('failed call to table_info') unless | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 92 | my $sth = $dbh->table_info; | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | 17 | my @tables; | |||||||||||||||||||
| 95 | 17 | ▶ | while (my $row = $sth->fetchrow_hashref()) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 96 | 90 | ▶ | my $name = $row->{TABLE_NAME} or return $self->_error('Table entry has no name!'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 90 | ▶ | next if ($name eq 'sqlite_sequence'); # Ugly | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | 75 | ▶ | if($row->{TABLE_TYPE} eq 'TABLE'){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 101 | 41 | push @tables, $name; | |||||||||||||||||||
| 102 | } | ||||||||||||||||||||
| 103 | } | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 17 | $sth->finish(); | |||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | 17 | return \@tables; | |||||||||||||||||||
| 108 | } | ||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | 41 | ▶ | sub scan_fields{ | ||||||||||||||||||
|
Subroutine
scan_fields: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||
| 111 | 41 | my $self = shift; | |||||||||||||||||||
| 112 | 41 | my $table = shift; | |||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | 41 | ▶ | my $dbh = $self->{scan_instance}->connect('dbh') || die "failed to connect to scanned db"; | ||||||||||||||||||
|
Condition50%1/2
$self->{'scan_instance'}->connect('dbh') || die('failed to connect to scanned db')
MC/DC0%0/1
$self->{'scan_instance'}->connect('dbh') || die('failed to connect to scanned db')
$self->{'scan_instance'}->connect('dbh')
Truth table50%1/2
A
A= $self->{'scan_instance'}->connect('dbh')
| |||||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | 41 | ▶ | return $self->_error('failed call to column_info') unless | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 117 | my $sth = $dbh->column_info( undef, undef, $table, undef ); | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | 41 | my @rows; | |||||||||||||||||||
| 120 | 41 | ▶ | while (my $row = $sth->fetchrow_hashref()) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 121 | 172 | push @rows, $row; | |||||||||||||||||||
| 122 | } | ||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | 41 | $sth->finish(); | |||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | 41 | return \@rows; | |||||||||||||||||||
| 127 | } | ||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | 41 | ▶ | sub update_table{ | ||||||||||||||||||
|
Subroutine
update_table: called CC=6 SCAR=18.9
Pod
undocumented
| |||||||||||||||||||||
| 130 | 41 | my $self = shift; | |||||||||||||||||||
| 131 | 41 | my $fields = shift; | |||||||||||||||||||
| 132 | 41 | my $name = shift; | |||||||||||||||||||
| 133 | 41 | my $pkey = shift; | |||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | 41 | ▶ | my $dbh = $self->{conf_instance}->connect || die "failed to connect to config db"; | ||||||||||||||||||
|
Condition50%1/2
$self->{'conf_instance'}->connect || die('failed to connect to config db')
MC/DC0%0/1
$self->{'conf_instance'}->connect || die('failed to connect to config db')
$self->{'conf_instance'}->connect
Truth table50%1/2
A
A= $self->{'conf_instance'}->connect
| |||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | return $self->_error('failed to select from dbr_tables') unless | ||||||||||||||||||||
| 138 | my $tables = $dbh->select( | ||||||||||||||||||||
| 139 | -table => 'dbr_tables', | ||||||||||||||||||||
| 140 | -fields => 'table_id schema_id name', | ||||||||||||||||||||
| 141 | -where => { | ||||||||||||||||||||
| 142 | 41 | ▶ | schema_id => ['d',$self->{schema_id}], | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 143 | name => $name, | ||||||||||||||||||||
| 144 | } | ||||||||||||||||||||
| 145 | ); | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | 41 | my $table = $tables->[0]; | |||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | 41 | my $table_id; | |||||||||||||||||||
| 150 | 41 | ▶ | if($table){ # update | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 151 | 0 | $table_id = $table->{table_id}; | |||||||||||||||||||
| 152 | }else{ | ||||||||||||||||||||
| 153 | return $self->_error('failed to insert into dbr_tables') unless | ||||||||||||||||||||
| 154 | $table_id = $dbh->insert( | ||||||||||||||||||||
| 155 | -table => 'dbr_tables', | ||||||||||||||||||||
| 156 | -fields => { | ||||||||||||||||||||
| 157 | 41 | ▶ | schema_id => ['d',$self->{schema_id}], | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 158 | name => $name, | ||||||||||||||||||||
| 159 | } | ||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||
| 161 | } | ||||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | 41 | ▶ | $self->update_fields($fields,$table_id,$pkey) or return $self->_error('Failed to update fields'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | 41 | return 1; | |||||||||||||||||||
| 166 | } | ||||||||||||||||||||
| 167 | |||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | 41 | ▶ | sub update_fields{ | ||||||||||||||||||
|
Subroutine
update_fields: called CC=21 SCAR=35.9
Pod
undocumented
| |||||||||||||||||||||
| 170 | 41 | my $self = shift; | |||||||||||||||||||
| 171 | 41 | my $fields = shift; | |||||||||||||||||||
| 172 | 41 | my $table_id = shift; | |||||||||||||||||||
| 173 | 41 | my $pkey_map = shift; | |||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | 41 | ▶ | my $dbh = $self->{conf_instance}->connect || die "failed to connect to config db"; | ||||||||||||||||||
|
Condition50%1/2
$self->{'conf_instance'}->connect || die('failed to connect to config db')
MC/DC0%0/1
$self->{'conf_instance'}->connect || die('failed to connect to config db')
$self->{'conf_instance'}->connect
Truth table50%1/2
A
A= $self->{'conf_instance'}->connect
| |||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | 41 | ▶ | return $self->_error('failed to select from dbr_fields') unless | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 178 | my $records = $dbh->select( | ||||||||||||||||||||
| 179 | -table => 'dbr_fields', | ||||||||||||||||||||
| 180 | -fields => 'field_id table_id name data_type is_nullable is_signed max_value', | ||||||||||||||||||||
| 181 | -where => { | ||||||||||||||||||||
| 182 | table_id => ['d',$table_id] | ||||||||||||||||||||
| 183 | } | ||||||||||||||||||||
| 184 | ); | ||||||||||||||||||||
| 185 | |||||||||||||||||||||
| 186 | 41 | my %fieldmap; | |||||||||||||||||||
| 187 | 0 | map {$fieldmap{$_->{name}} = $_} @{$records}; | |||||||||||||||||||
| 188 | |||||||||||||||||||||
| 189 | 41 | foreach my $field (@{$fields}) { | |||||||||||||||||||
| 190 | 172 | ▶ | my $name = $field->{'COLUMN_NAME'} or return $self->_error('No COLUMN_NAME is present'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 191 | 172 | ▶ | my $type = $field->{'TYPE_NAME'} or return $self->_error('No TYPE_NAME is present' ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 192 | 172 | my $size = $field->{'COLUMN_SIZE'}; | |||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | 172 | my $nullable = $field->{'NULLABLE'}; | |||||||||||||||||||
| 195 | 172 | ▶ | return $self->_error('No NULLABLE is present' ) unless defined($nullable); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 172 | ▶ | my $pkey = $field->{'mysql_is_pri_key'} || $pkey_map->{$name}; | ||||||||||||||||||
|
Condition66%2/3
$field->{'mysql_is_pri_key'} || $pkey_map->{$name}
MC/DC50%1/2
$field->{'mysql_is_pri_key'} || $pkey_map->{$name}
$field->{'mysql_is_pri_key'}
$pkey_map->{$name}
Truth table66%2/3
A || B
A= $field->{'mysql_is_pri_key'}B= $pkey_map->{$name}
| |||||||||||||||||||||
| 198 | 172 | my $extra = $field->{'mysql_type_name'}; | |||||||||||||||||||
| 199 | |||||||||||||||||||||
| 200 | 172 | my $is_signed = 0; | |||||||||||||||||||
| 201 | 172 | ▶ | if(defined $extra){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 202 | 0 | ▶ | $is_signed = ($extra =~ / unsigned/i)?0:1; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 203 | 0 | ▶ | $is_signed = 0 if $type =~ /unsigned/i; #Lame... SQLite sometimes returns the data type as 'int unsigned' | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 204 | } | ||||||||||||||||||||
| 205 | 172 | $type =~ /^\s+|\s+$/g; | |||||||||||||||||||
| 206 | 172 | ($type) = split (/\s+/,$type); | |||||||||||||||||||
| 207 | 172 | ▶ | my $typeid = DBR::Config::Field->get_type_id($type) or die( "Invalid type '$type'" ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | 172 | my $record = $fieldmap{$name}; | |||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | 172 | ▶ | my $ref = { | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$size || 0
MC/DC100%1/1
$size || 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 212 | is_nullable => ['d', $nullable ? 1:0 ], | ||||||||||||||||||||
| 213 | is_signed => ['d', $is_signed ], | ||||||||||||||||||||
| 214 | data_type => ['d', $typeid ], | ||||||||||||||||||||
| 215 | max_value => ['d', $size || 0 ], | ||||||||||||||||||||
| 216 | }; | ||||||||||||||||||||
| 217 | |||||||||||||||||||||
| 218 | 172 | ▶ | if(defined($pkey)){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 219 | 41 | ▶ | $ref->{is_pkey} = ['d', $pkey ? 1:0 ], | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 220 | } | ||||||||||||||||||||
| 221 | |||||||||||||||||||||
| 222 | 172 | ▶ | if ($record) { # update | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 223 | return $self->_error('failed to insert into dbr_tables') unless | ||||||||||||||||||||
| 224 | $dbh->update( | ||||||||||||||||||||
| 225 | -table => 'dbr_fields', | ||||||||||||||||||||
| 226 | -fields => $ref, | ||||||||||||||||||||
| 227 | 0 | ▶ | -where => { field_id => ['d',$record->{field_id}] }, | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 228 | ); | ||||||||||||||||||||
| 229 | } else { | ||||||||||||||||||||
| 230 | 172 | $ref->{name} = $name; | |||||||||||||||||||
| 231 | 172 | $ref->{table_id} = ['d', $table_id ]; | |||||||||||||||||||
| 232 | |||||||||||||||||||||
| 233 | 172 | ▶ | return $self->_error('failed to insert into dbr_tables') unless | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 234 | my $field_id = $dbh->insert( | ||||||||||||||||||||
| 235 | -table => 'dbr_fields', | ||||||||||||||||||||
| 236 | -fields => $ref, | ||||||||||||||||||||
| 237 | ); | ||||||||||||||||||||
| 238 | } | ||||||||||||||||||||
| 239 | |||||||||||||||||||||
| 240 | 172 | delete $fieldmap{$name}; | |||||||||||||||||||
| 241 | |||||||||||||||||||||
| 242 | } | ||||||||||||||||||||
| 243 | |||||||||||||||||||||
| 244 | 41 | foreach my $name (keys %fieldmap) { | |||||||||||||||||||
| 245 | 0 | my $record = $fieldmap{$name}; | |||||||||||||||||||
| 246 | |||||||||||||||||||||
| 247 | return $self->_error('failed to delete from dbr_tables') unless | ||||||||||||||||||||
| 248 | $dbh->delete( | ||||||||||||||||||||
| 249 | -table => 'dbr_fields', | ||||||||||||||||||||
| 250 | 0 | ▶ | -where => { field_id => ['d',$record->{field_id}] }, | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 251 | ); | ||||||||||||||||||||
| 252 | } | ||||||||||||||||||||
| 253 | |||||||||||||||||||||
| 254 | 41 | return 1; | |||||||||||||||||||
| 255 | } | ||||||||||||||||||||
| 256 | |||||||||||||||||||||
| 257 | 18 | 1; | |||||||||||||||||||