Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.QueryDir.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Folder managing
8  *
9  * @author Anakeen
10  * @version $Id: Class.QueryDir.php,v 1.25 2007/05/24 15:01:45 eric Exp $
11  * @package FDL
12  */
13 /**
14  */
15 
16 include_once ("Class.DbObj.php");
17 include_once ("Class.QueryDb.php");
18 include_once ("Class.Log.php");
19 /**
20  * Folder managing
21  * @package FDL
22  *
23  */
24 class QueryDir extends DbObj
25 {
26  public $fields = array(
27  "dirid",
28  "query",
29  "childid",
30  "qtype",
31  "fromid",
32  "doctype"
33  );
34  /*public $sup_fields= array("fromid",
35  "doctype"); */
36  // not be in fieldsset by trigger
37  public $id_fields = array(
38  "dirid",
39  "childid"
40  );
41 
42  public $dirid;
43  public $query;
44  public $childid;
45  public $fromid;
46  public $qtype;
47  public $doctype;
48  var $dbtable = "fld";
49 
50  var $order_by = "dirid";
51 
52  var $fulltextfields = array(
53  ""
54  );
55 
56  var $sqlcreate = "
57 create table fld (
58  dirid int not null,
59  query text,
60  childid int,
61  qtype char,
62  fromid int,
63  doctype char
64  );
65 create index fld_iqd on fld(qtype,dirid);
66 create index fld_iqc on fld(qtype,childid);
67 create unique index fld_u on fld(qtype,dirid,childid);
68 create sequence seq_id_fld start 100;
69 CREATE TRIGGER tfldfrom before insert on fld FOR EACH ROW execute procedure fromfld();";
70  #CREATE TRIGGER tfldrel after insert or update or delete on fld FOR EACH ROW execute procedure relfld();";
71  function PreInsert()
72  {
73  // test if not already exist
74  if ($this->qtype != "M") {
75  $this->delete(false); // delete before insert
76 
77  }
78  }
79  function Exists()
80  {
81  // test if already exist
82  if ($this->qtype != "M") {
83  $err = $this->exec_query(sprintf("select * from fld where dirid=%s and childid=%s", $this->dirid, $this->childid));
84  if ($this->numrows() > 0) {
85  return true; // just to say it is not a real error
86 
87  }
88  }
89  return false;
90  }
91 }
92 ?>
exec_query($sql, $lvl=0, $prepare=false)
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen