System.Data.SQLite

Check-in [5e37af01d9]
Login

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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5e37af01d9aceb5ae202c93af09e805ed2d0606b
User & Date: mistachkin 2015-12-02 05:34:41.827
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
Unified Diff Show Whitespace Changes Patch
Changes to System.Data.SQLite/SQLiteModule.cs.
1054
1055
1056
1057
1058
1059
1060


















1061
1062
1063
1064
1065
1066
1067
                return true;

            return false;
        }

        ///////////////////////////////////////////////////////////////////////



















        #region Public Properties
        private SQLiteIndexConstraintUsage[] constraintUsages;
        /// <summary>
        /// An array of <see cref="SQLiteIndexConstraintUsage" /> object
        /// instances, each containing information to be supplied to the SQLite
        /// core library.
        /// </summary>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
                return true;

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines if the native flags field can be used, based on the
        /// available version of the SQLite core library.
        /// </summary>
        /// <returns>
        /// Non-zero if the <see cref="ColUsed" /> property is supported by
        /// the SQLite core library.
        /// </returns>
        public bool CanUseColUsed()
        {
            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3010000)
                return true;

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private SQLiteIndexConstraintUsage[] constraintUsages;
        /// <summary>
        /// An array of <see cref="SQLiteIndexConstraintUsage" /> object
        /// instances, each containing information to be supplied to the SQLite
        /// core library.
        /// </summary>
1161
1162
1163
1164
1165
1166
1167
























1168
1169
1170
1171
1172
1173
1174
        /// version 3.9.0.
        /// </summary>
        public SQLiteIndexFlags? IdxFlags
        {
            get { return idxFlags; }
            set { idxFlags = value; }
        }
























        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndex Helper Class







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
        /// version 3.9.0.
        /// </summary>
        public SQLiteIndexFlags? IdxFlags
        {
            get { return idxFlags; }
            set { idxFlags = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private long? colUsed;
        /// <summary>
        /// The colUsed field indicates which columns of the virtual table
        /// may be required by the current scan.  Virtual table columns are
        /// numbered from zero in the order in which they appear within the
        /// CREATE TABLE statement passed to sqlite3_declare_vtab().  For the
        /// first 63 columns (columns 0-62), the corresponding bit is set
        /// within the colUsed mask if the column may be required by SQLite.
        /// If the table has at least 64 columns and any column to the right
        /// of the first 63 is required, then bit 63 of colUsed is also set.
        /// In other words, column iCol may be required if the expression
        /// (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol)))
        /// evaluates to non-zero.  Using a null value here indicates that a
        /// default flags value should be used.  This property has no effect
        /// if the SQLite core library is not at least version 3.10.0.
        /// </summary>
        public long? ColUsed
        {
            get { return colUsed; }
            set { colUsed = value; }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndex Helper Class
1397
1398
1399
1400
1401
1402
1403







1404
1405
1406
1407
1408
1409
1410

            if (index.Outputs.CanUseIdxFlags() &&
                index.Outputs.IdxFlags.HasValue)
            {
                SQLiteMarshal.WriteInt32(pIndex, offset,
                   (int)index.Outputs.IdxFlags.GetValueOrDefault());
            }







        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private SQLiteIndexInputs inputs;







>
>
>
>
>
>
>







1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459

            if (index.Outputs.CanUseIdxFlags() &&
                index.Outputs.IdxFlags.HasValue)
            {
                SQLiteMarshal.WriteInt32(pIndex, offset,
                   (int)index.Outputs.IdxFlags.GetValueOrDefault());
            }

            if (index.Outputs.CanUseColUsed() &&
                index.Outputs.ColUsed.HasValue)
            {
                SQLiteMarshal.WriteInt64(pIndex, offset,
                    index.Outputs.ColUsed.GetValueOrDefault());
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private SQLiteIndexInputs inputs;