refactoring
This commit is contained in:
parent
b326596e16
commit
a13c30a5c3
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Db{
|
class Db{
|
||||||
private static $join;
|
private static $join;
|
||||||
private static $commandDatabase = array (
|
private static $commandDatabase = array (
|
||||||
@ -61,7 +62,8 @@ class Db{
|
|||||||
"`) VALUES (" .
|
"`) VALUES (" .
|
||||||
str_repeat('?,', (count($values) > 0 ? count($values)-1 : 0)) .
|
str_repeat('?,', (count($values) > 0 ? count($values)-1 : 0)) .
|
||||||
"?)"
|
"?)"
|
||||||
, array_values ($values));
|
, array_values ($values)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// TODO: pokud vlozim prazdne pole tak chyba ??
|
// TODO: pokud vlozim prazdne pole tak chyba ??
|
||||||
public static function addAll ($table, $values = array ()) {
|
public static function addAll ($table, $values = array ()) {
|
||||||
@ -74,18 +76,14 @@ class Db{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function edit (
|
public static function edit ($table, $values = array(), $conditions, $values2 = array()) {
|
||||||
$table,
|
|
||||||
$values = array(),
|
|
||||||
$conditions,
|
|
||||||
$values2 = array()
|
|
||||||
) {
|
|
||||||
return self::command (
|
return self::command (
|
||||||
"UPDATE `$table` SET `" .
|
"UPDATE `$table` SET `" .
|
||||||
implode('` =?, `', array_keys($values)) .
|
implode('` =?, `', array_keys($values)) .
|
||||||
"` =? " .
|
"` =? " .
|
||||||
$conditions
|
$conditions
|
||||||
, array_merge (array_values ($values), $values2));
|
, array_merge (array_values ($values), $values2)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function insertId () {
|
public static function insertId () {
|
||||||
|
Loading…
Reference in New Issue
Block a user