System.Data.SQLite
Check-in [df6776ec88]
Not logged in

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

Overview
Comment:Complete most of the initial virtual table module base class. Some fixes to types for marshalling.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | virtualTables
Files: files | file ages | folders
SHA1: df6776ec886ace3e5b892e2a198fe09f2ca062ef
User & Date: mistachkin 2013-06-13 22:49:26
Original Comment: Complete the initial virtual table module base class. Some fixes to types for marshalling.
Context
2013-06-15
02:46
More work in progress. check-in: 8a682d20dc user: mistachkin tags: virtualTables
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
    /// </summary>
    Collation = 2,
  }

  /// <summary>
  /// An internal callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw context pointer for the user function</param>
  /// <param name="nArgs">Count of arguments to the function</param>
  /// <param name="argsptr">A pointer to the array of argument pointers</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteCallback(IntPtr context, int nArgs, IntPtr argsptr);
  /// <summary>
  /// An internal final callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw context pointer for the user function</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif







|
|
|



|







832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
    /// </summary>
    Collation = 2,
  }

  /// <summary>
  /// An internal callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw native context pointer for the user function.</param>
  /// <param name="argc">Total number of arguments to the user function.</param>
  /// <param name="argv">Raw native pointer to the array of raw native argument pointers.</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  public delegate void SQLiteCallback(IntPtr context, int argc, IntPtr argv);
  /// <summary>
  /// An internal final callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw context pointer for the user function</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif

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

366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
...
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
...
613
614
615
616
617
618
619

































620
621
622
623
624
625
626
....
1091
1092
1093
1094
1095
1096
1097










1098







1099
1100
1101
1102
1103
1104
1105
1106
















1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117


















1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
















1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139












1140
1141
1142
1143
1144
1145
1146
1147
1148









1149
1150
1151
1152
1153
1154
1155
1156
1157









1158
1159
1160
1161
1162
1163
1164
1165
1166









1167
1168
1169
1170
1171
1172
1173
1174
1175









1176
1177
1178
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
1217
1218









1219
1220
1221
1222
1223
1224
1225
1226
1227
1228









1229
1230
1231
1232
1233
1234
1235
1236
....
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
....
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
        SQLiteErrorCode xBestIndex(IntPtr pVtab, IntPtr index);
        SQLiteErrorCode xDisconnect(IntPtr pVtab);
        SQLiteErrorCode xDestroy(IntPtr pVtab);
        SQLiteErrorCode xOpen(IntPtr pVtab, ref IntPtr pCursor);
        SQLiteErrorCode xClose(IntPtr pCursor);
        SQLiteErrorCode xFilter(IntPtr pCursor, int idxNum, IntPtr idxStr, int argc, IntPtr[] argv);
        SQLiteErrorCode xNext(IntPtr pCursor);
        SQLiteErrorCode xEof(IntPtr pCursor);
        SQLiteErrorCode xColumn(IntPtr pCursor, IntPtr pContext, int index);
        SQLiteErrorCode xRowId(IntPtr pCursor, ref long rowId);
        SQLiteErrorCode xUpdate(IntPtr pVtab, int nData, ref IntPtr apData, ref long rowId);
        SQLiteErrorCode xBegin(IntPtr pVtab);
        SQLiteErrorCode xSync(IntPtr pVtab);
        SQLiteErrorCode xCommit(IntPtr pVtab);
        SQLiteErrorCode xRollback(IntPtr pVtab);
        SQLiteErrorCode xFindFunction(IntPtr pVtab, int nArg, IntPtr zName, ref IntPtr pxFunc, ref IntPtr ppArg);
        SQLiteErrorCode xRename(IntPtr pVtab, IntPtr zNew);
        SQLiteErrorCode xSavepoint(IntPtr pVtab, int iSavepoint);
        SQLiteErrorCode xRelease(IntPtr pVtab, int iSavepoint);
        SQLiteErrorCode xRollbackTo(IntPtr pVtab, int iSavepoint);
    }

    ///////////////////////////////////////////////////////////////////////////
................................................................................
        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);
        SQLiteErrorCode Column(SQLiteVirtualTableCursor cursor, SQLiteContext context, int index);
        SQLiteErrorCode RowId(SQLiteVirtualTableCursor cursor, ref long rowId);
        SQLiteErrorCode Update(SQLiteValue[] values, ref long rowId);
        SQLiteErrorCode Begin();
        SQLiteErrorCode Sync();
        SQLiteErrorCode Commit();
        SQLiteErrorCode Rollback();
        SQLiteErrorCode FindFunction(string zName, ref SQLiteFunction function, object[] args);
        SQLiteErrorCode Rename(string zNew);
        SQLiteErrorCode Savepoint(int iSavepoint);
        SQLiteErrorCode Release(int iSavepoint);
        SQLiteErrorCode RollbackTo(int iSavepoint);
    }

    ///////////////////////////////////////////////////////////////////////////
................................................................................
            if (values == null)
                return null;

            IntPtr[] result = new IntPtr[values.Length];

            for (int index = 0; index < result.Length; index++)
                result[index] = Utf8IntPtrFromString(values[index]);


































            return result;
        }

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

        private static SQLiteValue[] ValueArrayFromIntPtrArray(
................................................................................

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

        public SQLiteErrorCode xNext(
            IntPtr pCursor
            )
        {










            return SQLiteErrorCode.Ok;







        }

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

        public SQLiteErrorCode xEof(
            IntPtr pCursor
            )
        {
















            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xColumn(
            IntPtr pCursor,
            IntPtr pContext,
            int index
            )
        {


















            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xRowId(
            IntPtr pCursor,
            ref long rowId
            )
        {
















            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xUpdate(
            IntPtr pVtab,
            int nData,
            ref IntPtr apData,
            ref long rowId
            )
        {












            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xBegin(
            IntPtr pVtab
            )
        {









            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xSync(
            IntPtr pVtab
            )
        {









            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xCommit(
            IntPtr pVtab
            )
        {









            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xRollback(
            IntPtr pVtab
            )
        {









            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xFindFunction(
            IntPtr pVtab,
            int nArg,
            IntPtr zName,
            ref IntPtr pxFunc,
            ref IntPtr ppArg
            )
        {











            return SQLiteErrorCode.Ok;













        }

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

        public SQLiteErrorCode xRename(
            IntPtr pVtab,
            IntPtr zNew
            )
        {









            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xSavepoint(
            IntPtr pVtab,
            int iSavepoint
            )
        {









            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xRelease(
            IntPtr pVtab,
            int iSavepoint
            )
        {









            return SQLiteErrorCode.Ok;
        }

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

        public SQLiteErrorCode xRollbackTo(
            IntPtr pVtab,
            int iSavepoint
            )
        {









            return SQLiteErrorCode.Ok;
        }
        #endregion

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

        #region ISQLiteManagedModule Members
        private bool declared;
................................................................................

        public abstract SQLiteErrorCode Next(
            SQLiteVirtualTableCursor cursor
            );

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

        public abstract SQLiteErrorCode Eof(
            SQLiteVirtualTableCursor cursor
            );

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

        public abstract SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor,
................................................................................

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

        public abstract SQLiteErrorCode Rollback();

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

        public abstract SQLiteErrorCode FindFunction(
            string zName,
            ref SQLiteFunction function,
            object[] args
            );

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

        public abstract SQLiteErrorCode Rename(
            string zNew
            );







|


|




|







 







|







|







 







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







 







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




|



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










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









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







|



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








>
>
>
>
>
>
>
>
>
|








>
>
>
>
>
>
>
>
>
|








>
>
>
>
>
>
>
>
>
|








>
>
>
>
>
>
>
>
>
|




|



|
|


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









>
>
>
>
>
>
>
>
>
|









>
>
>
>
>
>
>
>
>
|









>
>
>
>
>
>
>
>
>
|









>
>
>
>
>
>
>
>
>
|







 







|







 







|


|







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
...
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
...
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
....
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
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
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
....
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
....
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
        SQLiteErrorCode xBestIndex(IntPtr pVtab, IntPtr index);
        SQLiteErrorCode xDisconnect(IntPtr pVtab);
        SQLiteErrorCode xDestroy(IntPtr pVtab);
        SQLiteErrorCode xOpen(IntPtr pVtab, ref IntPtr pCursor);
        SQLiteErrorCode xClose(IntPtr pCursor);
        SQLiteErrorCode xFilter(IntPtr pCursor, int idxNum, IntPtr idxStr, int argc, IntPtr[] argv);
        SQLiteErrorCode xNext(IntPtr pCursor);
        bool xEof(IntPtr pCursor);
        SQLiteErrorCode xColumn(IntPtr pCursor, IntPtr pContext, int index);
        SQLiteErrorCode xRowId(IntPtr pCursor, ref long rowId);
        SQLiteErrorCode xUpdate(IntPtr pVtab, int nData, IntPtr apData, ref long rowId);
        SQLiteErrorCode xBegin(IntPtr pVtab);
        SQLiteErrorCode xSync(IntPtr pVtab);
        SQLiteErrorCode xCommit(IntPtr pVtab);
        SQLiteErrorCode xRollback(IntPtr pVtab);
        bool xFindFunction(IntPtr pVtab, int nArg, IntPtr zName, ref SQLiteCallback callback, ref IntPtr pClientData);
        SQLiteErrorCode xRename(IntPtr pVtab, IntPtr zNew);
        SQLiteErrorCode xSavepoint(IntPtr pVtab, int iSavepoint);
        SQLiteErrorCode xRelease(IntPtr pVtab, int iSavepoint);
        SQLiteErrorCode xRollbackTo(IntPtr pVtab, int iSavepoint);
    }

    ///////////////////////////////////////////////////////////////////////////
................................................................................
        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);
        bool Eof(SQLiteVirtualTableCursor cursor);
        SQLiteErrorCode Column(SQLiteVirtualTableCursor cursor, SQLiteContext context, int index);
        SQLiteErrorCode RowId(SQLiteVirtualTableCursor cursor, ref long rowId);
        SQLiteErrorCode Update(SQLiteValue[] values, ref long rowId);
        SQLiteErrorCode Begin();
        SQLiteErrorCode Sync();
        SQLiteErrorCode Commit();
        SQLiteErrorCode Rollback();
        bool FindFunction(string zName, ref SQLiteFunction function, ref IntPtr pClientData);
        SQLiteErrorCode Rename(string zNew);
        SQLiteErrorCode Savepoint(int iSavepoint);
        SQLiteErrorCode Release(int iSavepoint);
        SQLiteErrorCode RollbackTo(int iSavepoint);
    }

    ///////////////////////////////////////////////////////////////////////////
................................................................................
            if (values == null)
                return null;

            IntPtr[] result = new IntPtr[values.Length];

            for (int index = 0; index < result.Length; index++)
                result[index] = Utf8IntPtrFromString(values[index]);

            return result;
        }

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

        private static SQLiteValue[] ValueArrayFromSizeAndIntPtr(
            int nData,
            IntPtr apData
            )
        {
            if (nData < 0)
                return null;

            if (apData == IntPtr.Zero)
                return null;

            SQLiteValue[] result = new SQLiteValue[nData];

            for (int index = 0, offset = 0;
                    index < result.Length;
                    index++, offset += IntPtr.Size)
            {
#if !PLATFORM_COMPACTFRAMEWORK
                IntPtr pData = Marshal.ReadIntPtr(apData, offset);
#else
                IntPtr pData = Marshal.ReadIntPtr(IntPtrForOffset(
                    apData, offset));
#endif

                result[index] = (pData != IntPtr.Zero) ?
                    new SQLiteValue(pData) : null;
            }

            return result;
        }

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

        private static SQLiteValue[] ValueArrayFromIntPtrArray(
................................................................................

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

        public SQLiteErrorCode xNext(
            IntPtr pCursor
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = GetTableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = MarshalCursorFromIntPtr(
                    pCursor);

                if (Next(cursor) == SQLiteErrorCode.Ok)
                    return SQLiteErrorCode.Ok;
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public bool xEof(
            IntPtr pCursor
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = GetTableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = MarshalCursorFromIntPtr(
                    pCursor);

                return Eof(cursor);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return true;
        }

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

        public SQLiteErrorCode xColumn(
            IntPtr pCursor,
            IntPtr pContext,
            int index
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = GetTableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = MarshalCursorFromIntPtr(
                    pCursor);

                SQLiteContext context = new SQLiteContext(pContext);

                return Column(cursor, context, index);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xRowId(
            IntPtr pCursor,
            ref long rowId
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = GetTableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = MarshalCursorFromIntPtr(
                    pCursor);

                return RowId(cursor, ref rowId);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xUpdate(
            IntPtr pVtab,
            int nData,
            IntPtr apData,
            ref long rowId
            )
        {
            try
            {
                SQLiteValue[] values = ValueArrayFromSizeAndIntPtr(
                    nData, apData);

                return Update(values, ref rowId);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xBegin(
            IntPtr pVtab
            )
        {
            try
            {
                return Begin();
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xSync(
            IntPtr pVtab
            )
        {
            try
            {
                return Sync();
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xCommit(
            IntPtr pVtab
            )
        {
            try
            {
                return Commit();
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xRollback(
            IntPtr pVtab
            )
        {
            try
            {
                return Rollback();
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public bool xFindFunction(
            IntPtr pVtab,
            int nArg,
            IntPtr zName,
            ref SQLiteCallback callback,
            ref IntPtr pClientData
            )
        {
            try
            {
                SQLiteFunction function = null;

                if (FindFunction(
                        StringFromUtf8IntPtr(zName), ref function,
                        ref pClientData))
                {
                    if (function != null)
                    {
                        callback = function.ScalarCallback;
                        return true;
                    }
                    else
                    {
                        SetTableError(pVtab, "no function was created");
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return false;
        }

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

        public SQLiteErrorCode xRename(
            IntPtr pVtab,
            IntPtr zNew
            )
        {
            try
            {
                return Rename(StringFromUtf8IntPtr(zNew));
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xSavepoint(
            IntPtr pVtab,
            int iSavepoint
            )
        {
            try
            {
                return Savepoint(iSavepoint);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xRelease(
            IntPtr pVtab,
            int iSavepoint
            )
        {
            try
            {
                return Release(iSavepoint);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

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

        public SQLiteErrorCode xRollbackTo(
            IntPtr pVtab,
            int iSavepoint
            )
        {
            try
            {
                return RollbackTo(iSavepoint);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }
        #endregion

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

        #region ISQLiteManagedModule Members
        private bool declared;
................................................................................

        public abstract SQLiteErrorCode Next(
            SQLiteVirtualTableCursor cursor
            );

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

        public abstract bool Eof(
            SQLiteVirtualTableCursor cursor
            );

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

        public abstract SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor,
................................................................................

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

        public abstract SQLiteErrorCode Rollback();

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

        public abstract bool FindFunction(
            string zName,
            ref SQLiteFunction function,
            ref IntPtr pClientData
            );

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

        public abstract SQLiteErrorCode Rename(
            string zNew
            );

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

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

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

        public override SQLiteErrorCode Eof(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

................................................................................
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

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

        public override SQLiteErrorCode FindFunction(
            string zName,
            ref SQLiteFunction function,
            object[] args
            )
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

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







|







 







|


|







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

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

        public override bool Eof(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

................................................................................
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

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

        public override bool FindFunction(
            string zName,
            ref SQLiteFunction function,
            ref IntPtr pClientData
            )
        {
            CheckDisposed();
            throw new NotImplementedException();
        }

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

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

1718
1719
1720
1721
1722
1723
1724

1725
1726
1727
1728
1729
1730
1731
1732
....
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
....
1796
1797
1798
1799
1800
1801
1802

1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif

    public delegate SQLiteErrorCode xEof(
        IntPtr pCursor
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
................................................................................

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xUpdate(
        IntPtr pVtab,
        int nData,
        ref IntPtr apData,
        ref long rowId
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
................................................................................
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif

    public delegate SQLiteErrorCode xFindFunction(
        IntPtr pVtab,
        int nArg,
        IntPtr zName,
        ref IntPtr pxFunc,
        ref IntPtr ppArg
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif







>
|







 







|







 







>
|



|
|







1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
....
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
....
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    [return: MarshalAs(UnmanagedType.I4)]
    public delegate bool xEof(
        IntPtr pCursor
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
................................................................................

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xUpdate(
        IntPtr pVtab,
        int nData,
        IntPtr apData,
        ref long rowId
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
................................................................................
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    [return: MarshalAs(UnmanagedType.I4)]
    public delegate bool xFindFunction(
        IntPtr pVtab,
        int nArg,
        IntPtr zName,
        ref SQLiteCallback callback,
        ref IntPtr pUserData
    );

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

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif