my %query_results;
my $json_obj = JSON::PP->new->allow_nonref;
if (index($dbhandle,'SQL Error:') eq -1)
{
my $sth = '';
$sth = $dbhandle->prepare($sqlQuery);
$sth->execute;
my $json_obj = JSON::PP->new->allow_nonref;
my $numberOfRows = $sth->rows();
if($numberOfRows == 0)
{
$query_results{addressExists} = "0";
$query_results{CIDNumber} = $customerID;
$query_results{addressType} = $addressType;
}
elsif($numberOfRows == 1)
{
$query_results{addressExists} = "1";
$query_results{addressType} = $addressType;
$query_results{CIDNumber} = $customerID;
}
else
{
$query_results{addressExists} = "-1";
$query_results{addressType} = $addressType;
$query_results{CIDNumber} = $customerID;
}
#new line of code
#return $json_obj->encode(\%query_results);
return $json_obj->pretty->encode(\%query_results);
No comments:
Post a Comment