Index: System.Data.SQLite/SQLiteModule.cs
==================================================================
--- System.Data.SQLite/SQLiteModule.cs
+++ System.Data.SQLite/SQLiteModule.cs
@@ -673,10 +673,33 @@
}
#endregion
///////////////////////////////////////////////////////////////////////////
+ #region SQLiteIndexFlags Enumeration
+ ///
+ /// These are the allowed values for the output flags from the
+ /// method.
+ ///
+ [Flags()]
+ public enum SQLiteIndexFlags
+ {
+ ///
+ /// No special handling. This is the default.
+ ///
+ None = 0x0,
+
+ ///
+ /// This value indicates that the scan of the index will visit at
+ /// most one row.
+ ///
+ ScanUnique = 0x1
+ }
+ #endregion
+
+ ///////////////////////////////////////////////////////////////////////////
+
#region SQLiteIndexConstraint Helper Class
///
/// This class represents the native sqlite3_index_constraint structure
/// from the SQLite core library.
///
@@ -1015,10 +1038,28 @@
return false;
}
///////////////////////////////////////////////////////////////////////
+ ///
+ /// Determines if the native flags field can be used, based on the
+ /// available version of the SQLite core library.
+ ///
+ ///
+ /// Non-zero if the property is supported by the
+ /// SQLite core library.
+ ///
+ public bool CanUseFlags()
+ {
+ if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3008012)
+ return true;
+
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+
#region Public Properties
private SQLiteIndexConstraintUsage[] constraintUsages;
///
/// An array of object
/// instances, each containing information to be supplied to the SQLite
@@ -1105,10 +1146,22 @@
public long? EstimatedRows
{
get { return estimatedRows; }
set { estimatedRows = value; }
}
+
+ ///////////////////////////////////////////////////////////////////////
+
+ private SQLiteIndexFlags? flags;
+ ///
+ /// The flags that should be used with this index.
+ ///
+ public SQLiteIndexFlags? Flags
+ {
+ get { return flags; }
+ set { flags = value; }
+ }
#endregion
}
#endregion
///////////////////////////////////////////////////////////////////////////
@@ -1334,10 +1387,17 @@
index.Outputs.EstimatedRows.HasValue)
{
SQLiteMarshal.WriteInt64(pIndex, offset,
index.Outputs.EstimatedRows.GetValueOrDefault());
}
+
+ if (index.Outputs.CanUseFlags() &&
+ index.Outputs.Flags.HasValue)
+ {
+ SQLiteMarshal.WriteInt32(pIndex, offset,
+ (int)index.Outputs.Flags.GetValueOrDefault());
+ }
}
#endregion
///////////////////////////////////////////////////////////////////////
@@ -7175,10 +7235,57 @@
SQLiteIndex index
)
{
return SetEstimatedRows(index, null);
}
+
+ ///////////////////////////////////////////////////////////////////////
+
+ ///
+ /// Modifies the specified object instance
+ /// to contain the specified flags.
+ ///
+ ///
+ /// The object instance to modify.
+ ///
+ ///
+ /// The flags value to use. Using a null value means that the default
+ /// value provided by the SQLite core library should be used.
+ ///
+ ///
+ /// Non-zero upon success.
+ ///
+ protected virtual bool SetFlags(
+ SQLiteIndex index,
+ int? flags
+ )
+ {
+ if ((index == null) || (index.Outputs == null))
+ return false;
+
+ index.Outputs.Flags = flags;
+ return true;
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+
+ ///
+ /// Modifies the specified object instance
+ /// to contain the default flags.
+ ///
+ ///
+ /// The object instance to modify.
+ ///
+ ///
+ /// Non-zero upon success.
+ ///
+ protected virtual bool SetFlags(
+ SQLiteIndex index
+ )
+ {
+ return SetFlags(index, null);
+ }
#endregion
#endregion
///////////////////////////////////////////////////////////////////////