什么“海螺文件”在SQLite中意味着什么?

时间:2014-02-10 09:44:58

标签: android sqlite

proxyCreateUnixFile() 创建一个新的VFS文件描述符(存储在从sqlite3_malloc获取的内存中)并在文件描述符中打开名为“path”的文件。调用者不仅负责关闭文件描述符,还负责释放与文件描述符相关的内存。

/* 1. first try to open/create the file
** 2. if that fails, and this is a lock file (not-conch), try creating
** the parent directories and then try again.
** 3. if that fails, try to open the file read-only 
** otherwise return BUSY (if lock file) or CANTOPEN for the conch file
*/

相关代码如下:

  if( fd<0 ){
    openFlags = O_RDONLY;
    fd = robust_open(path, openFlags, 0);
    terrno = errno;
  }
  if( fd<0 ){
    if( islockfile ){
      return SQLITE_BUSY;
    }
    switch (terrno) {
      case EACCES:
        return SQLITE_PERM;
      case EIO: 
        return SQLITE_IOERR_LOCK; /* even though it is the conch */
      default:
        return SQLITE_CANTOPEN_BKPT;
    }

谢谢!

0 个答案:

没有答案