poggit / libasynql

Asynchronous MySQL access library for PocketMine plugins.
https://poggit.github.io/libasynql
Apache License 2.0
134 stars 44 forks source link

Data Loss in rows #82

Closed UnknownOre closed 2 years ago

UnknownOre commented 2 years ago

Describe the bug it didn't return the full rows but returned the full ColumnInfo

Sample code

$this->dataConnector->executeSelect(SQLQueries::SELECT_FACTION_ID_DATA, [
                "id" => $id], $closure);
});

Expected behavior return the rows

trace

#2 plugins/Factions/src/Ali/Factions/provider/mysql/SQLFaction(35): Ali\Factions\faction\FactionsFactory->Ali\Factions\faction\{closure}(array[1])
#3 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(174): Ali\Factions\provider\SQLProvider->Ali\Factions\provider\mysql\{closure}(array[1], array[9])
#4 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(181): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl::Ali\NetworkCore\libraries\libasynql\base\{closure}(object Ali\NetworkCore\libraries\libasynql\result\SqlSelectResult#131153)
#5 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(239): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl::Ali\NetworkCore\libraries\libasynql\base\{closure}(array[1])
#6 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/SqlThreadPool(112): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->Ali\NetworkCore\libraries\libasynql\base\{closure}(array[1])
#7 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(323): Ali\NetworkCore\libraries\libasynql\base\SqlThreadPool->readResults(array[1])
#8 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/SqlThreadPool(65): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->checkResults()
#9 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): Ali\NetworkCore\libraries\libasynql\base\SqlThreadPool->Ali\NetworkCore\libraries\libasynql\base\{closure}()
#10 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
#11 pmsrc/src/Server(1661): pocketmine\snooze\SleeperHandler->sleepUntil(double 1652777010.4874)
#12 (): --- below is the original stack trace ---()
#13 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(223): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->executeImplRaw(array[1], array[1], array[1], object Closure#129776, NULL )
#14 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(180): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->executeImpl(string[20] core.faction-data-id, array[1], integer 3, object Closure#129776, NULL )
#15 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(172): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->executeImplLast(string[20] core.faction-data-id, array[1], integer 3, object Closure#129843, NULL )
#16 plugins/Factions/src/Ali/Factions/provider/mysql/SQLFaction(36): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->executeSelect(string[20] core.faction-data-id, array[1], object Closure#129875)
#17 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(174): Ali\Factions\provider\SQLProvider->Ali\Factions\provider\mysql\{closure}(array[1], array[1])
#18 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(181): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl::Ali\NetworkCore\libraries\libasynql\base\{closure}(object Ali\NetworkCore\libraries\libasynql\result\SqlSelectResult#129844)
#19 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(239): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl::Ali\NetworkCore\libraries\libasynql\base\{closure}(array[1])
#20 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/SqlThreadPool(112): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->Ali\NetworkCore\libraries\libasynql\base\{closure}(array[1])
#21 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/DataConnectorImpl(323): Ali\NetworkCore\libraries\libasynql\base\SqlThreadPool->readResults(array[1])
#22 plugins/NetworkCore/src/Ali/NetworkCore/libraries/libasynql/base/SqlThreadPool(65): Ali\NetworkCore\libraries\libasynql\base\DataConnectorImpl->checkResults()
#23 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): Ali\NetworkCore\libraries\libasynql\base\SqlThreadPool->Ali\NetworkCore\libraries\libasynql\base\{closure}()
#24 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\snooze\SleeperHandler->processNotifications()
#25 pmsrc/src/Server(1661): pocketmine\snooze\SleeperHandler->sleepUntil(double 1652777009.8874)

Environment OS: Windows 10 PocketMine version: 4.3.1 (git hash: f7dce4af8802ce28a8286e1c8002af19cf986c62)

SOF3 commented 2 years ago

Can you show the full code used to reproduce this issue? What is in $closure`, and what is in your query?

SOF3 commented 2 years ago

https://github.com/poggit/libasynql/blob/49aebed5c95c493b0ec2ab06f08be672584c523c/libasynql/src/poggit/libasynql/base/DataConnectorImpl.php#L174 are you sure you didn't accidentally use the second parameter instead of the first one?

UnknownOre commented 2 years ago

that's the full code

$this->dataConnector->executeSelect(SQLQueries::SELECT_FACTION_ID_DATA, [
                "id" => $id], function(array $data) use ($count, $closure):void{
                $data[0][Faction::COUNT] = $count;
                $closure($data);
            });
UnknownOre commented 2 years ago

https://github.com/poggit/libasynql/blob/49aebed5c95c493b0ec2ab06f08be672584c523c/libasynql/src/poggit/libasynql/base/DataConnectorImpl.php#L174

are you sure you didn't accidentally use the second parameter instead of the first one?

also yeah I'm pretty sure I used the first parameter, because I'm still using the same code and it's working fine

UnknownOre commented 2 years ago

I'm closing this because I can't reproduce it