Beispiel #1
0
        public void JetHandleToString()
        {
            var handle = new JET_HANDLE {
                Value = (IntPtr)0x123ABC
            };

            Assert.AreEqual("JET_HANDLE(0x123abc)", handle.ToString());
        }
        public void JetHandleToStringFormat()
        {
            var value = new JET_HANDLE {
                Value = (IntPtr)0x123ABC
            };

            Assert.AreEqual("123ABC", string.Format("{0:X}", value));
        }
        public void JetHandleToStringGeneralFormat()
        {
            var value = new JET_HANDLE {
                Value = (IntPtr)0x123ABC
            };

            VerifyIFormattableGeneralEqualsToString(value);
        }
        public void VerifyJetHandleInequality()
        {
            var x = JET_HANDLE.Nil;
            var y = new JET_HANDLE {
                Value = (IntPtr)0x7
            };

            TestUnequalObjects(x, y);
            Assert.IsTrue(x != y);
            Assert.IsFalse(x == y);
        }
        public void VerifyJethandleIsInvalidWorksAsExpected()
        {
            var zero     = JET_HANDLE.Nil;
            var minusOne = new JET_HANDLE()
            {
                Value = new IntPtr(~0)
            };
            var shouldBeValid = new JET_HANDLE()
            {
                Value = new IntPtr(4)
            };

            Assert.IsTrue(zero.IsInvalid);
            Assert.IsTrue(minusOne.IsInvalid);
            Assert.IsFalse(shouldBeValid.IsInvalid);
        }
Beispiel #6
0
 public void JetHandleToString()
 {
     var handle = new JET_HANDLE { Value = (IntPtr)0x123ABC };
     Assert.AreEqual("JET_HANDLE(0x123abc)", handle.ToString());
 }
Beispiel #7
0
 /// <summary>
 /// Retrieves the contents of a file opened with <see cref="Api.JetOpenFileInstance"/>.
 /// </summary>
 /// <param name="instance">The instance to use.</param>
 /// <param name="file">The file to read from.</param>
 /// <param name="buffer">The buffer to read into.</param>
 /// <param name="bufferSize">The size of the buffer.</param>
 /// <param name="bytesRead">Returns the amount of data read into the buffer.</param>
 public static void JetReadFileInstance(JET_INSTANCE instance, JET_HANDLE file, byte[] buffer, int bufferSize, out int bytesRead)
 {
     Api.Check(Impl.JetReadFileInstance(instance, file, buffer, bufferSize, out bytesRead));
 }
Beispiel #8
0
 /// <summary>
 /// Opens an attached database, database patch file, or transaction log
 /// file of an active instance for the purpose of performing a streaming
 /// fuzzy backup. The data from these files can subsequently be read
 /// through the returned handle using JetReadFileInstance. The returned
 /// handle must be closed using JetCloseFileInstance. An external backup
 /// of the instance must have been previously initiated using
 /// JetBeginExternalBackupInstance.
 /// </summary>
 /// <param name="instance">The instance to use.</param>
 /// <param name="file">The file to open.</param>
 /// <param name="handle">Returns a handle to the file.</param>
 /// <param name="fileSizeLow">Returns the least significant 32 bits of the file size.</param>
 /// <param name="fileSizeHigh">Returns the most significant 32 bits of the file size.</param>
 public static void JetOpenFileInstance(JET_INSTANCE instance, string file, out JET_HANDLE handle, out long fileSizeLow, out long fileSizeHigh)
 {
     Api.Check(Impl.JetOpenFileInstance(instance, file, out handle, out fileSizeLow, out fileSizeHigh));
 }
Beispiel #9
0
 /// <summary>
 /// Closes a file that was opened with JetOpenFileInstance after the
 /// data from that file has been extracted using JetReadFileInstance.
 /// </summary>
 /// <param name="instance">The instance to use.</param>
 /// <param name="handle">The handle to close.</param>
 public static void JetCloseFileInstance(JET_INSTANCE instance, JET_HANDLE handle)
 {
     Api.Check(Impl.JetCloseFileInstance(instance, handle));
 }
Beispiel #10
0
 /// <summary>
 /// Configures the database engine to stop issuing notifications to the
 /// application as previously requested through
 /// <see cref="JetRegisterCallback"/>.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="tableid">
 /// A cursor opened on the table that the callback should be
 /// registered on.
 /// </param>
 /// <param name="cbtyp">
 /// The callback reasons for which the application no longer wishes to receive notifications.
 /// </param>
 /// <param name="callbackId">
 /// The handle of the registered callback that was returned by <see cref="JetRegisterCallback"/>.
 /// </param>
 public static void JetUnregisterCallback(JET_SESID sesid, JET_TABLEID tableid, JET_cbtyp cbtyp, JET_HANDLE callbackId)
 {
     Api.Check(Impl.JetUnregisterCallback(sesid, tableid, cbtyp, callbackId));
 }
Beispiel #11
0
 /// <summary>
 /// Allows the application to configure the database engine to issue
 /// notifications to the application for specific events. These
 /// notifications are associated with a specific table and remain in
 /// effect only until the instance containing the table is shut down
 /// using <see cref="JetTerm"/>.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="tableid">
 /// A cursor opened on the table that the callback should be
 /// registered on.
 /// </param>
 /// <param name="cbtyp">
 /// The callback reasons for which the application wishes to receive notifications.
 /// </param>
 /// <param name="callback">The callback function.</param>
 /// <param name="context">A context that will be given to the callback.</param>
 /// <param name="callbackId">
 /// A handle that can later be used to cancel the registration of the given
 /// callback function using <see cref="JetUnregisterCallback"/>.
 /// </param>
 public static void JetRegisterCallback(
     JET_SESID sesid,
     JET_TABLEID tableid,
     JET_cbtyp cbtyp,
     JET_CALLBACK callback,
     IntPtr context,
     out JET_HANDLE callbackId)
 {
     Api.Check(Impl.JetRegisterCallback(sesid, tableid, cbtyp, callback, context, out callbackId));
 }
Beispiel #12
0
 public void JetHandleToStringFormat()
 {
     var value = new JET_HANDLE { Value = (IntPtr)0x123ABC };
     Assert.AreEqual("123ABC", String.Format("{0:X}", value));
 }
Beispiel #13
0
 public void JetHandleToStringGeneralFormat()
 {
     var value = new JET_HANDLE { Value = (IntPtr)0x123ABC };
     VerifyIFormattableGeneralEqualsToString(value);
 }