i keep getting this error: Code: InvalidArgumentException: "The query afterlife.checkplayer has not been loaded" here is my sql file and code: PHP: -- #!mysql-- #{ afterlife-- # { initCREATE TABLE IF NOT EXISTS afterlife( id int(11) AUTO_INCREMENT PRIMARY KEY NOT NULL, name varchar(30) NOT NULL, kills int(5) NOT NULL, deaths int(5) NOT NULL, ratio FLOAT NOT NULL, totalXP int(5) NOT NULL, xp int(5) NOT NULL, level int(5) NOT NULL, streak int(5) NOT NULL);-- # }-- # { checkplayer-- # :nameSELECT COUNT(*) FROM afterlife WHERE name = :name;-- # }-- #} the identifier `afterlife.init` works and `afterlife.checkplayer` does not. Why? PHP: <?php// Main classclass Main extends PluginBase { public static $instance; public function onEnable() : void { self::$instance = $this; DataHandler::create(); } public function onDisable() : void { DataHandler::disConnect(); } public static function getInstance() : Main { return self::$instance; }}// DataHandler classuse poggit\libasynql\libasynql;use poggit\libasynql\DataConnector;class DataHandler { public static $database; public static function create () { $main = Main::getInstance(); self::$database = libasynql::create($main, $main->getConfig()->get("database"), [ "mysql" => "mysql.sql" ]); self::$database->executeGeneric("afterlife.init"); // this query works self::$database->waitAll(); } public static function disConnect () { if(isset(self::$database)) self::getDatabase()->close(); } public static function getDatabase() : DataConnector { return self::$database; }} and im trying to select a query onJoin to see if the player exists in the db or not PHP: public function onJoin(PlayerJoinEvent $event) { DataHandler::getDatabase()->executeSelect("afterlife.checkplayer", ['name' => $event->getPlayer()->getName()]);}
Case sensitivity perhaps? Try afterlife.checkplayer instead of afterlife.checkPlayer. Spoiler: Off-Topic If your id column's values are non-negative, you may want to change it's data type to INT UNSIGNED... to allocate more space. See: https://dev.mysql.com/doc/refman/8.0/en/integer-types.html
I can't spot the problem by just inspecting your code. Consider trying the `libasynql def` command and see what queries are detected: Code: php libasynql.phar def src Queries resources/mysql.sql
i found my problem... i created my sql file inside of my plugins data folder, NOT my plugins resource folder.