SQL Form and big table imports
This commit is contained in:
parent
8213036859
commit
22e621295c
2 changed files with 12 additions and 23 deletions
|
|
@ -1,4 +1,5 @@
|
|||
7.3.9
|
||||
- fix: SQL Form and big table imports
|
||||
- fix: Can't add task to project management (perlDreamer Consulting, LLC)
|
||||
- fix: Error in RSS Feed (perlDreamer Consulting, LLC)
|
||||
- rfe: Asset->get should return a copy of the properties hashref
|
||||
|
|
|
|||
|
|
@ -1376,29 +1376,17 @@ my $hasPrimaryKey = 0;
|
|||
" ");
|
||||
|
||||
# fill status fields
|
||||
$sth = $dbLink->db->read("select * from $tableName");
|
||||
while (my %row = $sth->hash) {
|
||||
my @where = ();
|
||||
foreach (@columnNames) {
|
||||
if (defined $row{$_}) {
|
||||
push(@where, $_." = ".$self->session->db->quote($row{$_}));
|
||||
} else {
|
||||
push(@where, "$_ IS NULL");
|
||||
}
|
||||
}
|
||||
my $sql =
|
||||
"update $tableName set ".
|
||||
"__recordId = ".$self->session->db->quote($self->session->id->generate).", ".
|
||||
"__creationDate = ".$self->session->db->quote(time).", ".
|
||||
"__createdBy = ".$self->session->db->quote($self->session->user->userId).", ".
|
||||
"__initDate = ".$self->session->db->quote(time).", ".
|
||||
"__userId = ".$self->session->db->quote($self->session->user->userId).", ".
|
||||
"__archived = 0, ".
|
||||
"__revision = 1 ".
|
||||
"where ".join(' and ', @where);
|
||||
$dbLink->db->write($sql);
|
||||
#print "$sql\n";
|
||||
}
|
||||
my $sql =
|
||||
"update $tableName set ".
|
||||
"__recordId = (select concat(rand(),rand())),".
|
||||
"__creationDate = ".$self->session->db->quote(time).", ".
|
||||
"__createdBy = ".$self->session->db->quote($self->session->user->userId).", ".
|
||||
"__initDate = ".$self->session->db->quote(time).", ".
|
||||
"__userId = ".$self->session->db->quote($self->session->user->userId).", ".
|
||||
"__archived = 0, ".
|
||||
"__revision = 1 ";
|
||||
$dbLink->db->write($sql);
|
||||
#print "$sql\n";
|
||||
}
|
||||
|
||||
$dbLink->db->write("alter table $tableName add primary key (__recordId, __revision)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue