Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.VGroup.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  * Virtual groups
9  *
10  * @author Anakeen 2004
11  * @version $Id: Class.VGroup.php,v 1.2 2004/02/12 10:32:09 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 define("STARTIDVGROUP", 1000000);
22 /**
23  * Virtual groups
24  * @package FDL
25  *
26  */
27 class VGroup extends DbObj
28 {
29  var $fields = array(
30  "id",
31  "num"
32  );
33 
34  var $id_fields = array(
35  "id"
36  );
37 
38  var $dbtable = "vgroup";
39 
40  var $order_by = "id";
41 
42  var $sqlcreate = "
43 create table vgroup ( id text primary key,
44  num int not null);
45 create sequence seq_id_docvgroup start 1000000";
46 
47  var $isCacheble = false;
48 
49  function PreInsert()
50  {
51  // compute new id
52  if ($this->num == "") {
53  $res = pg_exec($this->dbid, "select nextval ('seq_id_docvgroup')");
54  $arr = pg_fetch_array($res, 0);
55  $this->num = $arr[0]; // not a number must be alphanumeric begin with letter
56 
57  }
58  }
59 }
60 ?>
← centre documentaire © anakeen - published under CC License - Dynacase