* $count = DBA::count($table, $condition);
* @throws \Exception
*/
- public static function count($table, array $condition = [], array $params = [])
+ public static function count($table, array $condition = [], array $params = []): int
{
return DI::dba()->count($table, $condition, $params);
}
*
* @return array Data array
*/
- public static function toArray($stmt, $do_close = true, int $count = 0)
+ public static function toArray($stmt, $do_close = true, int $count = 0): array
{
return DI::dba()->toArray($stmt, $do_close, $count);
}
* @param array $fields
* @return array casted fields
*/
- public static function castFields(string $table, array $fields)
+ public static function castFields(string $table, array $fields): array
{
return DI::dba()->castFields($table, $fields);
}
*
* @return string Error number (0 if no error)
*/
- public static function errorNo()
+ public static function errorNo(): int
{
return DI::dba()->errorNo();
}
*
* @return string Error message ('' if no error)
*/
- public static function errorMessage()
+ public static function errorMessage(): string
{
return DI::dba()->errorMessage();
}
* @param object $stmt statement object
* @return boolean was the close successful?
*/
- public static function close($stmt)
+ public static function close($stmt): bool
{
return DI::dba()->close($stmt);
}
* 'amount' => Number of concurrent database processes
* @throws \Exception
*/
- public static function processlist()
+ public static function processlist(): array
{
return DI::dba()->processlist();
}
if (!$retval = $this->connection->query($this->replaceParameters($sql, $args))) {
$errorInfo = $this->connection->errorInfo();
$this->error = $errorInfo[2];
- $this->errorno = $errorInfo[1];
+ $this->errorno = (int) $errorInfo[1];
$retval = false;
$is_error = true;
break;
if (!$stmt = $this->connection->prepare($sql)) {
$errorInfo = $this->connection->errorInfo();
$this->error = $errorInfo[2];
- $this->errorno = $errorInfo[1];
+ $this->errorno = (int) $errorInfo[1];
$retval = false;
$is_error = true;
break;
if (!$stmt->execute()) {
$errorInfo = $stmt->errorInfo();
$this->error = $errorInfo[2];
- $this->errorno = $errorInfo[1];
+ $this->errorno = (int) $errorInfo[1];
$retval = false;
$is_error = true;
} else {
}
$this->error = $error;
- $this->errorno = $errorno;
+ $this->errorno = (int) $errorno;
}
$this->profiler->stopRecording();
*
* @return array Data array
*/
- public function toArray($stmt, $do_close = true, int $count = 0)
+ public function toArray($stmt, bool $do_close = true, int $count = 0): array
{
if (is_bool($stmt)) {
return [];
*
* @return string Error number (0 if no error)
*/
- public function errorNo()
+ public function errorNo(): int
{
return $this->errorno;
}
*
* @return boolean was the close successful?
*/
- public function close($stmt)
+ public function close($stmt): bool
{
$this->profiler->startRecording('database');
* 'amount' => Number of concurrent database processes
* @throws \Exception
*/
- public function processlist()
+ public function processlist(): array
{
$ret = $this->p("SHOW PROCESSLIST");
$data = $this->toArray($ret);