diff --git a/libasynql/src/poggit/libasynql/base/DataConnectorImpl.php b/libasynql/src/poggit/libasynql/base/DataConnectorImpl.php index 86cb5f75..636d4e76 100644 --- a/libasynql/src/poggit/libasynql/base/DataConnectorImpl.php +++ b/libasynql/src/poggit/libasynql/base/DataConnectorImpl.php @@ -24,6 +24,7 @@ use Error; use Exception; +use Generator; use InvalidArgumentException; use pocketmine\plugin\Plugin; use pocketmine\utils\Terminal; @@ -151,8 +152,8 @@ public function asyncChange(string $queryName, array $args = []) : Generator{ $onSuccess = yield Await::RESOLVE; $onError = yield Await::REJECT; $this->executeChange($queryName, $args, $onSuccess, $onError); - $affectedRows = yield Await::ONCE; - return $affectedRows; + //Return $affectedRows + return yield Await::ONCE; } public function executeInsert(string $queryName, array $args = [], ?callable $onInserted = null, ?callable $onError = null) : void{ @@ -177,8 +178,8 @@ public function asyncInsert(string $queryName, array $args = []) : Generator{ $this->executeInsert($queryName, $args, static function(int $insertId, int $affectedRows) use($onSuccess) : void{ $onSuccess([$insertId, $affectedRows]); }, $onError); - $affectedRows = yield Await::ONCE; - return $affectedRows; + //Return $affectedRows + return yield Await::ONCE; } public function executeSelect(string $queryName, array $args = [], ?callable $onSelect = null, ?callable $onError = null) : void{ @@ -200,11 +201,11 @@ public function executeSelectRaw(string $query, array $args = [], ?callable $onS public function asyncSelect(string $queryName, array $args = []) : Generator{ $onSuccess = yield Await::RESOLVE; $onError = yield Await::REJECT; - $this->executeSelect($queryName, $args, static function(array $rows, SqlColumnInfo $columns) use($onSuccess) : void{ + $this->executeSelect($queryName, $args, static function(array $rows) use($onSuccess) : void{ $onSuccess($rows); }, $onError); - $rows = yield Await::ONCE; - return $rows; + //Return $rows + return yield Await::ONCE; } public function asyncSelectWithInfo(string $queryName, array $args = []) : Generator{ @@ -213,8 +214,8 @@ public function asyncSelectWithInfo(string $queryName, array $args = []) : Gener $this->executeInsert($queryName, $args, static function(array $rows, SqlColumnInfo $columns) use($onSuccess) : void{ $onSuccess([$rows, $columns]); }, $onError); - $rows = yield Await::ONCE; - return $rows; + //Return $rows + return yield Await::ONCE; } private function executeImpl(string $queryName, array $args, int $mode, callable $handler, ?callable $onError) : void{