Get rid of buildDataTableStructure.

This commit is contained in:
Colin Kuskie 2008-03-24 16:13:24 +00:00
parent a6cf090545
commit 3f5d947282
4 changed files with 28 additions and 26 deletions

View file

@ -268,7 +268,7 @@ sub buildDataTableStructure {
}
$hash{records} = \@array;
$hash{totalRecords} = $self->quickScalar('select found_rows()') + 0; ##Convert to numeric
$hash{recordsReturned} = $sth->rows();
$hash{recordsReturned} = $sth->rows()+0;
$sth->finish;
return %hash;
}

View file

@ -366,10 +366,19 @@ sub www_getTaxesAsJson {
}
push(@placeholders, $startIndex, $numberOfResults);
$sql .= ' order by country desc limit ?,?';
my %results = $db->buildDataTableStructure($sql, \@placeholders);
$results{'startIndex'} = $startIndex;
$results{'sort'} = undef;
$results{'dir'} = "desc";
my %results = ();
my @records = ();
my $sth = $db->read($sql, \@placeholders);
while (my $record = $sth->hashRef) {
push(@records,$record);
}
$results{'recordsReturned'} = $sth->rows()+0;
$sth->finish;
$results{'records'} = \@records;
$results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric
$results{'startIndex'} = $startIndex;
$results{'sort'} = undef;
$results{'dir'} = "desc";
$session->http->setMimeType('text/json');
return JSON::to_json(\%results);
}

View file

@ -432,10 +432,19 @@ sub www_getTransactionsAsJson {
}
push(@placeholders, $startIndex, $numberOfResults);
$sql .= ' order by dateOfPurchase desc limit ?,?';
my %results = $db->buildDataTableStructure($sql, \@placeholders);
$results{'startIndex'} = $startIndex;
$results{'sort'} = undef;
$results{'dir'} = "desc";
my %results = ();
my @records = ();
my $sth = $db->read($sql, \@placeholders);
while (my $record = $sth->hashRef) {
push(@records,$record);
}
$results{'recordsReturned'} = $sth->rows()+0;
$sth->finish;
$results{'totalRecords'} = $db->quickScalar('select found_rows()') + 0; ##Convert to numeric
$results{'records'} = \@records;
$results{'startIndex'} = $startIndex;
$results{'sort'} = undef;
$results{'dir'} = "desc";
$session->http->setMimeType('text/json');
return JSON::to_json(\%results);
}