System.Data.SQLite
Check-in [0f9de2621e]
Not logged in

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

Overview
Comment:Managed only changes to support the SQLite core library 'vtab-onepass' branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | vtab-onepass
Files: files | file ages | folders
SHA1: 0f9de2621e3ab55d990bc4edcacf4f15a65f3723
User & Date: mistachkin 2015-09-28 20:19:34
Context
2015-09-29
16:58
Changes to support the 'vtab-onepass' functionality in the SQLite core library. check-in: 80d9c54709 user: mistachkin tags: trunk
2015-09-28
20:19
Managed only changes to support the SQLite core library 'vtab-onepass' branch. Closed-Leaf check-in: 0f9de2621e user: mistachkin tags: vtab-onepass
17:45
Update the SQLite core library to the latest trunk code. check-in: a0f27df53f user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

   671    671           /// </summary>
   672    672           Match = 64
   673    673       }
   674    674       #endregion
   675    675   
   676    676       ///////////////////////////////////////////////////////////////////////////
   677    677   
          678  +    #region SQLiteIndexFlags Enumeration
          679  +    /// <summary>
          680  +    /// These are the allowed values for the output flags from the
          681  +    /// <see cref="ISQLiteManagedModule.BestIndex" /> method.
          682  +    /// </summary>
          683  +    [Flags()]
          684  +    public enum SQLiteIndexFlags
          685  +    {
          686  +        /// <summary>
          687  +        /// No special handling.  This is the default.
          688  +        /// </summary>
          689  +        None = 0x0,
          690  +
          691  +        /// <summary>
          692  +        /// This value indicates that the scan of the index will visit at
          693  +        /// most one row.
          694  +        /// </summary>
          695  +        ScanUnique = 0x1
          696  +    }
          697  +    #endregion
          698  +
          699  +    ///////////////////////////////////////////////////////////////////////////
          700  +
   678    701       #region SQLiteIndexConstraint Helper Class
   679    702       /// <summary>
   680    703       /// This class represents the native sqlite3_index_constraint structure
   681    704       /// from the SQLite core library.
   682    705       /// </summary>
   683    706       public sealed class SQLiteIndexConstraint
   684    707       {
................................................................................
  1013   1036                   return true;
  1014   1037   
  1015   1038               return false;
  1016   1039           }
  1017   1040   
  1018   1041           ///////////////////////////////////////////////////////////////////////
  1019   1042   
         1043  +        /// <summary>
         1044  +        /// Determines if the native flags field can be used, based on the
         1045  +        /// available version of the SQLite core library.
         1046  +        /// </summary>
         1047  +        /// <returns>
         1048  +        /// Non-zero if the <see cref="Flags" /> property is supported by the
         1049  +        /// SQLite core library.
         1050  +        /// </returns>
         1051  +        public bool CanUseFlags()
         1052  +        {
         1053  +            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3008012)
         1054  +                return true;
         1055  +
         1056  +            return false;
         1057  +        }
         1058  +
         1059  +        ///////////////////////////////////////////////////////////////////////
         1060  +
  1020   1061           #region Public Properties
  1021   1062           private SQLiteIndexConstraintUsage[] constraintUsages;
  1022   1063           /// <summary>
  1023   1064           /// An array of <see cref="SQLiteIndexConstraintUsage" /> object
  1024   1065           /// instances, each containing information to be supplied to the SQLite
  1025   1066           /// core library.
  1026   1067           /// </summary>
................................................................................
  1103   1144           /// indicates that a default estimated rows value should be used.
  1104   1145           /// </summary>
  1105   1146           public long? EstimatedRows
  1106   1147           {
  1107   1148               get { return estimatedRows; }
  1108   1149               set { estimatedRows = value; }
  1109   1150           }
         1151  +
         1152  +        ///////////////////////////////////////////////////////////////////////
         1153  +
         1154  +        private SQLiteIndexFlags? flags;
         1155  +        /// <summary>
         1156  +        /// The flags that should be used with this index.
         1157  +        /// </summary>
         1158  +        public SQLiteIndexFlags? Flags
         1159  +        {
         1160  +            get { return flags; }
         1161  +            set { flags = value; }
         1162  +        }
  1110   1163           #endregion
  1111   1164       }
  1112   1165       #endregion
  1113   1166   
  1114   1167       ///////////////////////////////////////////////////////////////////////////
  1115   1168   
  1116   1169       #region SQLiteIndex Helper Class
................................................................................
  1332   1385   
  1333   1386               if (index.Outputs.CanUseEstimatedRows() &&
  1334   1387                   index.Outputs.EstimatedRows.HasValue)
  1335   1388               {
  1336   1389                   SQLiteMarshal.WriteInt64(pIndex, offset,
  1337   1390                       index.Outputs.EstimatedRows.GetValueOrDefault());
  1338   1391               }
         1392  +
         1393  +            if (index.Outputs.CanUseFlags() &&
         1394  +                index.Outputs.Flags.HasValue)
         1395  +            {
         1396  +                SQLiteMarshal.WriteInt32(pIndex, offset,
         1397  +                   (int)index.Outputs.Flags.GetValueOrDefault());
         1398  +            }
  1339   1399           }
  1340   1400           #endregion
  1341   1401   
  1342   1402           ///////////////////////////////////////////////////////////////////////
  1343   1403   
  1344   1404           #region Public Properties
  1345   1405           private SQLiteIndexInputs inputs;
................................................................................
  7173   7233           /// </returns>
  7174   7234           protected virtual bool SetEstimatedRows(
  7175   7235               SQLiteIndex index
  7176   7236               )
  7177   7237           {
  7178   7238               return SetEstimatedRows(index, null);
  7179   7239           }
         7240  +
         7241  +        ///////////////////////////////////////////////////////////////////////
         7242  +
         7243  +        /// <summary>
         7244  +        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
         7245  +        /// to contain the specified flags.
         7246  +        /// </summary>
         7247  +        /// <param name="index">
         7248  +        /// The <see cref="SQLiteIndex" /> object instance to modify.
         7249  +        /// </param>
         7250  +        /// <param name="flags">
         7251  +        /// The flags value to use.  Using a null value means that the default
         7252  +        /// value provided by the SQLite core library should be used.
         7253  +        /// </param>
         7254  +        /// <returns>
         7255  +        /// Non-zero upon success.
         7256  +        /// </returns>
         7257  +        protected virtual bool SetFlags(
         7258  +            SQLiteIndex index,
         7259  +            int? flags
         7260  +            )
         7261  +        {
         7262  +            if ((index == null) || (index.Outputs == null))
         7263  +                return false;
         7264  +
         7265  +            index.Outputs.Flags = flags;
         7266  +            return true;
         7267  +        }
         7268  +
         7269  +        ///////////////////////////////////////////////////////////////////////
         7270  +
         7271  +        /// <summary>
         7272  +        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
         7273  +        /// to contain the default flags.
         7274  +        /// </summary>
         7275  +        /// <param name="index">
         7276  +        /// The <see cref="SQLiteIndex" /> object instance to modify.
         7277  +        /// </param>
         7278  +        /// <returns>
         7279  +        /// Non-zero upon success.
         7280  +        /// </returns>
         7281  +        protected virtual bool SetFlags(
         7282  +            SQLiteIndex index
         7283  +            )
         7284  +        {
         7285  +            return SetFlags(index, null);
         7286  +        }
  7180   7287           #endregion
  7181   7288           #endregion
  7182   7289   
  7183   7290           ///////////////////////////////////////////////////////////////////////
  7184   7291   
  7185   7292           #region Public Properties
  7186   7293           /// <summary>