コード例 #1
0
ファイル: SetupHelper.cs プロジェクト: niratch/managed-esent
        /// <summary>
        /// Creates a standard temp table with a column for each type.
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="grbit">Temporary table options.</param>
        /// <param name="tableid">Returns the temporary table.</param>
        /// <returns>A dictionary mapping types to columns.</returns>
        public static Dictionary <string, JET_COLUMNID> CreateTempTableWithAllColumns(JET_SESID sesid, TempTableGrbit grbit, out JET_TABLEID tableid)
        {
            var columnDefs  = new List <JET_COLUMNDEF>();
            var columnNames = new List <string>();

            columnDefs.Add(new JET_COLUMNDEF {
                coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.TTKey
            });
            columnNames.Add("key");

            foreach (KeyValuePair <string, JET_COLUMNDEF> def in ColumndefDictionary)
            {
                columnNames.Add(def.Key);
                columnDefs.Add(def.Value);
            }

            JET_COLUMNDEF[] columns = columnDefs.ToArray();

            // Make all the columns tagged so they don't appear by default
            for (int i = 0; i < columns.Length; ++i)
            {
                columns[i].grbit |= ColumndefGrbit.ColumnTagged;
            }

            var columnids = new JET_COLUMNID[columns.Length];

            Api.JetOpenTempTable(sesid, columns, columns.Length, grbit, out tableid, columnids);
            var columnidDict = new Dictionary <string, JET_COLUMNID>(StringComparer.OrdinalIgnoreCase);

            for (int i = 0; i < columnids.Length; i++)
            {
                columnidDict[columnNames[i]] = columnids[i];
            }

            return(columnidDict);
        }
コード例 #2
0
ファイル: Api.cs プロジェクト: 925coder/ravendb
 /// <summary>
 /// Creates a temporary table with a single index. A temporary table
 /// stores and retrieves records just like an ordinary table created
 /// using JetCreateTableColumnIndex. However, temporary tables are
 /// much faster than ordinary tables due to their volatile nature.
 /// They can also be used to very quickly sort and perform duplicate
 /// removal on record sets when accessed in a purely sequential manner.
 /// Also see
 /// <seealso cref="Api.JetOpenTempTable"/>,
 /// <seealso cref="Api.JetOpenTempTable2"/>,
 /// <seealso cref="VistaApi.JetOpenTemporaryTable"/>.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="columns">
 /// Column definitions for the columns created in the temporary table.
 /// </param>
 /// <param name="numColumns">Number of column definitions.</param>
 /// <param name="unicodeindex">
 /// The Locale ID and normalization flags that will be used to compare
 /// any Unicode key column data in the temporary table. When this 
 /// is not present then the default options are used. 
 /// </param>
 /// <param name="grbit">Table creation options.</param>
 /// <param name="tableid">
 /// Returns the tableid of the temporary table. Closing this tableid
 /// with <see cref="JetCloseTable"/> frees the resources associated
 /// with the temporary table.
 /// </param>
 /// <param name="columnids">
 /// The output buffer that receives the array of column IDs generated
 /// during the creation of the temporary table. The column IDs in this
 /// array will exactly correspond to the input array of column definitions.
 /// As a result, the size of this buffer must correspond to the size of
 /// the input array.
 /// </param>
 public static void JetOpenTempTable3(
     JET_SESID sesid,
     JET_COLUMNDEF[] columns,
     int numColumns,
     JET_UNICODEINDEX unicodeindex,
     TempTableGrbit grbit,
     out JET_TABLEID tableid,
     JET_COLUMNID[] columnids)
 {
     Api.Check(Impl.JetOpenTempTable3(sesid, columns, numColumns, unicodeindex, grbit, out tableid, columnids));            
 }
コード例 #3
0
ファイル: SetupHelper.cs プロジェクト: j2jensen/ravendb
        /// <summary>
        /// Creates a standard temp table with a column for each type.
        /// </summary>
        /// <param name="sesid">The session to use.</param>
        /// <param name="grbit">Temporary table options.</param>
        /// <param name="tableid">Returns the temporary table.</param>
        /// <returns>A dictionary mapping types to columns.</returns>
        public static Dictionary<string, JET_COLUMNID> CreateTempTableWithAllColumns(JET_SESID sesid, TempTableGrbit grbit, out JET_TABLEID tableid)
        {
            var columnDefs = new List<JET_COLUMNDEF>();
            var columnNames = new List<string>();

            columnDefs.Add(new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.TTKey });
            columnNames.Add("key");

            foreach (KeyValuePair<string, JET_COLUMNDEF> def in ColumndefDictionary)
            {
                columnNames.Add(def.Key);
                columnDefs.Add(def.Value);
            }

            JET_COLUMNDEF[] columns = columnDefs.ToArray();

            // Make all the columns tagged so they don't appear by default
            for (int i = 0; i < columns.Length; ++i)
            {
                columns[i].grbit |= ColumndefGrbit.ColumnTagged;
            }

            var columnids = new JET_COLUMNID[columns.Length];
            Api.JetOpenTempTable(sesid, columns, columns.Length, grbit, out tableid, columnids);
            var columnidDict = new Dictionary<string, JET_COLUMNID>(StringComparer.OrdinalIgnoreCase);
            for (int i = 0; i < columnids.Length; i++)
            {
                columnidDict[columnNames[i]] = columnids[i];
            }

            return columnidDict;
        }
コード例 #4
0
ファイル: Api.cs プロジェクト: 925coder/ravendb
 /// <summary>
 /// Creates a temporary table with a single index. A temporary table
 /// stores and retrieves records just like an ordinary table created
 /// using JetCreateTableColumnIndex. However, temporary tables are
 /// much faster than ordinary tables due to their volatile nature.
 /// They can also be used to very quickly sort and perform duplicate
 /// removal on record sets when accessed in a purely sequential manner.
 /// Also see
 /// <seealso cref="Api.JetOpenTempTable"/>,
 /// <seealso cref="Api.JetOpenTempTable3"/>.
 /// <seealso cref="VistaApi.JetOpenTemporaryTable"/>.
 /// </summary>
 /// <param name="sesid">The session to use.</param>
 /// <param name="columns">
 /// Column definitions for the columns created in the temporary table.
 /// </param>
 /// <param name="numColumns">Number of column definitions.</param>
 /// <param name="lcid">
 /// The locale ID to use to compare any Unicode key column data in the temporary table.
 /// Any locale may be used as long as the appropriate language pack has been installed
 /// on the machine. 
 /// </param>
 /// <param name="grbit">Table creation options.</param>
 /// <param name="tableid">
 /// Returns the tableid of the temporary table. Closing this tableid
 /// with <see cref="JetCloseTable"/> frees the resources associated
 /// with the temporary table.
 /// </param>
 /// <param name="columnids">
 /// The output buffer that receives the array of column IDs generated
 /// during the creation of the temporary table. The column IDs in this
 /// array will exactly correspond to the input array of column definitions.
 /// As a result, the size of this buffer must correspond to the size of
 /// the input array.
 /// </param>
 public static void JetOpenTempTable2(
     JET_SESID sesid,
     JET_COLUMNDEF[] columns,
     int numColumns,
     int lcid,
     TempTableGrbit grbit,
     out JET_TABLEID tableid,
     JET_COLUMNID[] columnids)
 {
     Api.Check(Impl.JetOpenTempTable2(sesid, columns, numColumns, lcid, grbit, out tableid, columnids));
 }