C++ SQL 数据库库比较

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/971478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 18:10:44  来源:igfitidea点击:

C++ SQL database library comparison

c++sqldatabasesoci

提问by El Weon

I am starting development on a medium-scale C++ project that has to work with a Microsoft SQL Server database. I have done database work before using .NET technologies but I don't find using a .NET approach to be appropriate this time. I would like to get some feedback concerning the various free (as in GPL, LGPL, Boost) C/C++ SQL libraries available. I found MySQL++ and SOCI to be pretty interesting and I would like to know which one you guys prefer and why.

我正在开始开发一个必须使用 Microsoft SQL Server 数据库的中型 C++ 项目。在使用 .NET 技术之前,我已经完成了数据库工作,但我发现这次使用 .NET 方法并不合适。我想得到一些关于可用的各种免费(如 GPL、LGPL、Boost)C/C++ SQL 库的反馈。我发现 MySQL++ 和 SOCI 非常有趣,我想知道你们更喜欢哪一个以及为什么。

Also, although this project will primarily be run on Windows workstations, I prefer developing under Linux so cross-platform compatibility is an advantage.

此外,虽然这个项目将主要在 Windows 工作站上运行,但我更喜欢在 Linux 下开发,因此跨平台兼容性是一个优势。

Thank you all for your time, I really appreciate your advices !

谢谢大家的时间,我真的很感谢你的建议!

Jeremie

杰瑞米

EDIT : Sorry about the typo, I meant Microsoft SQL Server and not MySQL Server.

编辑:抱歉打字错误,我的意思是 Microsoft SQL Server 而不是 MySQL Server。

采纳答案by Assaf Lavie

I can highly recommend OTL.

我强烈推荐OTL

Not only does it support all major DBs, it's also very STL-ish and is generally written according to to proper C++ methodology (IMO). It worked for me just fine on VC8 (I used the MySQL ODBC connector).

它不仅支持所有主要的数据库,而且还非常符合 STL,并且通常是根据适当的 C++ 方法 (IMO) 编写的。它在 VC8 上对我来说很好用(我使用了 MySQL ODBC 连接器)。

Moreover, it's a one-header library. So there's no linkage issues or anything. Just include the header and you're done. You're 3 lines of code away from querying a MySQL table.

此外,它是一个单头库。所以没有链接问题或任何事情。只需包含标题即可完成。您距离查询 MySQL 表只有 3 行代码。

I've used it over the past few months, and also had a good experience communicating with its developer, asking questions, etc.

在过去的几个月里我一直在使用它,并且在与它的开发人员交流、提问等方面也有很好的经验。

回答by Rob

I recommend SQLAPI++. It's shareware so you can try it for free and the support is excellent. Works for Windows and Linux.

我推荐SQLAPI++。它是共享软件,因此您可以免费试用,而且支持非常好。适用于 Windows 和 Linux。