function deleteRecursive($ids) { if (count($ids) > 0) { $db = new RecordSet($this->dbConnectionInfo, false, true); $toDelete = array(); $idsS = implode(", ", $ids); $db->open("SELECT commentId FROM comments WHERE referedComment in (" . $idsS . ");"); while ($db->MoveNext()) { $toDelete[] = $db->Field("commentId"); } $query = "DELETE FROM comments WHERE commentId in (" . $idsS . ");"; $toReturn = $db->Run($query); $db->close(); if (count($toDelete) > 0) { $this->deleteRecursive($toDelete); } } }
/** * Delete specified users * * @param array ids to be deleted */ function delete($ids) { if (count($ids) > 0) { $db = new RecordSet($this->dbConnectionInfo, false, true); $query = "DELETE FROM users WHERE userId IN (" . $ids . ");"; $toReturn = $db->Run($query); $db->close(); } }
function installProduct($dbConnectionInfo) { global $productId, $productVersion; try { $db = new RecordSet($dbConnectionInfo, false, true); $db->Run("DELETE FROM webhelp WHERE parameter='path' AND product='" . $productId . "' AND version='" . $productVersion . "';"); $db->Run("DELETE FROM webhelp WHERE parameter='installDate' AND product='" . $productId . "' AND version='" . $productVersion . "';"); $db->Run("DELETE FROM webhelp WHERE parameter='dir' AND product='" . $productId . "' AND version='" . $productVersion . "';"); $db->Run("DELETE FROM webhelp WHERE parameter='name' AND product='" . $productId . "' AND version='" . $productVersion . "';"); $db->run("INSERT INTO `webhelp` (`parameter`, `value`, `product`, `version`) VALUES\n\t\t\t\t\t\t('installDate','" . date('YmdHis') . "','" . $productId . "','" . $productVersion . "'),\n\t\t\t\t\t\t\t('path','" . addslashes(Utils::getParam($_POST, 'baseUrl')) . "','" . $productId . "','" . $productVersion . "'),\n\t\t\t\t\t\t\t('dir','" . addslashes(dirname(dirname(__FILE__))) . "','" . $productId . "','" . $productVersion . "'),\n\t\t\t\t\t\t\t('name','" . addslashes(Utils::getParam($_POST, 'productName')) . "','" . $productId . "','" . $productVersion . "')\n\t\t\t\t\t\t\t;"); $db->Close(); } catch (Exception $e) { error_log("Exception installing product " . $productId . " version " . $productVersion . " details: " . $e->getMessage()); echo "Exception installing product " . $productId . " version " . $productVersion . " details: " . $e->getMessage(); throw $e; } }