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