function changeQueryIntoJSON($nameJSON, $structure, $connection, $sql, $params, $operation, $pdo) { $result = generalQuery($connection, $sql, $params, $operation, $pdo); $restructured = $operation === 0 && rightResult($result) ? restructureArray($result, $structure) : $result; return changeArrayIntoJSON($nameJSON, $restructured); }
function changeLineIntoArray($line, $spl, $structure) { $splArray = array(); $trimLine = trim($line); if ($trimLine !== '') { $row = explode($spl, $trimLine); $count = 1; for ($idx = 0; $idx < count($row); $idx++) { $element = trim($row[$idx]); if ($element !== '') { $splArray[] = array($count++, $element); } } } if (count($splArray) && count($structure)) { $splArray = restructureArray($splArray, $structure); } return $splArray; }
function restructureQuery($structure, $connection, $sql, $params, $operation, $pdo) { $result = generalQuery($connection, $sql, $params, $operation, $pdo); $restructured = $operation === 0 && rightResult($result) ? restructureArray($result, $structure) : $result; return $restructured; }