C ++中的异步ADO [英] asynchronous ADO in C++

查看:304
本文介绍了C ++中的异步ADO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我需要以异步方式执行sql查询.
有例子吗?
感谢您的建议.
Irek.

Hello,
I need to execute sql queries in asynchronous manner.
Any examples ?
Thanks in advice.
Irek.

推荐答案

铁,
例如,可以使用C ++/Qt....
有时,有必要以异步方式(多线程)对数据库执行一些查询,例如,避免在查询执行时间太长时冻结GUI.
为了使异步查询更容易使用,QxOrm库提供了qx :: QxDaoAsync类. 此类在另一个线程中执行查询,并在查询终止时返回queryFinished()SIGNAL. 要使用qx :: QxDaoAsync类,您只需要:
注意仅与实现qx :: IxPersistable接口的类一起使用;
创建qx :: QxDaoAsync类型的实例(例如,QWidget派生类的属性);
将SLOT连接到qx :: QxDaoAsync :: queryFinished()SIGNAL(例如,QWidget派生类的SLOT);
使用qx :: QxDaoAsync :: asyncXXXX()方法之一运行查询.

请在此处查看: http://www.qxorm.com/qxorm_en/faq.html#faq_290 [ ^ ]
Hi iron,
For exampple it is possible to do with C++/Qt....
Sometimes, it''s necessary to execute some queries to database in asynchronous way (multi-thread), for example to avoid to freeze a GUI if a query is too long to execute.
To make easier to work with asynchronous queries, QxOrm library provides qx::QxDaoAsync class.
This class executes a query in another thread and returns the queryFinished() SIGNAL when query is terminated.
To use qx::QxDaoAsync class, you just have to :
be careful to work only with classes implementing qx::IxPersistable interface ;
create an instance of qx::QxDaoAsync type (for example, a property of a QWidget derived class) ;
connect a SLOT to the qx::QxDaoAsync::queryFinished() SIGNAL (for example, a SLOT of a QWidget derived class) ;
run a query using one of qx::QxDaoAsync::asyncXXXX() methods.

Please see here: http://www.qxorm.com/qxorm_en/faq.html#faq_290[^]


这篇关于C ++中的异步ADO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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