Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add Index property and BestIndex method to the SQLiteVirtualTable class. Make the EstimatedCost property of the SQLiteIndexOutputs class nullable. Refactor BestIndex handling performed by the SQLiteModuleEnumerable class. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
dd7bbf3a2cfd47fff14f433a77738df9 |
User & Date: | mistachkin 2013-07-17 10:03:26.455 |
Context
2013-07-17
| ||
10:14 | Improve consistency of error message. check-in: 0613f370e4 user: mistachkin tags: trunk | |
10:03 | Add Index property and BestIndex method to the SQLiteVirtualTable class. Make the EstimatedCost property of the SQLiteIndexOutputs class nullable. Refactor BestIndex handling performed by the SQLiteModuleEnumerable class. check-in: dd7bbf3a2c user: mistachkin tags: trunk | |
08:25 | Add another vtable test. check-in: 430fef73ed user: mistachkin tags: trunk | |
Changes
Changes to System.Data.SQLite/SQLiteModule.cs.
︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 | { get { return orderByConsumed; } set { orderByConsumed = value; } } /////////////////////////////////////////////////////////////////////// | | | > | > > > > > > > > > > | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | { get { return orderByConsumed; } set { orderByConsumed = value; } } /////////////////////////////////////////////////////////////////////// private double? estimatedCost; /// <summary> /// Estimated cost of using this index. Using a null value here /// indicates that a default estimated cost value should be used. /// </summary> public double? EstimatedCost { get { return estimatedCost; } set { estimatedCost = value; } } #endregion } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteIndex Helper Class /// <summary> /// This class represents the various inputs and outputs used with the /// <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </summary> public sealed class SQLiteIndex { #region Private Constants /// <summary> /// The default estimated cost for use with the /// <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </summary> internal static readonly double DefaultEstimatedCost = double.MaxValue; #endregion /////////////////////////////////////////////////////////////////////// #region Internal Constructors /// <summary> /// Constructs an instance of this class. /// </summary> /// <param name="nConstraint"> /// The number of <see cref="SQLiteIndexConstraint" /> (and /// <see cref="SQLiteIndexConstraintUsage" />) instances to |
︙ | ︙ | |||
1255 1256 1257 1258 1259 1260 1261 | SQLiteMarshal.WriteInt32(pIndex, offset, index.Outputs.OrderByConsumed); offset = SQLiteMarshal.NextOffsetOf(offset, sizeof(int), sizeof(double)); SQLiteMarshal.WriteDouble(pIndex, offset, | | | 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | SQLiteMarshal.WriteInt32(pIndex, offset, index.Outputs.OrderByConsumed); offset = SQLiteMarshal.NextOffsetOf(offset, sizeof(int), sizeof(double)); SQLiteMarshal.WriteDouble(pIndex, offset, index.Outputs.EstimatedCost.GetValueOrDefault()); } #endregion /////////////////////////////////////////////////////////////////////// #region Public Properties private SQLiteIndexInputs inputs; |
︙ | ︙ | |||
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 | } else { return null; } } } #endregion /////////////////////////////////////////////////////////////////////// #region Public Methods /// <summary> /// Attempts to record the renaming of the virtual table associated /// with this object instance. /// </summary> /// <param name="name"> /// The new name for the virtual table. /// </param> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 | } else { return null; } } } /////////////////////////////////////////////////////////////////////// private SQLiteIndex index; /// <summary> /// The <see cref="SQLiteIndex" /> object instance containing all the /// data for the inputs and outputs relating to the most recent index /// selection. /// </summary> public virtual SQLiteIndex Index { get { CheckDisposed(); return index; } } #endregion /////////////////////////////////////////////////////////////////////// #region Public Methods /// <summary> /// This method should normally be used by the /// <see cref="ISQLiteManagedModule.BestIndex" /> method in order to /// perform index selection based on the constraints provided by the /// SQLite core library. /// </summary> /// <param name="index"> /// The <see cref="SQLiteIndex" /> object instance containing all the /// data for the inputs and outputs relating to index selection. /// </param> /// <returns> /// Non-zero upon success. /// </returns> public virtual bool BestIndex( SQLiteIndex index ) { CheckDisposed(); this.index = index; return true; } /////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to record the renaming of the virtual table associated /// with this object instance. /// </summary> /// <param name="name"> /// The new name for the virtual table. /// </param> |
︙ | ︙ | |||
5208 5209 5210 5211 5212 5213 5214 | #endregion } #endregion /////////////////////////////////////////////////////////////////////// #region Private Constants | < < < < < < < < | 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 | #endregion } #endregion /////////////////////////////////////////////////////////////////////// #region Private Constants /// <summary> /// The default version of the native sqlite3_module structure in use. /// </summary> private static readonly int DefaultModuleVersion = 2; #endregion /////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
6720 6721 6722 6723 6724 6725 6726 | /// <returns> /// Non-zero upon success. /// </returns> protected virtual bool SetEstimatedCost( SQLiteIndex index ) { | | | 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 | /// <returns> /// Non-zero upon success. /// </returns> protected virtual bool SetEstimatedCost( SQLiteIndex index ) { return SetEstimatedCost(index, SQLiteIndex.DefaultEstimatedCost); } #endregion #endregion /////////////////////////////////////////////////////////////////////// #region Public Properties |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteModuleEnumerable.cs.
︙ | ︙ | |||
551 552 553 554 555 556 557 | public override SQLiteErrorCode BestIndex( SQLiteVirtualTable table, SQLiteIndex index ) { CheckDisposed(); | | | > > | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | public override SQLiteErrorCode BestIndex( SQLiteVirtualTable table, SQLiteIndex index ) { CheckDisposed(); if (!table.BestIndex(index)) { SetTableError(table, "failed to select best index for virtual table"); return SQLiteErrorCode.Error; } return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// |
︙ | ︙ |