/** * Devuelve una lista de ids de las oficinas registradas * @return int[] */ public function toList() { $query = "SELECT * FROM `oficinas`"; try { $datos = $this->connection->read($query); if (!$datos) { throw new Exception("no se han encontrado resultados"); } else { for ($i = 0; $i < count($datos); $i++) { $ids[$i] = $datos[$i]["ID"]; } return $ids; } } catch (Exception $exception) { throw $exception; } }
private function executeCommandInternal(IConnection $connection, Command $command) { $connection->writeCommand($command); if ($command->closesConnection()) { return $connection->disconnect(); } return $connection->readResponse($command); }
public static function writeRsToFile(IConnection $connect, $rs, $filename) { try { $fp = fopen($filename, "a+"); if ($fp) { while ($data = $connect->getRows($rs)) { $str = implode(";", $data); fwrite($fp, $str . PHP_EOL); } fclose($fp); return true; } else { throw new MyException("Error al crear el fichero"); } } catch (MyException $ex) { return false; } }
function IStatement(&$connection) { if (IConnection::validClass($connection)) { $this->connection =& $connection; } }