C ++的持久化解决方案(使用SQL数据库)? [英] Persistence solutions for C++ (with a SQL database)?

查看:123
本文介绍了C ++的持久化解决方案(使用SQL数据库)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道C ++与SQL数据库有什么样的持久化解决方案?除了用自定义SQL做事情(封装DAO的数据访问或类似的东西),还有其他一些(更一般的)解决方案吗?

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 or something similar), are there some other (more general) solutions?

或框架(像Hibernate& co for Java和.NET)或其他东西? (我甚至没有想到的东西,也可以欢迎建议)

Like some general libraries or frameworks (something like Hibernate & co for Java and .NET) or something else? (Something that I haven't even thought of can also be welcome to be suggested)

编辑:是的,我正在搜索更多的ORM解决方案或类似的东西处理sql查询以及表和对象之间的关系,而不是数据库引擎本身。感谢所有的答案!

Yep, I was searching more for an ORM solution or something similar to handle sql queries and the relationships between tables and objects than for the db engine itself. Thanks for all the answers anyway!

推荐答案

听起来你正在寻找一些ORM,用手写的SQL代码。

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.

移动:您最好使用SQLite作为数据库引擎,因为它可以嵌入和占用很小。

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

桌面应用程序:您仍然应该考虑在这里使用SQLite,但是您也可以选择与大多数桌面应用程序一直连接到互联网,在这种情况下,您可能想要提供一个网络服务器。我建议使用Apache + MySQL + PHP并使用轻量级的ORM,例如 Outlet ORM ,然后使用标准HTTP post调用来访问您的资源。

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.

服务器应用程序:这里有更多选项,但我仍然建议使用Apache + MySQL + PHP + ORM,使用脚本语言比在C ++中更容易维护此图层。

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++.

这篇关于C ++的持久化解决方案(使用SQL数据库)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆