System.Data.SQLite
Check-in [5e37af01d9]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Support the colUsed field to the sqlite3_index_info structure passed to virtual table xBestIndex methods.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5e37af01d9aceb5ae202c93af09e805ed2d0606b
User & Date: mistachkin 2015-12-02 05:34:41
Context
2015-12-02
05:40
Be sure to increment the structure offset to account for optional sqlite3_index_info members. check-in: 189db19efc user: mistachkin tags: trunk
05:34
Support the colUsed field to the sqlite3_index_info structure passed to virtual table xBestIndex methods. check-in: 5e37af01d9 user: mistachkin tags: trunk
2015-12-01
19:03
Update the MSVCRT runtimes for VS 2015 in externals to 'Update 1'. check-in: 7866eaefcc user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteModule.cs.

  1054   1054                   return true;
  1055   1055   
  1056   1056               return false;
  1057   1057           }
  1058   1058   
  1059   1059           ///////////////////////////////////////////////////////////////////////
  1060   1060   
         1061  +        /// <summary>
         1062  +        /// Determines if the native flags field can be used, based on the
         1063  +        /// available version of the SQLite core library.
         1064  +        /// </summary>
         1065  +        /// <returns>
         1066  +        /// Non-zero if the <see cref="ColUsed" /> property is supported by
         1067  +        /// the SQLite core library.
         1068  +        /// </returns>
         1069  +        public bool CanUseColUsed()
         1070  +        {
         1071  +            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3010000)
         1072  +                return true;
         1073  +
         1074  +            return false;
         1075  +        }
         1076  +
         1077  +        ///////////////////////////////////////////////////////////////////////
         1078  +
  1061   1079           #region Public Properties
  1062   1080           private SQLiteIndexConstraintUsage[] constraintUsages;
  1063   1081           /// <summary>
  1064   1082           /// An array of <see cref="SQLiteIndexConstraintUsage" /> object
  1065   1083           /// instances, each containing information to be supplied to the SQLite
  1066   1084           /// core library.
  1067   1085           /// </summary>
................................................................................
  1161   1179           /// version 3.9.0.
  1162   1180           /// </summary>
  1163   1181           public SQLiteIndexFlags? IdxFlags
  1164   1182           {
  1165   1183               get { return idxFlags; }
  1166   1184               set { idxFlags = value; }
  1167   1185           }
         1186  +
         1187  +        ///////////////////////////////////////////////////////////////////////
         1188  +
         1189  +        private long? colUsed;
         1190  +        /// <summary>
         1191  +        /// The colUsed field indicates which columns of the virtual table
         1192  +        /// may be required by the current scan.  Virtual table columns are
         1193  +        /// numbered from zero in the order in which they appear within the
         1194  +        /// CREATE TABLE statement passed to sqlite3_declare_vtab().  For the
         1195  +        /// first 63 columns (columns 0-62), the corresponding bit is set
         1196  +        /// within the colUsed mask if the column may be required by SQLite.
         1197  +        /// If the table has at least 64 columns and any column to the right
         1198  +        /// of the first 63 is required, then bit 63 of colUsed is also set.
         1199  +        /// In other words, column iCol may be required if the expression
         1200  +        /// (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol)))
         1201  +        /// evaluates to non-zero.  Using a null value here indicates that a
         1202  +        /// default flags value should be used.  This property has no effect
         1203  +        /// if the SQLite core library is not at least version 3.10.0.
         1204  +        /// </summary>
         1205  +        public long? ColUsed
         1206  +        {
         1207  +            get { return colUsed; }
         1208  +            set { colUsed = value; }
         1209  +        }
  1168   1210           #endregion
  1169   1211       }
  1170   1212       #endregion
  1171   1213   
  1172   1214       ///////////////////////////////////////////////////////////////////////////
  1173   1215   
  1174   1216       #region SQLiteIndex Helper Class
................................................................................
  1397   1439   
  1398   1440               if (index.Outputs.CanUseIdxFlags() &&
  1399   1441                   index.Outputs.IdxFlags.HasValue)
  1400   1442               {
  1401   1443                   SQLiteMarshal.WriteInt32(pIndex, offset,
  1402   1444                      (int)index.Outputs.IdxFlags.GetValueOrDefault());
  1403   1445               }
         1446  +
         1447  +            if (index.Outputs.CanUseColUsed() &&
         1448  +                index.Outputs.ColUsed.HasValue)
         1449  +            {
         1450  +                SQLiteMarshal.WriteInt64(pIndex, offset,
         1451  +                    index.Outputs.ColUsed.GetValueOrDefault());
         1452  +            }
  1404   1453           }
  1405   1454           #endregion
  1406   1455   
  1407   1456           ///////////////////////////////////////////////////////////////////////
  1408   1457   
  1409   1458           #region Public Properties
  1410   1459           private SQLiteIndexInputs inputs;