Plugins  LAST
 All Data Structures Files Functions Variables Pages
Public Member Functions
impdol_operation_transfer_sql Class Reference
Inheritance diagram for impdol_operation_transfer_sql:
Inheritance graph
Collaboration diagram for impdol_operation_transfer_sql:
Collaboration graph

Public Member Functions

 __construct ($p_id=-1)
 
 getp ($p_string)
 
 setp ($p_string, $p_value)
 
 insert ()
 
 delete ()
 
 update ()
 
 load ()
 
 get_info ()
 
 verify ()
 
 from_array ($p_array)
 
 next ($ret, $i)
 

Detailed Description

Definition at line 355 of file class_sql_impdol.php.

Constructor & Destructor Documentation

impdol_operation_transfer_sql::__construct (   $p_id = -1)

Definition at line 357 of file class_sql_impdol.php.

References $cn, name, and table.

358  {
359  $this->table = "impdol.operation_transfer";
360  $this->primary_key = "ot_id";
361 
362  $this->name=array(
363  "id"=>"ot_id",
364  "j_id"=>"j_id",
365  "o_id"=>"o_id"
366  );
367 
368  $this->type = array(
369  "ot_id"=>'numeric',
370  "j_id"=>'numeric',
371  "o_id"=>'numeric',
372  );
373 
374  $this->default = array(
375  "i_id" => "auto"
376  );
377  $this->date_format = "DD.MM.YYYY";
378  global $cn;
379 
380  parent::__construct($cn,$p_id);
381  }
$categorie_appel table
$categorie_appel name
global $cn

Member Function Documentation

sql_impdol::delete ( )
inherited

Definition at line 99 of file class_sql_impdol.php.

References $sql, and table.

100  {
101  $pk=$this->primary_key;
102  $sql = " delete from " . $this->table . " where " . $this->primary_key . "=" . sql_string($this->$pk);
103  $this->cn->exec_sql($sql);
104  }
$categorie_appel table
$sql
sql_impdol::from_array (   $p_array)
inherited

Definition at line 180 of file class_sql_impdol.php.

References $key, and name.

Referenced by sql_impdol\next().

181  {
182  foreach ($this->name as $key=>$value)
183  {
184  if ( isset ($p_array[$value]))
185  {
186  $this->$value=$p_array[$value];
187  }
188  }
189  }
$key
$categorie_appel name
sql_impdol::get_info ( )
inherited

Definition at line 168 of file class_sql_impdol.php.

169  {
170  return var_export($this, true);
171  }
sql_impdol::getp (   $p_string)
inherited

Definition at line 45 of file class_sql_impdol.php.

References name.

46  {
47  if (array_key_exists( $p_string,$this->name))
48  {
49  $idx = $this->name[$p_string];
50  return $this->$idx;
51  }
52  else
53  throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur attribut inexistant '.$p_string);
54  }
$categorie_appel name
sql_impdol::insert ( )
inherited

Definition at line 67 of file class_sql_impdol.php.

References $array, $key, $sql, name, table, and sql_impdol\verify().

68  {
69  $this->verify();
70  $sql = "insert into " . $this->table . " ( ";
71  $sep = "";
72  $par = "";
73  $idx = 1;
74  $array = array();
75  foreach ($this->name as $key=>$value)
76  {
77  if (isset($this->default[$value]) && $this->default[$value] == "auto" && $this->$value ==null )
78  continue;
79  if ( $value==$this->primary_key && $this->$value == -1 ) continue;
80  $sql.=$sep.$value;
81  switch ($this->type[$value])
82  {
83  case "date":
84  $par .=$sep. 'to_date($' . $idx . ",'" . $this->date_format . "')" ;
85  break;
86  default:
87  $par .= $sep."$" . $idx ;
88  }
89 
90  $array[] = $this->$value;
91  $sep = ",";
92  $idx++;
93  }
94  $sql.=") values (" . $par . ") returning " . $this->primary_key;
95  $pk=$this->primary_key;
96  $this->$pk = $this->cn->get_value($sql, $array);
97  }
if(isset($_POST['remove'])) $array
$key
$categorie_appel table
$categorie_appel name
$sql
sql_impdol::load ( )
inherited

Definition at line 136 of file class_sql_impdol.php.

References $key, $sql, and name.

Referenced by sql_impdol\__construct().

137  {
138  $sql = " select ";
139  $sep="";$par="";
140 
141  foreach ($this->name as $key)
142  {
143 
144  switch ($this->type[$key])
145  {
146  case "date":
147  $sql .= $sep.'to_char(' . $key . ",'" . $this->date_format . "') as ".$key ;
148  break;
149  default:
150  $sql.=$sep.$key ;
151  }
152  $sep = ",";
153  }
154  $pk=$this->primary_key;
155  $sql.=" from ".$this->table;
156  $sql.=" where " . $this->primary_key . " = " . $this->$pk;
157  $result = $this->cn->get_array($sql);
158  if ($this->cn->count() == 0 ) {
159  $this->$pk=-1;
160  return;
161  }
162 
163  foreach ($result[0] as $key=>$value) {
164  $this->$key=$value;
165  }
166  }
$key
$categorie_appel name
$sql
sql_impdol::next (   $ret,
  $i 
)
inherited

Definition at line 190 of file class_sql_impdol.php.

References $array, $cn, $ret, and sql_impdol\from_array().

190  {
191  global $cn;
192  $array=$this->cn->fetch_array($ret,$i);
193  $this->from_array($array);
194  }
$ret
from_array($p_array)
if(isset($_POST['remove'])) $array
global $cn
sql_impdol::setp (   $p_string,
  $p_value 
)
inherited

Definition at line 56 of file class_sql_impdol.php.

References name.

57  {
58  if (array_key_exists( $p_string,$this->name))
59  {
60  $idx = $this->name[$p_string];
61  $this->$idx = $p_value;
62  }
63  else
64  throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur attribut inexistant '.$p_string);
65  }
$categorie_appel name
sql_impdol::update ( )
inherited

Definition at line 106 of file class_sql_impdol.php.

References $array, $key, $sql, name, table, and sql_impdol\verify().

107  {
108  $this->verify();
109  $pk=$this->primary_key;
110  $sql = "update " . $this->table . " ";
111  $sep = "";
112  $idx = 1;
113  $array = array();
114  $set=" set ";
115  foreach ($this->name as $key=>$value)
116  {
117  if (isset($this->default[$value]) && $this->default[$value] == "auto" )
118  continue;
119  switch ($this->type[$value])
120  {
121  case "date":
122  $par =$value. '=to_date($' . $idx . ",'" . $this->date_format . "')" ;
123  break;
124  default:
125  $par = $value."= $" . $idx ;
126  }
127  $sql.=$sep." $set " . $par ;
128  $array[] = $this->$value;
129  $sep = ",";$set="";$idx++;
130  }
131  $sql.=" where " . $this->primary_key . " =" . $this->$pk;
132  $this->cn->exec_sql($sql, $array);
133 
134  }
if(isset($_POST['remove'])) $array
$key
$categorie_appel table
$categorie_appel name
$sql
sql_impdol::verify ( )
inherited

Definition at line 173 of file class_sql_impdol.php.

References $key, and name.

Referenced by sql_impdol\insert(), and sql_impdol\update().

174  {
175  foreach($this->name as $key){
176  if ( trim($this->$key)=='') $this->$key=null;
177  }
178  return 0;
179  }
$key
$categorie_appel name

The documentation for this class was generated from the following file: