|
noalyss
Version-6.7.2
|
Manage the table public.jrn_def. More...
Public Member Functions | |
| __construct (&$p_cn, $p_id=-1) | |
| delete () | |
| get_info () | |
| get_object ($p_ret, $idx) | |
| get_seek return the next object, the return of the query must have all the column of the object | |
| get_parameter ($p_string) | |
| insert ($p_array=null) | |
| load () | |
| load a object | |
| save ($p_string='') | |
| seek ($cond='', $p_array=null) | |
| retrieve array of object thanks a condition | |
| set_parameter ($p_string, $p_value) | |
| update ($p_string='') | |
| verify_sql () | |
Static Public Member Functions | |
| static | test_me () |
| Unit test for the class. | |
Protected Attributes | |
| $variable | |
Manage the table public.jrn_def.
Definition at line 37 of file class_jrn_def_sql.php.
| Jrn_Def_sql::__construct | ( | &$ | p_cn, |
| $ | p_id = -1 |
||
| ) |
Definition at line 60 of file class_jrn_def_sql.php.
Definition at line 102 of file class_jrn_def_sql.php.
{
return var_export($this, true);
}
| Jrn_Def_sql::get_object | ( | $ | p_ret, |
| $ | idx | ||
| ) |
get_seek return the next object, the return of the query must have all the column of the object
| $p_ret | is the return value of an exec_sql |
| $idx | is the index |
Definition at line 182 of file class_jrn_def_sql.php.
References $array, $idx, $value, db, and Database\fetch_array().
{
// map each row in a object
$oobj = new Jrn_Def_sql($this->db);
$array = Database::fetch_array($p_ret, $idx);
foreach ($array as $idx => $value)
{
$oobj->$idx = $value;
}
return $oobj;
}
| Jrn_Def_sql::get_parameter | ( | $ | p_string | ) |
Definition at line 80 of file class_jrn_def_sql.php.
References $idx.
| Jrn_Def_sql::insert | ( | $ | p_array = null | ) |
Definition at line 194 of file class_jrn_def_sql.php.
References $sql, db, and verify_sql().
Referenced by save().
{
if ($this->verify_sql() != 0)
return;
if ($this->jrn_def_id == -1)
{
/* please adapt */
$sql = "insert into public.jrn_def(jrn_def_name
,jrn_def_class_deb
,jrn_def_class_cred
,jrn_def_fiche_deb
,jrn_def_fiche_cred
,jrn_deb_max_line
,jrn_cred_max_line
,jrn_def_ech
,jrn_def_ech_lib
,jrn_def_type
,jrn_def_code
,jrn_def_pj_pref
,jrn_def_bank
,jrn_def_num_op
,jrn_def_description
) values ($1
,$2
,$3
,$4
,$5
,$6
,$7
,$8
,$9
,$10
,$11
,$12
,$13
,$14
,$15
) returning jrn_def_id";
$this->jrn_def_id = $this->db->get_value(
$sql, array($this->jrn_def_name
, $this->jrn_def_class_deb
, $this->jrn_def_class_cred
, $this->jrn_def_fiche_deb
, $this->jrn_def_fiche_cred
, $this->jrn_deb_max_line
, $this->jrn_cred_max_line
, $this->jrn_def_ech
, $this->jrn_def_ech_lib
, $this->jrn_def_type
, $this->jrn_def_code
, $this->jrn_def_pj_pref
, $this->jrn_def_bank
, $this->jrn_def_num_op
, strip_tags($this->jrn_def_description)
)
);
}
else
{
$sql = "insert into public.jrn_def(jrn_def_name
,jrn_def_class_deb
,jrn_def_class_cred
,jrn_def_fiche_deb
,jrn_def_fiche_cred
,jrn_deb_max_line
,jrn_cred_max_line
,jrn_def_ech
,jrn_def_ech_lib
,jrn_def_type
,jrn_def_code
,jrn_def_pj_pref
,jrn_def_bank
,jrn_def_num_op
,jrn_def_id
,jrn_def_description) values ($1
,$2
,$3
,$4
,$5
,$6
,$7
,$8
,$9
,$10
,$11
,$12
,$13
,$14
,$15
,$16
) returning jrn_def_id";
$this->jrn_def_id = $this->db->get_value(
$sql, array($this->jrn_def_name
, $this->jrn_def_class_deb
, $this->jrn_def_class_cred
, $this->jrn_def_fiche_deb
, $this->jrn_def_fiche_cred
, $this->jrn_deb_max_line
, $this->jrn_cred_max_line
, $this->jrn_def_ech
, $this->jrn_def_ech_lib
, $this->jrn_def_type
, $this->jrn_def_code
, $this->jrn_def_pj_pref
, $this->jrn_def_bank
, $this->jrn_def_num_op
, $this->jrn_def_id
, strip_tags($this->jrn_def_description))
);
}
}
load a object
Definition at line 353 of file class_jrn_def_sql.php.
References $idx, $res, $sql, $value, and db.
Referenced by __construct().
{
$sql = "select jrn_def_name
,jrn_def_class_deb
,jrn_def_class_cred
,jrn_def_fiche_deb
,jrn_def_fiche_cred
,jrn_deb_max_line
,jrn_cred_max_line
,jrn_def_ech
,jrn_def_ech_lib
,jrn_def_type
,jrn_def_code
,jrn_def_pj_pref
,jrn_def_bank
,jrn_def_num_op
,jrn_def_description
from public.jrn_def where jrn_def_id=$1";
/* please adapt */
$res = $this->db->get_array(
$sql, array($this->jrn_def_id)
);
if (count($res) == 0)
{
/* Initialize an empty object */
foreach ($this->variable as $key => $value)
$this->$key = '';
return -1;
}
foreach ($res[0] as $idx => $value)
{
$this->$idx = $value;
}
return 0;
}
| Jrn_Def_sql::save | ( | $ | p_string = '' | ) |
| Jrn_Def_sql::seek | ( | $ | cond = '', |
| $ | p_array = null |
||
| ) |
retrieve array of object thanks a condition
| $cond | condition (where clause) (optional by default all the rows are fetched) you can use this parameter for the order or subselect |
| $p_array | array for the SQL stmt |
Definition at line 166 of file class_jrn_def_sql.php.
| Jrn_Def_sql::set_parameter | ( | $ | p_string, |
| $ | p_value | ||
| ) |
Definition at line 91 of file class_jrn_def_sql.php.
References $idx.
| static Jrn_Def_sql::test_me | ( | ) | [static] |
| Jrn_Def_sql::update | ( | $ | p_string = '' | ) |
Definition at line 308 of file class_jrn_def_sql.php.
References $res, $sql, db, and verify_sql().
Referenced by save().
{
if ($this->verify_sql() != 0)
return;
/* please adapt */
$sql = " update public.jrn_def set jrn_def_name = $1
,jrn_def_class_deb = $2
,jrn_def_class_cred = $3
,jrn_def_fiche_deb = $4
,jrn_def_fiche_cred = $5
,jrn_deb_max_line = $6
,jrn_cred_max_line = $7
,jrn_def_ech = $8
,jrn_def_ech_lib = $9
,jrn_def_type = $10
,jrn_def_code = $11
,jrn_def_pj_pref = $12
,jrn_def_bank = $13
,jrn_def_num_op = $14
,jrn_def_description = $15
where jrn_def_id= $16";
$res = $this->db->exec_sql(
$sql, array($this->jrn_def_name
, $this->jrn_def_class_deb
, $this->jrn_def_class_cred
, $this->jrn_def_fiche_deb
, $this->jrn_def_fiche_cred
, $this->jrn_deb_max_line
, $this->jrn_cred_max_line
, $this->jrn_def_ech
, $this->jrn_def_ech_lib
, $this->jrn_def_type
, $this->jrn_def_code
, $this->jrn_def_pj_pref
, $this->jrn_def_bank
, $this->jrn_def_num_op
, strip_tags($this->jrn_def_description)
, $this->jrn_def_id)
);
}
Definition at line 107 of file class_jrn_def_sql.php.
References trim().
Referenced by insert(), and update().
{
// Verify that the elt we want to add is correct
/* verify only the datatype */
if (trim($this->jrn_def_name) == '')
$this->jrn_def_name = null;
if (trim($this->jrn_def_class_deb) == '')
$this->jrn_def_class_deb = null;
if (trim($this->jrn_def_class_cred) == '')
$this->jrn_def_class_cred = null;
if (trim($this->jrn_def_fiche_deb) == '')
$this->jrn_def_fiche_deb = null;
if (trim($this->jrn_def_fiche_cred) == '')
$this->jrn_def_fiche_cred = null;
if (trim($this->jrn_deb_max_line) == '')
$this->jrn_deb_max_line = null;
if ($this->jrn_deb_max_line !== null && settype($this->jrn_deb_max_line, 'float') == false)
throw new Exception('DATATYPE jrn_deb_max_line $this->jrn_deb_max_line non numerique');
if (trim($this->jrn_cred_max_line) == '')
$this->jrn_cred_max_line = null;
if ($this->jrn_cred_max_line !== null && settype($this->jrn_cred_max_line, 'float') == false)
throw new Exception('DATATYPE jrn_cred_max_line $this->jrn_cred_max_line non numerique');
if (trim($this->jrn_def_ech) == '')
$this->jrn_def_ech = null;
if (trim($this->jrn_def_ech_lib) == '')
$this->jrn_def_ech_lib = null;
if (trim($this->jrn_def_type) == '')
$this->jrn_def_type = null;
if (trim($this->jrn_def_code) == '')
$this->jrn_def_code = null;
if (trim($this->jrn_def_pj_pref) == '')
$this->jrn_def_pj_pref = null;
if (trim($this->jrn_def_bank) == '')
$this->jrn_def_bank = null;
if ($this->jrn_def_bank !== null && settype($this->jrn_def_bank, 'float') == false)
throw new Exception('DATATYPE jrn_def_bank $this->jrn_def_bank non numerique');
if (trim($this->jrn_def_num_op) == '')
$this->jrn_def_num_op = null;
if ($this->jrn_def_num_op !== null && settype($this->jrn_def_num_op, 'float') == false)
throw new Exception('DATATYPE jrn_def_num_op $this->jrn_def_num_op non numerique');
}
Jrn_Def_sql::$variable [protected] |
array(
"jrn_def_id" => "jrn_def_id",
"jrn_def_name" => "jrn_def_name"
, "jrn_def_class_deb" => "jrn_def_class_deb"
, "jrn_def_class_cred" => "jrn_def_class_cred"
, "jrn_def_fiche_deb" => "jrn_def_fiche_deb"
, "jrn_def_fiche_cred" => "jrn_def_fiche_cred"
, "jrn_deb_max_line" => "jrn_deb_max_line"
, "jrn_cred_max_line" => "jrn_cred_max_line"
, "jrn_def_ech" => "jrn_def_ech"
, "jrn_def_ech_lib" => "jrn_def_ech_lib"
, "jrn_def_type" => "jrn_def_type"
, "jrn_def_code" => "jrn_def_code"
, "jrn_def_pj_pref" => "jrn_def_pj_pref"
, "jrn_def_bank" => "jrn_def_bank"
, "jrn_def_num_op" => "jrn_def_num_op"
, "jrn_def_description" => "jrn_def_description"
)
Definition at line 41 of file class_jrn_def_sql.php.