改名
This commit is contained in:
@@ -14,7 +14,6 @@ use Exception;
|
|||||||
use PDO;
|
use PDO;
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Swoole\Coroutine;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Command
|
* Class Command
|
||||||
@@ -56,11 +55,11 @@ class Command extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $isInsert
|
* @param bool $isInsert
|
||||||
* @param bool $hasAutoIncrement
|
* @param bool|null $hasAutoIncrement
|
||||||
* @return int|bool|array|string|null
|
* @return int|bool|array|string|null
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function save($isInsert = TRUE, $hasAutoIncrement = null): int|bool|array|string|null
|
public function save(bool $isInsert = TRUE, bool $hasAutoIncrement = null): int|bool|array|string|null
|
||||||
{
|
{
|
||||||
return $this->execute(static::EXECUTE, $isInsert, $hasAutoIncrement);
|
return $this->execute(static::EXECUTE, $isInsert, $hasAutoIncrement);
|
||||||
}
|
}
|
||||||
@@ -114,13 +113,14 @@ class Command extends Component
|
|||||||
/**
|
/**
|
||||||
* @param $type
|
* @param $type
|
||||||
* @param null $isInsert
|
* @param null $isInsert
|
||||||
* @param bool $hasAutoIncrement
|
* @param bool|null $hasAutoIncrement
|
||||||
* @return int|bool|array|string|null
|
* @return int|bool|array|string|null
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function execute($type, $isInsert = null, $hasAutoIncrement = null): int|bool|array|string|null
|
private function execute($type, $isInsert = null, bool $hasAutoIncrement = null): int|bool|array|string|null
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$this->debug('Execute: ' . $this->sql);
|
||||||
if ($type === static::EXECUTE) {
|
if ($type === static::EXECUTE) {
|
||||||
$result = $this->insert_or_change($isInsert, $hasAutoIncrement);
|
$result = $this->insert_or_change($isInsert, $hasAutoIncrement);
|
||||||
} else {
|
} else {
|
||||||
@@ -206,7 +206,7 @@ class Command extends Component
|
|||||||
* @param $prepare
|
* @param $prepare
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function errorMessage($prepare)
|
private function errorMessage($prepare): string
|
||||||
{
|
{
|
||||||
return $this->sql . ':' . ($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
|
return $this->sql . ':' . ($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ class Command extends Component
|
|||||||
* @return bool|int
|
* @return bool|int
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private function checkResponse($prepare, $connect)
|
private function checkResponse($prepare, $connect): bool|int
|
||||||
{
|
{
|
||||||
$result = $prepare->execute($this->params);
|
$result = $prepare->execute($this->params);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
@@ -278,7 +278,7 @@ class Command extends Component
|
|||||||
* @return int|bool|array|string|null
|
* @return int|bool|array|string|null
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function exec($scope = null, $insert = false): int|bool|array|string|null
|
public function exec($scope = null, bool $insert = false): int|bool|array|string|null
|
||||||
{
|
{
|
||||||
return $this->execute(static::EXECUTE, $insert, $scope);
|
return $this->execute(static::EXECUTE, $insert, $scope);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user