X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FDatabase%2FDatabase.php;h=0b38c24ba336b9ab27308dcdbfddeb2f0cca567e;hb=d53f46b9583737668a3314a22d1eeacb00a47db2;hp=806b2b86bbd73a48c3f4858fcb327544d742641e;hpb=8eeb7807d3cf7c0490299b7540ca06f4d091217c;p=friendica.git diff --git a/src/Database/Database.php b/src/Database/Database.php index 806b2b86bb..0b38c24ba3 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -343,7 +343,7 @@ class Database $row['key'] . "\t" . $row['rows'] . "\t" . $row['Extra'] . "\t" . basename($backtrace[1]["file"]) . "\t" . $backtrace[1]["line"] . "\t" . $backtrace[2]["function"] . "\t" . - substr($query, 0, 2000) . "\n", FILE_APPEND); + substr($query, 0, 4000) . "\n", FILE_APPEND); } } } @@ -699,7 +699,7 @@ class Database $this->errorno = $errorno; } - $this->profiler->saveTimestamp($stamp1, 'database', System::callstack()); + $this->profiler->saveTimestamp($stamp1, 'database'); if ($this->configCache->get('system', 'db_log')) { $stamp2 = microtime(true); @@ -712,7 +712,7 @@ class Database @file_put_contents($this->configCache->get('system', 'db_log'), DateTimeFormat::utcNow() . "\t" . $duration . "\t" . basename($backtrace[1]["file"]) . "\t" . $backtrace[1]["line"] . "\t" . $backtrace[2]["function"] . "\t" . - substr($this->replaceParameters($sql, $args), 0, 2000) . "\n", FILE_APPEND); + substr($this->replaceParameters($sql, $args), 0, 4000) . "\n", FILE_APPEND); } } return $retval; @@ -783,7 +783,7 @@ class Database $this->errorno = $errorno; } - $this->profiler->saveTimestamp($stamp, "database_write", System::callstack()); + $this->profiler->saveTimestamp($stamp, "database_write"); return $retval; } @@ -964,7 +964,7 @@ class Database } } - $this->profiler->saveTimestamp($stamp1, 'database', System::callstack()); + $this->profiler->saveTimestamp($stamp1, 'database'); return $columns; } @@ -979,7 +979,7 @@ class Database * @return boolean was the insert successful? * @throws \Exception */ - public function insert($table, $param, $on_duplicate_update = false) + public function insert($table, array $param, bool $on_duplicate_update = false) { if (empty($table) || empty($param)) { $this->logger->info('Table and fields have to be set'); @@ -1467,24 +1467,30 @@ class Database /** * Select rows from a table * - * @param string|array $table Table name or array [schema => table] - * @param array $fields Array of selected fields, empty for all - * @param array $condition Array of fields for condition - * @param array $params Array of several parameters - * - * @return boolean|object * * Example: - * $table = "item"; - * $fields = array("id", "uri", "uid", "network"); + * $table = 'item'; + * or: + * $table = ['schema' => 'table']; + * @see DBA::buildTableString() * - * $condition = array("uid" => 1, "network" => 'dspr'); + * $fields = ['id', 'uri', 'uid', 'network']; + * + * $condition = ['uid' => 1, 'network' => 'dspr', 'blocked' => true]; * or: - * $condition = array("`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr'); + * $condition = ['`uid` = ? AND `network` IN (?, ?)', 1, 'dfrn', 'dspr']; + * @see DBA::buildCondition() * - * $params = array("order" => array("id", "received" => true), "limit" => 10); + * $params = ['order' => ['id', 'received' => true, 'created' => 'ASC'), 'limit' => 10]; + * @see DBA::buildParameter() * * $data = DBA::select($table, $fields, $condition, $params); + * + * @param string|array $table Table name or array [schema => table] + * @param array $fields Array of selected fields, empty for all + * @param array $condition Array of fields for condition + * @param array $params Array of several parameters + * @return boolean|object * @throws \Exception */ public function select($table, array $fields = [], array $condition = [], array $params = []) @@ -1638,7 +1644,7 @@ class Database break; } - $this->profiler->saveTimestamp($stamp1, 'database', System::callstack()); + $this->profiler->saveTimestamp($stamp1, 'database'); return $ret; }