Exemple #1
0
 /**
  * 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;
     }
 }
Exemple #2
0
 private function executeCommandInternal(IConnection $connection, Command $command)
 {
     $connection->writeCommand($command);
     if ($command->closesConnection()) {
         return $connection->disconnect();
     }
     return $connection->readResponse($command);
 }
Exemple #3
0
 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;
     }
 }
Exemple #4
0
 function IStatement(&$connection)
 {
     if (IConnection::validClass($connection)) {
         $this->connection =& $connection;
     }
 }