}
#try {
- foreach ($this->sql_pre() as $s) { $this->conn->exec($s); }
+ #foreach ($this->sql_pre() as $s) { $this->conn->exec($s); }
$this->method('connect');
#} catch (PDOException $e) {
#return false;
public function disconnect() {
if (empty($this->conn)) return null;
+# NB 19.12.16 foreach ((array)$this->method('sql.post') as $s) {
+# NB 19.12.16 $r = $this->conn->exec($s);
+# NB 19.12.16 }
$this->method('disconnect');
# NB 09.09.16 return $this->conn->close();
}
return $this->db()->exec($sql,$values);
return $this->db()->exec($sql);
}
+
# dbq t=nb.mime_type a=table.update type=application/rss+xml name='RSS - Really Simple Syndication' ext=rss debug=2
public function update($hvalues,&$info=[]) {
if (empty($info['values'])) $info['values'] = [];
}
}
+
$info['keys'] = array_combine($keys,$keys_values);
if (empty($fields)) $this->bye("Missing keys!");
+
if (empty($keys)) {
$this->bye("Missing keys!");
$keys = $fields;
#debug("$name: ".$hvalues[$name]);
$row = [ $name => $hvalues[$name] ];
$this->db()->table_row_encrypt($this,$row);
+ #debug($this->db()->status());
$field->bindParam($query,$row[$name],":$name");
}
}
#return $sql;
- #bye($sql);
+ #bye($info);
if (self::p('debug')) {
$this->debug($info,1);
return false;
}
$info['rowCount'] = $query->rowCount();
+ #bye($this->db()->row("SELECT value FROM crypt WHERE id='zaza'"));
#bye($info);
- return true;
+ #return true;
#debug($execute);
return $query->rowCount();
$this->page($this,'table_html_edit');
} elseif ($action == 'insert' and $this->perm >= self::WRITE) {
- if (!$this->table->insert($_POST)) $this->error('insert');
+ if (!$this->table->insert($_POST,$info)) $this->error('insert: '.print_r($info,true));
header('Location: '.$this->table->base);
} elseif ($action == 'update' and $this->perm >= self::WRITE) {
- if (!$this->table->update($_POST)) $this->error('update');
+ # NB 19.12.16: TODO NOT WORKING using replace
+ if (!$this->table->replace($_POST,$info)) $this->error('update: '.print_r($info,true));
header('Location: '.$this->table->base);
} elseif ($action == 'rm' and $this->perm >= self::DELETE) {
- if (!$this->table->delete($_POST)) $this->error('rm');
+ if (!$this->table->delete($_POST,$info)) $this->error('rm: '.print_r($info,true));
header('Location: '.$this->table->base);
}
- return false;
+ return true;
}
}