Persistence solutions for C++ (with a SQL database)?

后端 未结 5 637
孤独总比滥情好
孤独总比滥情好 2021-02-03 13:25

I\'m wondering what kind of persistence solutions are there for C++ with a SQL database? In addition to doing things with custom SQL (and encapsulating the data access to DAOs o

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 13:47

    It sounds like you are looking for some ORM so that you don't have to bother with hand written SQL code.

    There is a post here that goes over ORM solutions for C++.

    You also did not mention the type of application you are writing, if it is a desktop application, mobile application, server application.

    Mobile: You are best off using SQLite as your database engine because it can be embedded and has a small footprint.

    Desktop App: You should still consider using SQLite here, but you also have the option with most desktop applications to have an always on connection to the internet in which case you may want to provide a network server for this task. I suggest using Apache + MySQL + PHP and using a lightweight ORM such as Outlet ORM, and then using standard HTTP post calls to access your resources.

    Server App: You have many more options here but I still suggest using Apache + MySQL + PHP + ORM because I find it is much easier to maintain this layer in a script language than in C++.

提交回复
热议问题