2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
14 * DAO for "myown_patches_dependent" table
20 if (!defined('TR_INCLUDE_PATH')) exit;
22 require_once(TR_INCLUDE_PATH. 'classes/DAO/DAO.class.php');
24 class MyownPatchesDependentDAO extends DAO {
29 * @param myown_patch_id, dependent_patch_id
30 * @return myown_patches_dependent_id, if successful
31 * false and add error into global var $msg, if unsuccessful
34 public function Create($myown_patch_id, $dependent_patch_id)
36 $sql = "INSERT INTO ".TABLE_PREFIX."myown_patches_dependent
39 VALUES ('".$myown_patch_id."',
40 '".$dependent_patch_id."')";
42 if (!$this->execute($sql))
44 $msg->addError('DB_NOT_UPDATED');
49 return mysql_insert_id();
54 * Delete rows by given patch id
57 * @return true, if successful
58 * false and add error into global var $msg, if unsuccessful
61 public function DeleteByPatchID($patchID)
63 $sql = "DELETE FROM ".TABLE_PREFIX."myown_patches_dependent
64 WHERE myown_patch_id = ".$patchID;
66 return $this->execute($sql);
70 * Return the patch dependent info with the given patch id
76 public function getByPatchID($patchID)
78 $sql = "SELECT * from ".TABLE_PREFIX."myown_patches_dependent
79 WHERE myown_patch_id=". $patchID."
80 ORDER BY dependent_patch_id";
82 return $this->execute($sql);