我可以在我的C ++应用程序中使用posgresql而不是sqlite [英] Can I use posgresql instead of sqlite in my C++ app

查看:105
本文介绍了我可以在我的C ++应用程序中使用posgresql而不是sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个带有服务器的C ++应用程序社区,我希望用户可以执行任何操作以防万一没有Internet连接,操作将被存储,然后如果应用程序连接到Internet则发送到服务器。所以我必须从服务器克隆PostgreSQL数据库到本地存储,应用程序将连接到本地数据库,然后同步到本地数据库到服务器。我的问题是我应该使用哪种数据库?我可以直接使用PostgreSQL吗?

非常感谢你的帮助



我的尝试:



我在我的C ++应用程序中尝试过SQLite,但我不确定这是一个很好的解决方案吗?我必须将postgreSQL命令转换为SQLite命令。

Hi all, I have an C++ app community with a server, I want user can do any action in case no Internet connection, the action will be stored then send to server later if app is connected to the Internet. So I must clone PostgreSQL database from server to store in local and the app will connect to the local database then sync to the local database to server. My question is what kind of database local should I use? Can I you use PostgreSQL directly?
Thank all so much for your help

What I have tried:

I've tried SQLite in my C++ app, but I'm not sure is it a good solution? I must convert postgreSQL commands to SQLite commands.

推荐答案

有一种嵌入式PostgreSQL for C,似乎可以与C ++一起工作: PostgreSQL:文档:9.6:章节  34.  ECPG - C语言中的嵌入式SQL:Postgres Professional [ ^ ]



但我认为它使用标准安装程序将更容易使用不同的端口安装本地PostgreSQL。

您也可以使用PostgreSQL的可移植版本,请参阅此处的文章:一个PostgreSQL通知示例 [ ^ ]
There is a kind of embedded PostgreSQL for C, whick seems to work with C++: PostgreSQL : Documentation: 9.6: Chapter 34. ECPG - Embedded SQL in C : Postgres Professional[^]

But I think it will be easier to install a local PostgreSQL with a different port using the standard installer.
You can also use a portable version of PostgreSQL, see article here: A PostgreSQL Notification Example[^]


这篇关于我可以在我的C ++应用程序中使用posgresql而不是sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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