drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.04k stars 1.06k forks source link

ORM Mapper getDbClient return NULL #2041

Closed ericjansen closed 1 month ago

ericjansen commented 1 month ago

With the latest commit, ORM Mapper class has issues with returning DbClientPtr is nullptr. Any commands: insert, findOne, etc result with the following message:

Assertion failed: (dbClientsMap_.find(name) != dbClientsMap_.end()), function getDbClient, file DbClientManager.h, line 37. Abort trap: 6

I read the documentation and added name as default in db_clients of config.json but still results the same.

Hope can help to have the updated fixes for the mapper. Thank you

hwc0919 commented 1 month ago

Should have been fixed by yesterday's pr, please check it out.

hwc0919 commented 1 month ago

@ericjansen any news?

ericjansen commented 1 month ago

Hi @hwc0919 Thank you for the support. It's still the same. I have pulled the latest commit, and compiled and installed. I tried the simple testing to retrieve one record from the db and the result still the same. db_clients from config.json:

Screenshot 2024-05-28 at 8 48 30 PM Screenshot 2024-05-28 at 8 44 38 PM Screenshot 2024-05-28 at 8 45 12 PM

Testing using postman

Screenshot 2024-05-28 at 8 45 44 PM

Checking in the console print out:

Screenshot 2024-05-28 at 8 46 43 PM
an-tao commented 1 month ago

@ericjansen try to run the drogon_ctl -v command to check whether the newly compiled drogon supports pg database.

ericjansen commented 1 month ago

Hi @an-tao My local mac:

Screenshot 2024-05-28 at 9 28 43 PM

My server:

Screenshot 2024-05-28 at 9 31 16 PM
hwc0919 commented 1 month ago

Fixed. Please check.

ericjansen commented 1 month ago

Great! It's working now. Thank you.