public string Journal; // Name of the journal file internal RC CreateFile() { RC rc = RC.OK; if (Real == null) { VFile real = null; VSystem.OPEN dummy; rc = Vfs.Open(Journal, Real, Flags, out dummy); if (rc == RC.OK) { Real = real; if (Size > 0) { Debug.Assert(Size <= BufferLength); rc = Real.Write(Buffer, Size, 0); } if (rc != RC.OK) { // If an error occurred while writing to the file, close it before returning. This way, SQLite uses the in-memory journal data to // roll back changes made to the internal page-cache before this function was called. Real.Close(); Real = null; } } } return(rc); }
// extensions #if ENABLE_ATOMIC_WRITE internal static RC JournalVFileOpen(VSystem vfs, string name, ref VFile file, VSystem.OPEN flags, int bufferLength) { var p = new JournalVFile(); if (bufferLength > 0) { p.Buffer = C._allocZero(bufferLength); } else { VSystem.OPEN dummy; return(vfs.Open(name, p, flags, out dummy)); } p.Type = 2; p.BufferLength = bufferLength; p.Flags = flags; p.Journal = name; p.Vfs = vfs; file = p; return(RC.OK); }
// extensions internal static RC JournalVFileOpen(VSystem vfs, string name, ref VFile file, VSystem.OPEN flags, int bufferLength) { var p = new JournalVFile(); if (bufferLength > 0) p.Buffer = SysEx.Alloc(bufferLength, true); else { VSystem.OPEN dummy; return vfs.Open(name, p, flags, out dummy); } p.Type = 2; p.BufferLength = bufferLength; p.Flags = flags; p.Journal = name; p.Vfs = vfs; file = p; return RC.OK; }