• 3558阅读
  • 3回复

请教大家在yaffs1上创建SQLite数据表的问题 [复制链接]

上一主题 下一主题
离线flysnow3
 
只看楼主 倒序阅读 楼主  发表于: 2011-12-03
关键词: QT4SQLite
我在嵌入式linux+nfs的环境下创建SQLite没有问题,但是如果把文件系统改为yaffs1时,SQLite可以创建数据表文件如db.dat,但创建表,使用最简单的语句创建表,就是不成功,而且在db.dat相同目录下会产生一个db.dat-journal文件,而且如果不重启动linux还不能删除db.dat-journal文件,而且会出现下面错误信息:

Connect Sqlite success


Unable to handle kernel NULL pointer dereference at virtual address 0000000c
pgd = c3eb8000
[0000000c] *pgd=33eb3031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1]
last sysfs file: /sys/class/i2c-dev/i2c-0/dev
Modules linked in: led_drv pwm
CPU: 0    Not tainted  (2.6.35@panzhh #18)
PC is at yaffs_sync_object+0x8/0x64
LR is at vfs_fsync_range+0x5c/0x80
pc : [<c01a1cfc>]    lr : [<c00b93fc>]    psr: 40000013
sp : c3ec5f50  ip : 22222222  fp : ffffffff
r10: 00000000  r9 : c3ec4000  r8 : c002bfe8
r7 : 7fffffff  r6 : 00000000  r5 : c3a39780  r4 : c3eb5820
r3 : c04b2ba4  r2 : c3ec5f58  r1 : 00000000  r0 : c3eb5820
Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 0000717f  Table: 33eb8000  DAC: 00000015
Process SQLiteTest (pid: 941, stack limit = 0xc3ec4270)
Stack: (0xc3ec5f50 to 0xc3ec6000)
5f40:                                     c3eb5820 c3a39780 00000000 c00b93fc
5f60: ffffffff 7fffffff 00000000 c3eb5820 00000000 00000000 00000076 c00b94b8
5f80: ffffffff 7fffffff 00000000 00000001 ffff01a4 c00b94e0 0002e780 00000000
5fa0: 00000000 c002be40 0002e780 00000000 0000000e 00000002 4001ecc4 00000000
5fc0: 0002e780 00000000 00000000 00000076 00000000 00000018 00000000 ffff01a4
5fe0: 00000000 bee1f4d0 40bf0b14 40bf0b24 80000010 0000000e 00008000 00000000
[<c01a1cfc>] (yaffs_sync_object+0x8/0x64) from [<c00b93fc>] (vfs_fsync_range+0x5c/0x80)
[<c00b93fc>] (vfs_fsync_range+0x5c/0x80) from [<c00b94b8>] (vfs_fsync+0x20/0x28)
[<c00b94b8>] (vfs_fsync+0x20/0x28) from [<c00b94e0>] (do_fsync+0x20/0x34)
[<c00b94e0>] (do_fsync+0x20/0x34) from [<c002be40>] (ret_fast_syscall+0x0/0x2c)
Code: e2800018 eafafda4 e92d4070 e59f304c (e591000c)
---[ end trace 87c3cf06dfbcae58 ]---
Segmentation fault

我的源程序如下:

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE","mydbconn");
    db.setDatabaseName("db.dat");
    if(!db.open())
    {
        qDebug() << "Connect Sqlite error" << endl;
    }
    else
    {
        qDebug() << "Connect Sqlite success" << endl;
        QString sql=QString("CREATE TABLE yzj (id INTEGER PRIMARY KEY AUTOINCREMENT,test VARCHAR(20) NULL)");
        QSqlQuery query=QSqlQuery(db);
        bool isSuccess=query.exec(sql);
        qDebug() << "CREATE TABLE yzj...;isSuccess=" << isSuccess << endl;
        sql=QString("insert into yzj (test) values ('haha')");
        isSuccess=query.exec(sql);
        qDebug() << "insert TABLE yzj...;isSuccess=" << isSuccess << endl;
        db.close();
    }

请高手指定下这是怎么回事情?而相同程序在nfs上执行一点问题也没有!我搞了几天了,实在是搞不定了!望各位指定了,先谢谢大家了

我的程序运行环境:linux2.6.35(kernel)+ARM9+QT4.5.3+yaffs2(自动转为了yaffs1),SQLite是QT自带的。

另:我测试过,在yaffs1环境下的SQLite执行select * from test,是可以执行成功的!


离线flysnow3
只看该作者 1楼 发表于: 2011-12-03
怎么没人回答呢?
离线flysnow3
只看该作者 2楼 发表于: 2011-12-04
论坛还真是冷清哦
离线flysnow3
只看该作者 3楼 发表于: 2011-12-06
实在没办法,我昨天终于只有把文件系统改为jffs2,就好了!
快速回复
限100 字节
 
上一个 下一个