/// <summary> /// Resizes a currently open database. Windows 8: Only supports growing a database file. /// Windows 8.1: When <see cref="InstanceParameters.EnableShrinkDatabase"/> is set to /// <see cref="Win81.ShrinkDatabaseGrbit.On"/>, and if the /// file system supports Sparse Files, then space may be freed up in the middle of the /// file. /// </summary> /// <remarks> /// Many APIs return the logical size of the file, not how many bytes it takes up on disk. /// Win32's GetCompressedFileSize returns the correct on-disk size. /// <see cref="Api.JetGetDatabaseInfo(JET_SESID, JET_DBID, out int, JET_DbInfo)"/> /// returns the on-disk size when used with /// <see cref="Win81.Windows81DbInfo.FilesizeOnDisk"/> /// </remarks> /// <param name="sesid">The session to use.</param> /// <param name="dbid">The database to grow.</param> /// <param name="desiredPages">The desired size of the database, in pages.</param> /// <param name="actualPages">The size of the database, in pages, after the call. </param> /// <param name="grbit">Resize options.</param> public static void JetResizeDatabase( JET_SESID sesid, JET_DBID dbid, int desiredPages, out int actualPages, ResizeDatabaseGrbit grbit) { Api.Check(Api.Impl.JetResizeDatabase(sesid, dbid, desiredPages, out actualPages, grbit)); }
/// <summary> /// Resizes a currently open database. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="dbid">The database to grow.</param> /// <param name="desiredPages">The desired size of the database, in pages.</param> /// <param name="actualPages">The size of the database, in pages, after the call. </param> /// <param name="grbit">Resize options.</param> public static void JetResizeDatabase( JET_SESID sesid, JET_DBID dbid, int desiredPages, out int actualPages, ResizeDatabaseGrbit grbit) { Api.Check(Api.Impl.JetResizeDatabase(sesid, dbid, desiredPages, out actualPages, grbit)); }
/// <summary> /// Resizes a currently open database. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="dbid">The database to grow.</param> /// <param name="desiredPages">The desired size of the database, in pages.</param> /// <param name="actualPages">The size of the database, in pages, after the call. </param> /// <param name="grbit">Resize options.</param> /// <returns>An error code.</returns> public int JetResizeDatabase( JET_SESID sesid, JET_DBID dbid, int desiredPages, out int actualPages, ResizeDatabaseGrbit grbit) { TraceFunctionCall("JetResizeDatabase"); this.CheckSupportsWindows8Features("JetResizeDatabase"); CheckNotNegative(desiredPages, "desiredPages"); uint actualPagesNative = 0; int err = Err(NativeMethods.JetResizeDatabase( sesid.Value, dbid.Value, checked((uint)desiredPages), out actualPagesNative, (uint)grbit)); actualPages = checked((int)actualPagesNative); return err; }
/// <summary> /// Resizes a currently open database. /// </summary> /// <param name="sesid">The session to use.</param> /// <param name="dbid">The database to grow.</param> /// <param name="desiredPages">The desired size of the database, in pages.</param> /// <param name="actualPages">The size of the database, in pages, after the call. </param> /// <param name="grbit">Resize options.</param> /// <returns>An error code.</returns> public int JetResizeDatabase( JET_SESID sesid, JET_DBID dbid, int desiredPages, out int actualPages, ResizeDatabaseGrbit grbit) { TraceFunctionCall(); this.CheckSupportsWindows8Features("JetResizeDatabase"); CheckNotNegative(desiredPages, "desiredPages"); uint actualPagesNative = 0; int err = Err(NativeMethods.JetResizeDatabase( sesid.Value, dbid.Value, checked ((uint)desiredPages), out actualPagesNative, (uint)grbit)); actualPages = checked ((int)actualPagesNative); return(err); }