Beispiel #1
0
        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);
        }
Beispiel #2
0
 public override RC Close()
 {
     if (Real != null)
     {
         Real.Close();
     }
     Buffer = null;
     return(RC.OK);
 }
Beispiel #3
0
 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;
 }