example-crud
example-crud copied to clipboard
sqlite: database is locked.
First of all, thank you for your work, which has brought convenience to my work.
Recently in my engineering practice, I have a question about database interaction. Suppose I create a database connection pool db_client (by OATPP_COMPONENT(std::shared_ptr<UserDb>, m_database);), can db_client be injected into multiple services (such as: user_service, login_service, home_service ...)? And can it read and write database files concurrently and safely? Is it necessary to manually add a read-write lock when executing the statement:db_client->
I recently discovered in the code that if one service is writing and another service is reading, it will trigger the "database to be locked", which make me confused.