System.Data.SQLite

Check-in [978cda574b]
Login

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

Overview
Comment:Adjust how the index related input/output structures are represented.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | virtualTables
Files: files | file ages | folders
SHA1: 978cda574bd3306a5efeb78b7cc8e09f35fe40be
User & Date: mistachkin 2013-06-12 21:43:56.230
Context
2013-06-13
22:49
Complete most of the initial virtual table module base class. Some fixes to types for marshalling. check-in: df6776ec88 user: mistachkin tags: virtualTables
2013-06-12
21:43
Adjust how the index related input/output structures are represented. check-in: 978cda574b user: mistachkin tags: virtualTables
2013-06-08
04:15
Add disposal checks to the SQLiteModuleNoop class. check-in: 62d2f9e5bd user: mistachkin tags: virtualTables
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/SQLiteModuleBase.cs.
271
272
273
274
275
276
277













278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304

305

306

307
308
309
310
311








312
313
314
315
316
317
318
        }
        #endregion
    }
    #endregion

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














    public class SQLiteIndexConstraint
    {
        private UnsafeNativeMethods.sqlite3_index_constraint constraint;
    }

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

    public class SQLiteIndexOrderBy
    {
        private UnsafeNativeMethods.sqlite3_index_orderby orderBy;
    }

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

    public class SQLiteIndexConstraintUsage
    {
        private UnsafeNativeMethods.sqlite3_index_constraint_usage constraintUsage;
    }

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

    public class SQLiteIndex
    {
        SQLiteIndexConstraint[] Constraints;
        SQLiteIndexOrderBy[] OrderBys;



        SQLiteIndexConstraintUsage[] ConstraintUsages;



        int idxNum;           /* Number used to identify the index */
        string idxStr;        /* String, possibly obtained from sqlite3_malloc */
        int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
        int orderByConsumed;  /* True if output is already ordered */
        double estimatedCost; /* Estimated cost of using this index */








    }

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

    public class SQLiteVirtualTableCursor
    {
        public SQLiteVirtualTableCursor(







>
>
>
>
>
>
>
>
>
>
>
>
>
|






|






|






|

|
|
|

>
|
>
|
>
|
|
|
|
|
>
>
>
>
>
>
>
>







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
        }
        #endregion
    }
    #endregion

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

    /* [Flags()] */
    public enum SQLiteIndexConstraintOp : byte
    {
        EqualTo = 2,
        GreaterThan = 4,
        LessThanOrEqualTo = 8,
        LessThan = 16,
        GreaterThanOrEqualTo = 32,
        Match = 64
    }

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

    public sealed class SQLiteIndexConstraint
    {
        private UnsafeNativeMethods.sqlite3_index_constraint constraint;
    }

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

    public sealed class SQLiteIndexOrderBy
    {
        private UnsafeNativeMethods.sqlite3_index_orderby orderBy;
    }

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

    public sealed class SQLiteIndexConstraintUsage
    {
        private UnsafeNativeMethods.sqlite3_index_constraint_usage constraintUsage;
    }

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

    public sealed class SQLiteIndexInputs
    {
        private SQLiteIndexConstraint[] Constraints;
        private SQLiteIndexOrderBy[] OrderBys;
    }

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

    public sealed class SQLiteIndexOutputs
    {
        private SQLiteIndexConstraintUsage[] ConstraintUsages;
        private int idxNum;           /* Number used to identify the index */
        private string idxStr;        /* String, possibly obtained from sqlite3_malloc */
        private int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
        private int orderByConsumed;  /* True if output is already ordered */
        private double estimatedCost; /* Estimated cost of using this index */
    }

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

    public sealed class SQLiteIndex
    {
        public SQLiteIndexInputs inputs;
        public SQLiteIndexOutputs outputs;
    }

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

    public class SQLiteVirtualTableCursor
    {
        public SQLiteVirtualTableCursor(
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379

    public interface ISQLiteManagedModule
    {
        bool Declared { get; }

        SQLiteErrorCode Create(SQLiteConnection connection, IntPtr pClientData, string[] argv, ref string error);
        SQLiteErrorCode Connect(SQLiteConnection connection, IntPtr pClientData, string[] argv, ref string error);
        SQLiteErrorCode BestIndex(ref SQLiteIndex index);
        SQLiteErrorCode Disconnect();
        SQLiteErrorCode Destroy();
        SQLiteErrorCode Open(ref SQLiteVirtualTableCursor cursor);
        SQLiteErrorCode Close(SQLiteVirtualTableCursor cursor);
        SQLiteErrorCode Filter(SQLiteVirtualTableCursor cursor, int idxNum, string idxStr, SQLiteValue[] argv);
        SQLiteErrorCode Next(SQLiteVirtualTableCursor cursor);
        SQLiteErrorCode Eof(SQLiteVirtualTableCursor cursor);







|







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403

    public interface ISQLiteManagedModule
    {
        bool Declared { get; }

        SQLiteErrorCode Create(SQLiteConnection connection, IntPtr pClientData, string[] argv, ref string error);
        SQLiteErrorCode Connect(SQLiteConnection connection, IntPtr pClientData, string[] argv, ref string error);
        SQLiteErrorCode BestIndex(SQLiteIndex index);
        SQLiteErrorCode Disconnect();
        SQLiteErrorCode Destroy();
        SQLiteErrorCode Open(ref SQLiteVirtualTableCursor cursor);
        SQLiteErrorCode Close(SQLiteVirtualTableCursor cursor);
        SQLiteErrorCode Filter(SQLiteVirtualTableCursor cursor, int idxNum, string idxStr, SQLiteValue[] argv);
        SQLiteErrorCode Next(SQLiteVirtualTableCursor cursor);
        SQLiteErrorCode Eof(SQLiteVirtualTableCursor cursor);
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
            string[] argv,
            ref string error
            );

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

        public abstract SQLiteErrorCode BestIndex(
            ref SQLiteIndex index
            );

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

        public abstract SQLiteErrorCode Disconnect();

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







|







1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
            string[] argv,
            ref string error
            );

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

        public abstract SQLiteErrorCode BestIndex(
            SQLiteIndex index
            );

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

        public abstract SQLiteErrorCode Disconnect();

        ///////////////////////////////////////////////////////////////////////
Changes to System.Data.SQLite/SQLiteModuleNoop.cs.
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
            CheckDisposed();
            throw new NotImplementedException();
        }

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

        public override SQLiteErrorCode BestIndex(
            ref SQLiteIndex index
            )
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

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







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
            CheckDisposed();
            throw new NotImplementedException();
        }

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

        public override SQLiteErrorCode BestIndex(
            SQLiteIndex index
            )
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

        ///////////////////////////////////////////////////////////////////////
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937

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

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_index_constraint
    {
        public int iColumn;
        public byte op;
        public byte usable;
        public int iTermOffset;
    }

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

    [StructLayout(LayoutKind.Sequential)]







|







1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937

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

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_index_constraint
    {
        public int iColumn;
        public SQLiteIndexConstraintOp op;
        public byte usable;
        public int iTermOffset;
    }

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

    [StructLayout(LayoutKind.Sequential)]
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
        public int idxNum;           /* Number used to identify the index */
        public string idxStr;        /* String, possibly obtained from sqlite3_malloc */
        public int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
        public int orderByConsumed;  /* True if output is already ordered */
        public double estimatedCost; /* Estimated cost of using this index */
    }
    #endregion

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

    private static readonly int SQLITE_INDEX_CONSTRAINT_EQ = 2;
    private static readonly int SQLITE_INDEX_CONSTRAINT_GT = 4;
    private static readonly int SQLITE_INDEX_CONSTRAINT_LE = 8;
    private static readonly int SQLITE_INDEX_CONSTRAINT_LT = 16;
    private static readonly int SQLITE_INDEX_CONSTRAINT_GE = 32;
    private static readonly int SQLITE_INDEX_CONSTRAINT_MATCH = 64;
  }

#if PLATFORM_COMPACTFRAMEWORK
  internal abstract class CriticalHandle : IDisposable
  {
    private bool _isClosed;
    protected IntPtr handle;







<
<
<
<
<
<
<
<
<







1966
1967
1968
1969
1970
1971
1972









1973
1974
1975
1976
1977
1978
1979
        public int idxNum;           /* Number used to identify the index */
        public string idxStr;        /* String, possibly obtained from sqlite3_malloc */
        public int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
        public int orderByConsumed;  /* True if output is already ordered */
        public double estimatedCost; /* Estimated cost of using this index */
    }
    #endregion









  }

#if PLATFORM_COMPACTFRAMEWORK
  internal abstract class CriticalHandle : IDisposable
  {
    private bool _isClosed;
    protected IntPtr handle;