Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make the IEnumerable<ISQLiteChangeSetMetadataItem> interface part of ISQLiteChangeSet. Add a couple missing null argument checks. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sessions |
Files: | files | file ages | folders |
SHA1: |
ff0061c1dfc0ddf30bea4d90ff853323 |
User & Date: | mistachkin 2017-10-06 23:09:03.887 |
Context
2017-10-07
| ||
03:17 | Avoid a superfluous call to Marshal.Copy. check-in: cfbbd7b1fe user: mistachkin tags: sessions | |
2017-10-06
| ||
23:09 | Make the IEnumerable<ISQLiteChangeSetMetadataItem> interface part of ISQLiteChangeSet. Add a couple missing null argument checks. check-in: ff0061c1df user: mistachkin tags: sessions | |
23:07 | Add GetObject method to the SQLiteValue class for use in testing and debugging. check-in: 756bbf5fcb user: mistachkin tags: sessions | |
Changes
Changes to System.Data.SQLite/SQLiteSession.cs.
︙ | ︙ | |||
54 55 56 57 58 59 60 | ISQLiteChangeSetMetadataItem item ); #endregion /////////////////////////////////////////////////////////////////////////// #region ISQLiteChangeSet Interface | | > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ISQLiteChangeSetMetadataItem item ); #endregion /////////////////////////////////////////////////////////////////////////// #region ISQLiteChangeSet Interface public interface ISQLiteChangeSet : IEnumerable<ISQLiteChangeSetMetadataItem>, IDisposable { ISQLiteChangeSet Invert(); ISQLiteChangeSet CombineWith(ISQLiteChangeSet changeSet); void Apply( SessionConflictCallback conflictCallback, object clientData |
︙ | ︙ | |||
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | public void AddChangeSet( byte[] rawData ) { CheckDisposed(); CheckHandle(); IntPtr pData = IntPtr.Zero; try { int nData = 0; pData = SQLiteBytes.ToIntPtr(rawData, ref nData); | > > > | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | public void AddChangeSet( byte[] rawData ) { CheckDisposed(); CheckHandle(); if (rawData == null) throw new ArgumentNullException("rawData"); IntPtr pData = IntPtr.Zero; try { int nData = 0; pData = SQLiteBytes.ToIntPtr(rawData, ref nData); |
︙ | ︙ | |||
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | public void AddChangeSet( Stream stream ) { CheckDisposed(); CheckHandle(); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_add_strm( changeGroup, new SQLiteStreamAdapter(stream, flags).xInput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3changegroup_add_strm"); } /////////////////////////////////////////////////////////////////////// public void CreateChangeSet( ref byte[] rawData ) { CheckDisposed(); CheckHandle(); IntPtr pData = IntPtr.Zero; try { int nData = 0; SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_output( | > > > > > > | 1024 1025 1026 1027 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 | public void AddChangeSet( Stream stream ) { CheckDisposed(); CheckHandle(); if (stream == null) throw new ArgumentNullException("stream"); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_add_strm( changeGroup, new SQLiteStreamAdapter(stream, flags).xInput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3changegroup_add_strm"); } /////////////////////////////////////////////////////////////////////// public void CreateChangeSet( ref byte[] rawData ) { CheckDisposed(); CheckHandle(); if (rawData == null) throw new ArgumentNullException("rawData"); IntPtr pData = IntPtr.Zero; try { int nData = 0; SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_output( |
︙ | ︙ | |||
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | public void CreateChangeSet( Stream stream ) { CheckDisposed(); CheckHandle(); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_output_strm( changeGroup, new SQLiteStreamAdapter(stream, flags).xOutput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3changegroup_output_strm"); } | > > > | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | public void CreateChangeSet( Stream stream ) { CheckDisposed(); CheckHandle(); if (stream == null) throw new ArgumentNullException("stream"); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_output_strm( changeGroup, new SQLiteStreamAdapter(stream, flags).xOutput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3changegroup_output_strm"); } |
︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 | return UnsafeNativeMethods.sqlite3session_isempty(session) != 0; } /////////////////////////////////////////////////////////////////////// public void AttachTable( | | | | | 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 | return UnsafeNativeMethods.sqlite3session_isempty(session) != 0; } /////////////////////////////////////////////////////////////////////// public void AttachTable( string name /* in: NULL OK */ ) { CheckDisposed(); CheckHandle(); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_attach( session, SQLiteString.GetUtf8BytesFromString(name)); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3session_attach"); } /////////////////////////////////////////////////////////////////////// public void SetTableFilter( SessionTableFilterCallback callback, /* in: NULL OK */ object clientData /* in: NULL OK */ ) { CheckDisposed(); CheckHandle(); this.tableFilterCallback = callback; this.tableFilterClientData = clientData; |
︙ | ︙ | |||
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 | public void CreateChangeSet( Stream stream ) { CheckDisposed(); CheckHandle(); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_changeset_strm( session, new SQLiteStreamAdapter(stream, flags).xOutput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3session_changeset_strm"); } | > > > | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | public void CreateChangeSet( Stream stream ) { CheckDisposed(); CheckHandle(); if (stream == null) throw new ArgumentNullException("stream"); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_changeset_strm( session, new SQLiteStreamAdapter(stream, flags).xOutput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3session_changeset_strm"); } |
︙ | ︙ | |||
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | public void CreatePatchSet( Stream stream ) { CheckDisposed(); CheckHandle(); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_patchset_strm( session, new SQLiteStreamAdapter(stream, flags).xOutput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3session_patchset_strm"); } /////////////////////////////////////////////////////////////////////// public void LoadDifferencesFromTable( string fromDatabaseName, string tableName ) { CheckDisposed(); CheckHandle(); IntPtr pError = IntPtr.Zero; try { SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_diff( session, SQLiteString.GetUtf8BytesFromString(fromDatabaseName), SQLiteString.GetUtf8BytesFromString(tableName), ref pError); | > > > > > > > > > | 1441 1442 1443 1444 1445 1446 1447 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 | public void CreatePatchSet( Stream stream ) { CheckDisposed(); CheckHandle(); if (stream == null) throw new ArgumentNullException("stream"); SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_patchset_strm( session, new SQLiteStreamAdapter(stream, flags).xOutput, IntPtr.Zero); if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, "sqlite3session_patchset_strm"); } /////////////////////////////////////////////////////////////////////// public void LoadDifferencesFromTable( string fromDatabaseName, string tableName ) { CheckDisposed(); CheckHandle(); if (fromDatabaseName == null) throw new ArgumentNullException("fromDatabaseName"); if (tableName == null) throw new ArgumentNullException("tableName"); IntPtr pError = IntPtr.Zero; try { SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_diff( session, SQLiteString.GetUtf8BytesFromString(fromDatabaseName), SQLiteString.GetUtf8BytesFromString(tableName), ref pError); |
︙ | ︙ | |||
1540 1541 1542 1543 1544 1545 1546 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteMemoryChangeSet Class internal sealed class SQLiteMemoryChangeSet : | | < | 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteMemoryChangeSet Class internal sealed class SQLiteMemoryChangeSet : SQLiteConnectionLock, ISQLiteChangeSet { #region Private Data private byte[] rawData; private SQLiteConnectionHandle handle; private SQLiteConnectionFlags flags; #endregion |
︙ | ︙ | |||
1897 1898 1899 1900 1901 1902 1903 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteStreamChangeSet Class internal sealed class SQLiteStreamChangeSet : | | < | 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 | } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteStreamChangeSet Class internal sealed class SQLiteStreamChangeSet : SQLiteConnectionLock, ISQLiteChangeSet { #region Private Data private Stream inputStream; private Stream outputStream; private SQLiteConnectionHandle handle; private SQLiteConnectionFlags flags; #endregion |
︙ | ︙ | |||
2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 | SessionTableFilterCallback tableFilterCallback, object clientData ) { CheckDisposed(); CheckInputStream(); /////////////////////////////////////////////////////////////////// #region Native Callback Methods UnsafeNativeMethods.xSessionFilter xFilter; xFilter = new UnsafeNativeMethods.xSessionFilter( delegate(IntPtr context, byte[] tblName) | > > > | 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | SessionTableFilterCallback tableFilterCallback, object clientData ) { CheckDisposed(); CheckInputStream(); if (conflictCallback == null) throw new ArgumentNullException("conflictCallback"); /////////////////////////////////////////////////////////////////// #region Native Callback Methods UnsafeNativeMethods.xSessionFilter xFilter; xFilter = new UnsafeNativeMethods.xSessionFilter( delegate(IntPtr context, byte[] tblName) |
︙ | ︙ | |||
2731 2732 2733 2734 2735 2736 2737 | iterator.GetHandle(), columnIndex, ref pValue); return SQLiteValue.FromIntPtr(pValue); } /////////////////////////////////////////////////////////////////////// | | > > | > > | 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 | iterator.GetHandle(), columnIndex, ref pValue); return SQLiteValue.FromIntPtr(pValue); } /////////////////////////////////////////////////////////////////////// public SQLiteValue GetNewValue( int columnIndex ) { CheckDisposed(); CheckIterator(); IntPtr pValue = IntPtr.Zero; SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_new( iterator.GetHandle(), columnIndex, ref pValue); return SQLiteValue.FromIntPtr(pValue); } /////////////////////////////////////////////////////////////////////// public SQLiteValue GetConflictValue( int columnIndex ) { CheckDisposed(); CheckIterator(); IntPtr pValue = IntPtr.Zero; SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_conflict( |
︙ | ︙ |