[英]DataModel in BlackBerry 10
I want to store some data in database and get this data from it. 我想在数据库中存储一些数据并从中获取数据。 But when I try to retrieve this data I am having some problem.
但是,当我尝试检索此数据时,我遇到了一些问题。 I have done the following code to read records---
我已经完成以下代码来读取记录---
QSqlDatabase database = QSqlDatabase::database();
QSqlQuery query(database);
const QString sqlQuery = "SELECT senderName, msgReceive FROM messageReceive";
if (query.exec(sqlQuery)) {
const int senderNameField = query.record().indexOf("senderName");
const int msgDataField = query.record().indexOf("msgReceive");
int recordsRead = 0;
while (query.next()) {
Person *person = new Person(query.value(senderNameField).toString(),query.value(msgDataField).toString()); //// LINE 1
m_dataModel->insert(person); ///// LINE 2
recordsRead++;
}`
This code is executing well till line 1 , but at line 2 the application is exiting. 该代码在第1行之前执行良好,但是在第2行,应用程序正在退出。 I have created object of GroupDataModel in .hpp file and given include file also.
我已经在.hpp文件中创建了GroupDataModel对象,并且还给出了include文件。
Please someone tell me whats the problem here ? 请有人告诉我这里有什么问题吗?
Thanks in advance. 提前致谢。
Error SIGSEGV
is generated on segmentation fault. 分割错误会产生错误
SIGSEGV
。
Therefore I believe m_dataModel
is uninitialized. 因此,我相信
m_dataModel
初始化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.