Core  3.2
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  * @package FDL
5 */
6 /**
7  * Virtual groups
8  *
9  * @author Anakeen
10  * @version $Id: Class.VGroup.php,v 1.2 2004/02/12 10:32:09 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 define("STARTIDVGROUP", 1000000);
20 /**
21  * Virtual groups
22  * @package FDL
23  *
24  */
25 class VGroup extends DbObj
26 {
27  var $fields = array(
28  "id",
29  "num"
30  );
31 
32  var $id_fields = array(
33  "id"
34  );
35 
36  public $id;
37  public $num;
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  function PreInsert()
48  {
49  // compute new id
50  if ($this->num == "") {
51  $res = pg_query($this->dbid, "select nextval ('seq_id_docvgroup')");
52  $arr = pg_fetch_array($res, 0);
53  $this->num = $arr[0]; // not a number must be alphanumeric begin with letter
54 
55  }
56  }
57 }
58 ?>
← centre documentaire © anakeen