49 foreach ($vars as $k => $v) {
57 return empty($errors) ?
true :
false;
71 if (!(class_exists($this->handler->className) && $object instanceof $this->handler->className)) {
73 "Object '" . get_class($object) .
"' is not an instance of '" . $this->handler->className .
"'",
80 "Data entry is not inserted - the object '" . get_class($object) .
"' is not dirty",
87 "Insert failed in method 'cleanVars' of object '" . get_class($object) .
"'" . $object->
getHtmlErrors(),
94 if ($object->
isNew()) {
97 "Data entry is not inserted - no variable is changed in object of '" . get_class($object) .
"'",
102 if (!$this->handler->db2->insert($this->handler->table, $object->
cleanVars)) {
105 if (!$object->
getVar($this->handler->keyName) && $object_id = $this->handler->db2->lastInsertId()) {
106 $object->
assignVar($this->handler->keyName, $object_id);
111 $result = $this->handler->db2->update(
112 $this->handler->table,
114 array($this->handler->keyName => $object->
getVar($this->handler->keyName))
116 if (!
$result && intval($this->handler->db2->errorCode())) {
121 return $object->
getVar($this->handler->keyName);
134 if (!(class_exists($this->handler->className) && $object instanceof $this->handler->className)) {
136 "Object '" . get_class($object) .
"' is not an instance of '" . $this->handler->className .
"'",
142 $qb = $this->handler->db2->createXoopsQueryBuilder();
145 $qb->delete($this->handler->table);
146 if (is_array($this->handler->keyName)) {
147 for (
$i = 0;
$i < count($this->handler->keyName); ++
$i) {
151 $this->handler->keyName[
$i],
152 $qb->createNamedParameter($object->
getVar($this->handler->keyName[
$i]))
158 $this->handler->keyName[
$i],
159 $qb->createNamedParameter($object->
getVar($this->handler->keyName[
$i]))
167 $this->handler->keyName,
168 $qb->createNamedParameter($object->
getVar($this->handler->keyName))
173 return empty(
$result) ?
false :
true;
188 $objects = $this->handler->getAll(
$criteria);
190 foreach (array_keys($objects) as $key) {
191 $num += $this->
delete($objects[$key], $force) ? 1 : 0;
197 $qb = $this->handler->db2->createXoopsQueryBuilder();
198 $qb->delete($this->handler->table);
202 return $qb->execute();
217 $qb = $this->handler->db2->createXoopsQueryBuilder();
220 $qb->update($this->handler->table);
224 $qb->set($fieldname, $qb->createNamedParameter($fieldvalue));
226 return $qb->execute();
updateAll($fieldname, $fieldvalue, CriteriaElement $criteria=null, $force=false)
insert(XoopsObject &$object, $force=true)
static cleanVar(XoopsObject $obj, $key, $quote=true)
deleteAll(CriteriaElement $criteria=null, $force=false, $asObject=false)
getVar($key, $format= 's')
cleanVars(XoopsObject &$object)