Revision 584
- Date:
- 2016/08/29 12:39:41
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/core/lib/Contenido/Project.pm
192 192 my $new_pid; 193 193 194 194 if (ref $data eq "HASH") { 195 if (defined $key) { 196 $insert->execute($pid, $key, undef, "HASH"); 197 $new_pid = $local_keeper->TSQL->selectrow_array("SELECT currval('documents_id_seq')"); 198 } 195 if (defined $key) { 196 $insert->execute($pid, $DBD::Pg::VERSION >= '3' ? Encode::decode( 'utf-8', $key) : $key, undef, "HASH"); 197 $new_pid = $local_keeper->TSQL->selectrow_array("SELECT currval('documents_id_seq')"); 198 } 199 199 200 foreach my $new_key (keys %$data) { 201 store_recursive($new_pid, $new_key, $data->{$new_key}, $insert, $local_keeper); 202 } 200 foreach my $new_key (keys %$data) { 201 store_recursive($new_pid, $new_key, $data->{$new_key}, $insert, $local_keeper); 202 } 203 203 } elsif (ref $data eq "ARRAY") { 204 if (defined $key) { 205 $insert->execute($pid, $key, undef, "ARRAY"); 206 $new_pid = $local_keeper->TSQL->selectrow_array("SELECT currval('documents_id_seq')"); 207 } 204 if (defined $key) { 205 $insert->execute($pid, $DBD::Pg::VERSION >= '3' ? Encode::decode( 'utf-8', $key) : $key, undef, "ARRAY"); 206 $new_pid = $local_keeper->TSQL->selectrow_array("SELECT currval('documents_id_seq')"); 207 } 208 208 209 foreach my $new_key (0 .. $#$data) { 210 store_recursive($new_pid, $new_key, $data->[$new_key], $insert, $local_keeper); 211 } 209 foreach my $new_key (0 .. $#$data) { 210 store_recursive($new_pid, $new_key, $data->[$new_key], $insert, $local_keeper); 211 } 212 212 } else { 213 $insert->execute($pid, $key, $data, "SCALAR") || return $local_keeper->t_abort(); 213 $insert->execute($pid, 214 $DBD::Pg::VERSION >= '3' ? Encode::decode( 'utf-8', $key) : $key, 215 $DBD::Pg::VERSION >= '3' ? Encode::decode( 'utf-8', $data) : $data, 216 "SCALAR") || return $local_keeper->t_abort(); 214 217 } 215 218 } 216 219