Пример #1
0
 /** 
  *Function that updates images informations
  *@params int $psIdImage, int $psIdImage, string $coloranalysis, string $md5Digest,
  *string $imgPath
  */
 public function updateImageInformation($psIdProduc, $psIdImage, $colorAnalysis, $md5Digest, $imgPath)
 {
     $productExist = $this->_ifProductExist($psIdProduc);
     $imageExist = $this->ifImageExist($psIdImage);
     if (!$productExist) {
         $this->logger->postMessage("Il prodotto {$psIdProduc} non esiste", "WARNING");
         return;
     }
     if ($imageExist === true) {
         $oldPath = $this->getImageInformation($psIdImage);
         $connection = connectionServer();
         $sql = "UPDATE ps_tmp_image SET color_analysis ='" . $colorAnalysis . "' ,md5_digest = '" . $md5Digest . "' ,                     new_path = '" . $imgPath . "',old_path = '" . $oldPath["newPath"] . "', status = '0' WHERE ( ps_id =  \n                '" . $psIdImage . "')";
         $res = mysql_query($sql, $connection);
         if ($res) {
             //se l'inserimento è stato completato
         } else {
             $errno = mysql_errno($connection);
             $error = mysql_error($connection);
             switch ($errno) {
                 case 1062:
                     throw new HandleOperationsException($error);
                     break;
                 default:
                     throw MySQLException($error, $errno);
                     break;
             }
         }
     }
     closeConnectionServer($connection);
 }
Пример #2
0
 public static function TestQuery($sSql)
 {
     try {
         $oResult = self::$m_oMysqli->query($sSql);
     } catch (mysqli_sql_exception $e) {
         MySQLException('Failed to issue SQL query', array('query' => $sSql, $e));
     }
     if ($oResult === false) {
         throw new MySQLException('Failed to issue SQL query', array('query' => $sSql));
     }
     if (is_object($oResult)) {
         $oResult->free();
     }
     return '';
 }