예제 #1
0
        /// <summary>
        /// Retrieves information about indexes on a table.
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="tableid">The table to retrieve index information about.</param>
        /// <param name="indexname">The name of the index to retrieve information about.</param>
        /// <param name="result">Filled in with information about indexes on the table.</param>
        /// <param name="infoLevel">The type of information to retrieve.</param>
        /// <returns>An error if the call fails.</returns>
        public int JetGetTableIndexInfo(
            JET_SESID sesid,
            JET_TABLEID tableid,
            string indexname,
            out JET_INDEXCREATE result,
            JET_IdxInfo infoLevel)
        {
            TraceFunctionCall();
            int err;

            switch (infoLevel)
            {
            case Microsoft.Isam.Esent.Interop.Windows7.Windows7IdxInfo.CreateIndex:
            case Microsoft.Isam.Esent.Interop.Windows7.Windows7IdxInfo.CreateIndex2:
            case Microsoft.Isam.Esent.Interop.Windows8.Windows8IdxInfo.InfoCreateIndex3:
                break;

            default:
                throw new ArgumentException(string.Format("{0} is not a valid value JET_IdxInfo for this JET_INDEXCREATE overload."));
            }

            if (this.Capabilities.SupportsWindows8Features)
            {
                {
                    int    bufferSize      = 10 * Marshal.SizeOf(typeof(NATIVE_INDEXCREATE3));
                    IntPtr unmanagedBuffer = Marshal.AllocHGlobal(bufferSize);
                    try
                    {
                        // var nativeIndexcreate = new NATIVE_INDEXCREATE3();
                        // nativeIndexcreate.cbStruct = checked((uint)bufferSize);
                        infoLevel = Windows8IdxInfo.InfoCreateIndex3;

                        err = Err(NativeMethods.JetGetTableIndexInfoW(
                                      sesid.Value,
                                      tableid.Value,
                                      indexname,
                                      unmanagedBuffer,
                                      (uint)bufferSize,
                                      (uint)infoLevel));

                        NATIVE_INDEXCREATE3 nativeIndexcreate = (NATIVE_INDEXCREATE3)Marshal.PtrToStructure(unmanagedBuffer, typeof(NATIVE_INDEXCREATE3));

                        result = new JET_INDEXCREATE();
                        result.SetAllFromNativeIndexCreate(ref nativeIndexcreate);
                    }
                    finally
                    {
                        Marshal.FreeHGlobal(unmanagedBuffer);
                    }
                }
            }
            else
            {
                result = null;
                err    = Err((int)JET_err.FeatureNotAvailable);
            }

            return(err);
        }
 /// <summary>
 /// Retrieves information about indexes on a table.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="indexname">The name of the index.</param>
 /// <param name="result">Filled in with information about indexes on the table.</param>
 /// <param name="infoLevel">The type of information to retrieve.</param>
 protected override void GetIndexInfo(
         JET_SESID sesid,
         string indexname,
         out string result,
         JET_IdxInfo infoLevel)
 {
     Api.JetGetTableIndexInfo(sesid, this.tableid, indexname, out result, infoLevel);
 }
 /// <summary>
 /// Retrieves information about indexes on a table.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="indexname">The name of the index.</param>
 /// <param name="result">Filled in with information about indexes on the table.</param>
 /// <param name="infoLevel">The type of information to retrieve.</param>
 protected override void GetIndexInfo(
         JET_SESID sesid,
         string indexname,
         out string result,
         JET_IdxInfo infoLevel)
 {
     Api.JetGetIndexInfo(sesid, this.dbid, this.tablename, indexname, out result, infoLevel);
 }
예제 #4
0
        /// <summary>
        /// Retrieves information about indexes on a table.
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="tableid">The table to retrieve index information about.</param>
        /// <param name="indexname">The name of the index.</param>
        /// <param name="result">Filled in with information about indexes on the table.</param>
        /// <param name="infoLevel">The type of information to retrieve.</param>
        /// <returns>true if there was no error, false if the index wasn't found. Throws for other Jet errors.</returns>
        public static bool TryJetGetTableIndexInfo(
            JET_SESID sesid,
            JET_TABLEID tableid,
            string indexname,
            out JET_INDEXID result,
            JET_IdxInfo infoLevel)
        {
            int err = Impl.JetGetTableIndexInfo(sesid, tableid, indexname, out result, infoLevel);

            if ((JET_err)err == JET_err.IndexNotFound)
            {
                return(false);
            }

            Api.Check(err);

            return(true);
        }
예제 #5
0
 /// <summary>
 /// Retrieves information about indexes on a table.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="indexname">The name of the index.</param>
 /// <param name="result">Filled in with information about indexes on the table.</param>
 /// <param name="infoLevel">The type of information to retrieve.</param>
 protected abstract void GetIndexInfo(
     JET_SESID sesid,
     string indexname,
     out string result,
     JET_IdxInfo infoLevel);
예제 #6
0
        /// <summary>
        /// Retrieves information about indexes on a table.
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="tableid">The table to retrieve index information about.</param>
        /// <param name="indexname">The name of the index.</param>
        /// <param name="result">Filled in with information about indexes on the table.</param>
        /// <param name="infoLevel">The type of information to retrieve.</param>
        /// <returns>true if there was no error, false if the index wasn't found. Throws for other Jet errors.</returns>
        public static bool TryJetGetTableIndexInfo(
            JET_SESID sesid,
            JET_TABLEID tableid,
            string indexname,
            out JET_INDEXID result,
            JET_IdxInfo infoLevel)
        {
            int err = Impl.JetGetTableIndexInfo(sesid, tableid, indexname, out result, infoLevel);

            if ((JET_err)err == JET_err.IndexNotFound)
            {
                return false;
            }

            Api.Check(err);

            return true;
        }
예제 #7
0
파일: Api.cs 프로젝트: 925coder/ravendb
 /// <summary>
 /// Retrieves information about indexes on a table.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="tableid">The table to retrieve index information about.</param>
 /// <param name="indexname">The name of the index.</param>
 /// <param name="result">Filled in with information about indexes on the table.</param>
 /// <param name="infoLevel">The type of information to retrieve.</param>
 public static void JetGetTableIndexInfo(
         JET_SESID sesid,
         JET_TABLEID tableid,
         string indexname,
         out JET_INDEXLIST result,
         JET_IdxInfo infoLevel)
 {
     Api.Check(Impl.JetGetTableIndexInfo(sesid, tableid, indexname, out result, infoLevel));
 }
예제 #8
0
파일: Api.cs 프로젝트: 925coder/ravendb
 /// <summary>
 /// Retrieves information about indexes on a table.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="dbid">The database to use.</param>
 /// <param name="tablename">The name of the table to retrieve index information about.</param>
 /// <param name="indexname">The name of the index to retrieve information about.</param>
 /// <param name="result">Filled in with information about indexes on the table.</param>
 /// <param name="infoLevel">The type of information to retrieve.</param>
 public static void JetGetIndexInfo(
         JET_SESID sesid,
         JET_DBID dbid,
         string tablename,
         string indexname,
         out JET_INDEXLIST result,
         JET_IdxInfo infoLevel)
 {
     Api.Check(Impl.JetGetIndexInfo(sesid, dbid, tablename, indexname, out result, infoLevel));
 }