mirror of
https://github.com/friendica/friendica
synced 2025-04-27 10:30:10 +00:00
Database stuff. New table "thread". Changing "left join" to "inner join", removing "limit 1" at update and delete.
This commit is contained in:
parent
2b5345323f
commit
6b8585d48d
33 changed files with 487 additions and 444 deletions
|
@ -18,6 +18,7 @@ class dba {
|
|||
|
||||
private $debug = 0;
|
||||
private $db;
|
||||
private $result;
|
||||
public $mysqli = true;
|
||||
public $connected = false;
|
||||
public $error = false;
|
||||
|
@ -75,7 +76,7 @@ class dba {
|
|||
return $this->db;
|
||||
}
|
||||
|
||||
public function q($sql) {
|
||||
public function q($sql, $onlyquery = false) {
|
||||
global $a;
|
||||
|
||||
if((! $this->db) || (! $this->connected))
|
||||
|
@ -154,6 +155,11 @@ class dba {
|
|||
if(($result === true) || ($result === false))
|
||||
return $result;
|
||||
|
||||
if ($onlyquery) {
|
||||
$this->result = $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
$r = array();
|
||||
if($this->mysqli) {
|
||||
if($result->num_rows) {
|
||||
|
@ -177,6 +183,30 @@ class dba {
|
|||
return($r);
|
||||
}
|
||||
|
||||
public function qfetch() {
|
||||
$x = false;
|
||||
|
||||
if ($this->result)
|
||||
if($this->mysqli) {
|
||||
if($this->result->num_rows)
|
||||
$x = $this->result->fetch_array(MYSQLI_ASSOC);
|
||||
} else {
|
||||
if(mysql_num_rows($this->result))
|
||||
$x = mysql_fetch_array($this->result, MYSQL_ASSOC);
|
||||
}
|
||||
|
||||
return($x);
|
||||
}
|
||||
|
||||
public function qclose() {
|
||||
if ($this->result)
|
||||
if($this->mysqli) {
|
||||
$this->result->free_result();
|
||||
} else {
|
||||
mysql_free_result($this->result);
|
||||
}
|
||||
}
|
||||
|
||||
public function dbg($dbg) {
|
||||
$this->debug = $dbg;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue