• gufan
    2019-01-15
    这篇文章需要很长一段时间才能消化
    
     12
  • HI
    2019-03-11
    大致的看了Matrix SQLiteLint的源码实现,由于Androd N hook sqlite3_profile 会出现问题,SQLiteLint 并不能实时的获取到sql语句,而是采用java层主动的告知SQLiteLint 要分析的sql,比如分析 select *,PrepareStatement, 而对于检测 Autoincrement,冗余索引,Without RowId 而是通过native层告知java层要查询的内容,java层将查询之后的内容再通知native层,这个检测的时间间隔为4秒,这4秒是有什么依据的吗

    作者回复: 这些都是一些拍脑袋的经验值而已,也可以在GitHub上面提issue

    
     1
  • 黄小木🐵
    2019-02-15
    张老师好,提个问题,我们项目当前用的是ormlite关系型数据库框架,已经利用里面的api写了大量sql语句,请问如何最低成本的替换成wcdb呢?

    作者回复: ormlite应该是ORM框架,跟底层的wcdb应该是不冲突的。

    
     1
  • lbj
    2020-01-01
    想咨询个问题,checkpoint是100pages一次,那假如app的生命周期中往sqlite写的数据加起来都不到100pages,那即使app被杀死了也没到触发checkpoint的临界值,这个时候这部分数据是直到n次app使用积攒到100pages在checkpoint还是怎么处理
    
    
  • 满大大
    2019-12-10
    老师客户端怎么开启WAL模式

    作者回复: SQLite有接口的

    
    
  • OF
    2019-10-24
    哎,这辈子赶不上大佬了
    
    
  • 薯条
    2019-10-05
    多线程、多进程 操作数据库的时候,可以得到一个database 对象,假如在某一个线程中调用了db.close 方法就会出现问题。看了好多方案,,最好的就如文章所说,不关闭db
    
    
  • 薯条
    2019-10-05
    时间开发中 遇到过 “多线程操作sqlite3 导致数据库损坏的问题” 没想到 微信在这块做了这么多功夫
    
    
  • godliness
    2019-09-26
    但是需要注意的是,写之间是仍然不能并发

    Android 系统默认提供的 SQLiteConnecionPool ,主连接只有一个(可写的),否则在 Java 层多线程等待(这里是等待-释放-唤醒)。不会出现 SQLiteDatabaseLockedException
     1
    
  • EchoSomeTH
    2019-07-24
    18:56.100 2712-2732/com.exampletest.liepin.chapter14_wcdb D/SqliteLint.Native: Lint::Check checked cnt=2
    2019-07-24 19:18:56.101 2712-2732/com.exampletest.liepin.chapter14_wcdb V/SqliteLint.Native: SqlInfoProcessor::ParseObj wildcard_sql_ = insert into message values(?)
    2019-07-24 19:18:56.102 2712-2732/com.exampletest.liepin.chapter14_wcdb V/SqliteLint.Native: Lint::PreProcessSqlInfo processRet:ret:0
    2019-07-24 19:18:56.103 2712-2732/com.exampletest.liepin.chapter14_wcdb V/SqliteLint.Native: Lint::Check() already checked recently
    2019-07-24 19:18:56.110 2712-2732/com.exampletest.liepin.chapter14_wcdb I/SqliteLint.Native: Lint::TakeSqlInfo queue empty and wait

    这是 8.0 插入一条数据,调用notifySqlExecution才出来的,这个好像···没有啥有用数据撒
    展开
    
    
  • L
    2019-02-17
    sqlite wal mode w模式sync mode 可以直接修改成OFF?若不行,怎么论证?谢谢!因为修改成OFF可以减少 DB fdatasync call

    作者回复: 可以看看:https://www.sqlite.org/pragma.html#pragma_journal_mode

    PRAGMA schema.synchronous;
    PRAGMA schema.synchronous = 0 | OFF | 1 | NORMAL | 2 | FULL | 3 | EXTRA;

    Query or change the setting of the "synchronous" flag. The first (query) form will return the synchronous setting as an integer. The second form changes the synchronous setting. The meanings of the various synchronous settings are as follows:

    EXTRA (3)
    EXTRA synchronous is like FULL with the addition that the directory containing a rollback journal is synced after that journal is unlinked to commit a transaction in DELETE mode. EXTRA provides additional durability if the commit is followed closely by a power loss.
    FULL (2)
    When synchronous is FULL (2), the SQLite database engine will use the xSync method of the VFS to ensure that all content is safely written to the disk surface prior to continuing. This ensures that an operating system crash or power failure will not corrupt the database. FULL synchronous is very safe, but it is also slower. FULL is the most commonly used synchronous setting when not in WAL mode.
    NORMAL (1)
    When synchronous is NORMAL (1), the SQLite database engine will still sync at the most critical moments, but less often than in FULL mode. There is a very small (though non-zero) chance that a power failure at just the wrong time could corrupt the database in journal_mode=DELETE on an older filesystem. WAL mode is safe from corruption with synchronous=NORMAL, and probably DELETE mode is safe too on modern filesystems. WAL mode is always consistent with synchronous=NORMAL, but WAL mode does lose durability. A transaction committed in WAL mode with synchronous=NORMAL might roll back following a power loss or system crash. Transactions are durable across application crashes regardless of the synchronous setting or journal mode. The synchronous=NORMAL setting is a good choice for most applications running in WAL mode.
    OFF (0)
    With synchronous OFF (0), SQLite continues without syncing as s

    
    
  • 嘿,抬头
    2019-01-15
    张老师,请教个问题:
    启动一个Activity,可以查出数据库中数据,但切换下系统语言,Activity重启,却查不出数据库中的数据!!!(debug看到两次都执行了查询数据库的代码)
    希望您指点一二,谢谢~

    作者回复: 输入信息太少,如果是必现可以比较好搞,这个可以直接通过sql命令行查询一下

    
    
我们在线,来聊聊吧