|
|
@ -69,8 +69,7 @@ sub get_fieldnames {
|
|
|
|
$_;
|
|
|
|
$_;
|
|
|
|
} @$tabular_fields ];
|
|
|
|
} @$tabular_fields ];
|
|
|
|
$expected_fieldnames = [ @$fieldnames ];
|
|
|
|
$expected_fieldnames = [ @$fieldnames ];
|
|
|
|
push(@$expected_fieldnames,'domain') unless grep { 'domain' eq $_; } @$expected_fieldnames;
|
|
|
|
push(@$expected_fieldnames,'uuid') unless grep { 'uuid' eq $_; } @$expected_fieldnames;
|
|
|
|
push(@$expected_fieldnames,'username') unless grep { 'username' eq $_; } @$expected_fieldnames;
|
|
|
|
|
|
|
|
push(@$expected_fieldnames,'delta');
|
|
|
|
push(@$expected_fieldnames,'delta');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $fieldnames unless $expected;
|
|
|
|
return $fieldnames unless $expected;
|
|
|
@ -78,10 +77,9 @@ sub get_fieldnames {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# table creation:
|
|
|
|
# table creation:
|
|
|
|
my $primarykey_fieldnames = [ 'domain', 'username' ];
|
|
|
|
my $primarykey_fieldnames = [ 'uuid' ];
|
|
|
|
my $indexes = {
|
|
|
|
my $indexes = {
|
|
|
|
#$tablename . '_number' => [ 'number(32)' ],
|
|
|
|
#$tablename . '_username_domain' => [ 'username', 'domain' ],
|
|
|
|
#$tablename . '_rownum' => [ 'rownum(11)' ],
|
|
|
|
|
|
|
|
$tablename . '_delta' => [ 'delta(7)' ],
|
|
|
|
$tablename . '_delta' => [ 'delta(7)' ],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
#my $fixtable_statements = [];
|
|
|
|
#my $fixtable_statements = [];
|
|
|
@ -156,7 +154,7 @@ sub findby_domainusername {
|
|
|
|
|
|
|
|
|
|
|
|
sub update_delta {
|
|
|
|
sub update_delta {
|
|
|
|
|
|
|
|
|
|
|
|
my ($domain,$username,$delta) = @_;
|
|
|
|
my ($uuid,$delta) = @_;
|
|
|
|
|
|
|
|
|
|
|
|
check_table();
|
|
|
|
check_table();
|
|
|
|
my $db = &$get_db();
|
|
|
|
my $db = &$get_db();
|
|
|
@ -165,11 +163,10 @@ sub update_delta {
|
|
|
|
my $stmt = 'UPDATE ' . $table . ' SET delta = ?';
|
|
|
|
my $stmt = 'UPDATE ' . $table . ' SET delta = ?';
|
|
|
|
my @params = ();
|
|
|
|
my @params = ();
|
|
|
|
push(@params,$delta);
|
|
|
|
push(@params,$delta);
|
|
|
|
if (defined $domain or defined $username) {
|
|
|
|
if (defined $uuid) {
|
|
|
|
$stmt .= ' WHERE ' .
|
|
|
|
$stmt .= ' WHERE ' .
|
|
|
|
$db->columnidentifier('domain') . ' = ?' .
|
|
|
|
$db->columnidentifier('uuid') . ' = ?';
|
|
|
|
' AND ' . $db->columnidentifier('username') . ' = ?';
|
|
|
|
push(@params, $uuid);
|
|
|
|
push(@params, $domain, $username);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $db->db_do($stmt,@params);
|
|
|
|
return $db->db_do($stmt,@params);
|
|
|
@ -282,8 +279,7 @@ sub getupsertstatement {
|
|
|
|
foreach my $fieldname (@{get_fieldnames(1)}) {
|
|
|
|
foreach my $fieldname (@{get_fieldnames(1)}) {
|
|
|
|
if ('delta' eq $fieldname) {
|
|
|
|
if ('delta' eq $fieldname) {
|
|
|
|
my $stmt = 'SELECT \'' . $updated_delta . '\' FROM ' . $table . ' WHERE ' .
|
|
|
|
my $stmt = 'SELECT \'' . $updated_delta . '\' FROM ' . $table . ' WHERE ' .
|
|
|
|
$db->columnidentifier('domain') . ' = ?' .
|
|
|
|
$db->columnidentifier('uuid') . ' = ?';
|
|
|
|
' AND ' . $db->columnidentifier('username') . ' = ?';
|
|
|
|
|
|
|
|
push(@values,'COALESCE((' . $stmt . '), \'' . $added_delta . '\')');
|
|
|
|
push(@values,'COALESCE((' . $stmt . '), \'' . $added_delta . '\')');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
push(@values,'?');
|
|
|
|
push(@values,'?');
|
|
|
|