AC_4897, AC_4898, AC_4899: Multifile uploader fixes.
[acontent.git] / docs / include / classes / DAO / MyownPatchesDependentDAO.class.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
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 /************************************************************************/
12
13 /**
14  * DAO for "myown_patches_dependent" table
15  * @access      public
16  * @author      Cindy Qi Li
17  * @package     DAO
18  */
19
20 if (!defined('TR_INCLUDE_PATH')) exit;
21
22 require_once(TR_INCLUDE_PATH. 'classes/DAO/DAO.class.php');
23
24 class MyownPatchesDependentDAO extends DAO {
25
26         /**
27          * Create new patch
28          * @access  public
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
32          * @author  Cindy Qi Li
33          */
34         public function Create($myown_patch_id, $dependent_patch_id)
35         {
36                 $sql = "INSERT INTO ".TABLE_PREFIX."myown_patches_dependent 
37                (myown_patch_id, 
38                 dependent_patch_id)
39                 VALUES ('".$myown_patch_id."', 
40                         '".$dependent_patch_id."')";
41                 
42                 if (!$this->execute($sql))
43                 {
44                         $msg->addError('DB_NOT_UPDATED');
45                         return false;
46                 }
47                 else
48                 {
49                         return mysql_insert_id();
50                 }
51         }
52
53         /**
54          * Delete rows by given patch id
55          * @access  public
56          * @param   patchID
57          * @return  true, if successful
58          *          false and add error into global var $msg, if unsuccessful
59          * @author  Cindy Qi Li
60          */
61         public function DeleteByPatchID($patchID)
62         {
63                 $sql = "DELETE FROM ".TABLE_PREFIX."myown_patches_dependent
64                          WHERE myown_patch_id = ".$patchID;
65
66                 return $this->execute($sql);
67         }
68
69         /**
70          * Return the patch dependent info with the given patch id
71          * @access  public
72          * @param   $patchID
73          * @return  patch row
74          * @author  Cindy Qi Li
75          */
76         public function getByPatchID($patchID)
77         {
78                 $sql = "SELECT * from ".TABLE_PREFIX."myown_patches_dependent
79                          WHERE myown_patch_id=". $patchID." 
80                          ORDER BY dependent_patch_id";
81                 
82                 return $this->execute($sql);
83         }
84
85 }
86 ?>