美文网首页
SQLite相关

SQLite相关

作者: 王蓝胖 | 来源:发表于2016-03-14 20:56 被阅读56次
  • SQLite语句
  1. 增加表字段 ALTER TABLE 表名 ADD COLNUM 字段名 字段类型
  2. 删除表字段 ALTER TABLE 表名 DROP COLNUM 字段名
  3. 修改表字段 ALTER TABLE 表名 RENAME COLNUM 旧字段名 TO 新字段名
  • SQLite的线程安全
    http://stackoverflow.com/questions/6675240/is-sqlite-database-instance-thread-safe
    No, it is not thread-safe by default. You shoud use locking-related SQLiteHelper methods to provide thread safety.
    http://stackoverflow.com/questions/11058098/interprocess-sqlite-thread-safety-on-ios
    I've never used SQLite, but I've spent a decent amount of time reading its docs because I plan on using it in the future (and the docs are interesting). I'd say that thread safety is independent of whether multiple processes can access the same database file at once. SQLite, regardless of what threading mode it is in, will lock the database file, so that multiple processes can read from the database at once but only one can write.
    Thread safety only affects how your process can use SQLite. Without any thread safety, you can only call SQLite functions from one thread. But it should still, say, take an EXCLUSIVE lock before writing, so that other processes can't corrupt the database file. Thread safety just protects data in your process's memory from getting corrupted if you use multiple threads. So I don't think you ever need to worry about what another process (in this case iOS) is doing with an SQLite database.
    Edit: To clarify, any time you write to the database, including a plain INSERT
    /UPDATE
    /DELETE
    , it will automatically take an EXCLUSIVE lock, write to the database, then release the lock. (And it actually takes a SHARED lock, then a RESERVED lock, then a PENDING lock, then an EXCLUSIVE lock before writing.) By default, if the database is already locked (say from another process), then SQLite will return SQLITE_BUSY without waiting. You can call sqlite3_busy_timeout()
    to tell it to wait longer.

  • CoreData的线程安全
    看到知乎上有人说core data是支持多线程的,但需要thread confinement的方式实现,使用了多线程之后可以最大化的防止阻塞主线程。待实验

相关文章

  • SQLite相关

    SQLite语句 增加表字段 ALTER TABLE 表名 ADD COLNUM 字段名 字段类型 删除表字段 A...

  • SQLite相关总结

    最近由于sqlite数据库操作不当出了一些问题,主要是由于升级导致的,具体原因不说了,总结一下在这次修复过程中总结...

  • Sqlite 相关的

    http://www.runoob.com/sqlite/sqlite-tutorial.htmlhttp://b...

  • SQLite 删除表

    SQLite 删除表 SQLite 的 DROP TABLE 语句用来删除表定义及其所有相关数据、索引、触发器、约...

  • sqlite 的分布式实现方案:rqlite

    rqlite 相关操作说明 项目总为实现 sqlite 添加账号和密码,以满足信息安全的需求。鉴于对 sqlite...

  • IOS开发过程遇到的工程错误记录:

    问题1: 编译无法通过,出现错误: 一般出现这种和 _sqlite 相关的错误,表示缺少sqlite依赖库,解决方...

  • Xamarin SQLite教程数据库访问与生成

    Xamarin SQLite教程数据库访问与生成 在本教程中,我们将讲解如何开发SQLite相关的App。在编写程...

  • SQLite 视图(View)

    SQLite 视图(View) 视图(View)只不过是通过相关的名称存储在数据库中的一个 SQLite 语句。视...

  • 修复sqlite3数据库,database disk image

    利用Python将sqlite修复相关的命令封装了一下,并且针对sqlite导出的临时文件最后一行默认是Rollb...

  • SQLite3 相关记录

    1. 手机内安装 sqlite3 命令工具 busybox 的下载,去应用商店安装 用命令 “uname -a” ...

网友评论

      本文标题:SQLite相关

      本文链接:https://www.haomeiwen.com/subject/rciflttx.html