System.Data.SQLite

Check-in [1beae37abe]
Login

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

Overview
Comment:Use the proper compile-time option to check for the .NET Framework 4.5.1.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | vs2013
Files: files | file ages | folders
SHA1: 1beae37abe726928791a029a084feeba02bc8e46
User & Date: mistachkin 2013-11-27 01:32:20.516
Context
2013-11-27
01:39
Make sure to include the necessary LINQ related files when compiling the System.Data.SQLite project for the .NET Framework 4.5.1. check-in: 442cf54801 user: mistachkin tags: vs2013
01:32
Use the proper compile-time option to check for the .NET Framework 4.5.1. check-in: 1beae37abe user: mistachkin tags: vs2013
01:28
Minor correction to the conditional framework version check in the LINQ test project. check-in: 5bac89ed82 user: mistachkin tags: vs2013
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite.Linq/AssemblyInfo.cs.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]

#if !NET_40 && !NET_45
[assembly: AllowPartiallyTrustedCallers]
#endif

[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]

// Version information for an assembly consists of the following four values:
//







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]

#if !NET_40 && !NET_45 && !NET_451
[assembly: AllowPartiallyTrustedCallers]
#endif

[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]

// Version information for an assembly consists of the following four values:
//
Changes to System.Data.SQLite.Linq/SQL Generation/InternalBase.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Text;

#if NET_40 || NET_45
using System.Runtime;
#endif

namespace System.Data.SQLite
{
	internal abstract class InternalBase
	{
		// Methods
#if NET_40 || NET_45
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		protected InternalBase()
		{
		}

		internal abstract void ToCompactString(StringBuilder builder);
		internal virtual string ToFullString()
		{
			StringBuilder builder = new StringBuilder();
			this.ToFullString(builder);
			return builder.ToString();
		}

#if NET_40 || NET_45
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal virtual void ToFullString(StringBuilder builder)
		{
			this.ToCompactString(builder);
		}










|








|














|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Text;

#if NET_40 || NET_45 || NET_451
using System.Runtime;
#endif

namespace System.Data.SQLite
{
	internal abstract class InternalBase
	{
		// Methods
#if NET_40 || NET_45 || NET_451
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		protected InternalBase()
		{
		}

		internal abstract void ToCompactString(StringBuilder builder);
		internal virtual string ToFullString()
		{
			StringBuilder builder = new StringBuilder();
			this.ToFullString(builder);
			return builder.ToString();
		}

#if NET_40 || NET_45 || NET_451
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal virtual void ToFullString(StringBuilder builder)
		{
			this.ToCompactString(builder);
		}

Changes to System.Data.SQLite.Linq/SQL Generation/KeyToListMap.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.Collections;

#if NET_40 || NET_45
using System.Runtime;
#endif

namespace System.Data.SQLite
{
	internal sealed class KeyToListMap<TKey, TValue> : InternalBase
	{












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.Collections;

#if NET_40 || NET_45 || NET_451
using System.Runtime;
#endif

namespace System.Data.SQLite
{
	internal sealed class KeyToListMap<TKey, TValue> : InternalBase
	{
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
			{
				return this.m_map.Keys;
			}
		}

		internal IEnumerable<KeyValuePair<TKey, List<TValue>>> KeyValuePairs
		{
#if NET_40 || NET_45
			[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
			get
			{
				return this.m_map;
			}
		}
	}
}







|









115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
			{
				return this.m_map.Keys;
			}
		}

		internal IEnumerable<KeyValuePair<TKey, List<TValue>>> KeyValuePairs
		{
#if NET_40 || NET_45 || NET_451
			[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
			get
			{
				return this.m_map;
			}
		}
	}
}
Changes to System.Data.SQLite.Linq/SQL Generation/SqlChecker.cs.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  {
#if false
    private static Type sql8rewriter;

    static SqlChecker()
    {
        string version =
#if NET_40 || NET_45
            "4.0.0.0";
#else
            "3.5.0.0";
#endif

        sql8rewriter = Type.GetType(String.Format("System.Data.SqlClient.SqlGen.Sql8ExpressionRewriter, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    }







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  {
#if false
    private static Type sql8rewriter;

    static SqlChecker()
    {
        string version =
#if NET_40 || NET_45 || NET_451
            "4.0.0.0";
#else
            "3.5.0.0";
#endif

        sql8rewriter = Type.GetType(String.Format("System.Data.SqlClient.SqlGen.Sql8ExpressionRewriter, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    }
Changes to System.Data.SQLite.Linq/SQL Generation/StringUtil.cs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Collections;

#if NET_40 || NET_45
using System.Runtime;
#endif

namespace System.Data.SQLite
{
	internal static class StringUtil
	{












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Collections;

#if NET_40 || NET_45 || NET_451
using System.Runtime;
#endif

namespace System.Data.SQLite
{
	internal static class StringUtil
	{
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
		}

		private static string InvariantConvertToString<T>(T value)
		{
			return string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { value });
		}

#if NET_40 || NET_45
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal static bool IsNullOrEmptyOrWhiteSpace(string value)
		{
			return IsNullOrEmptyOrWhiteSpace(value, 0);
		}








|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
		}

		private static string InvariantConvertToString<T>(T value)
		{
			return string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { value });
		}

#if NET_40 || NET_45 || NET_451
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal static bool IsNullOrEmptyOrWhiteSpace(string value)
		{
			return IsNullOrEmptyOrWhiteSpace(value, 0);
		}

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
		}

		internal static void ToSeparatedString(StringBuilder builder, IEnumerable list, string separator)
		{
			ToSeparatedStringPrivate(builder, list, separator, string.Empty, false);
		}

#if NET_40 || NET_45
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal static void ToSeparatedString(StringBuilder stringBuilder, IEnumerable list, string separator, string nullValue)
		{
			ToSeparatedStringPrivate(stringBuilder, list, separator, nullValue, false);
		}








|







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
		}

		internal static void ToSeparatedString(StringBuilder builder, IEnumerable list, string separator)
		{
			ToSeparatedStringPrivate(builder, list, separator, string.Empty, false);
		}

#if NET_40 || NET_45 || NET_451
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal static void ToSeparatedString(StringBuilder stringBuilder, IEnumerable list, string separator, string nullValue)
		{
			ToSeparatedStringPrivate(stringBuilder, list, separator, nullValue, false);
		}

Changes to System.Data.SQLite/AssemblyInfo.cs.
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//  COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=" + System.Data.SQLite.SQLite3.PublicKey)]
[assembly: NeutralResourcesLanguage("en")]

#if !PLATFORM_COMPACTFRAMEWORK
#if !NET_40 && !NET_45
[assembly: AllowPartiallyTrustedCallers]
#endif

[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]

#if NET_40 || NET_45
//
// NOTE: This attribute is only available in .NET Framework 4.0 or higher.
//
[assembly: SecurityRules(System.Security.SecurityRuleSet.Level1)]
#endif
#endif








|





|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//  COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=" + System.Data.SQLite.SQLite3.PublicKey)]
[assembly: NeutralResourcesLanguage("en")]

#if !PLATFORM_COMPACTFRAMEWORK
#if !NET_40 && !NET_45 && !NET_451
[assembly: AllowPartiallyTrustedCallers]
#endif

[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]

#if NET_40 || NET_45 || NET_451
//
// NOTE: This attribute is only available in .NET Framework 4.0 or higher.
//
[assembly: SecurityRules(System.Security.SecurityRuleSet.Level1)]
#endif
#endif

Changes to System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs.
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
                SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized."));
        }
#else
        SQLiteLog.Initialize();
#endif

        string version =
#if NET_40 || NET_45
            "4.0.0.0";
#else
            "3.5.0.0";
#endif

        _dbProviderServicesType = Type.GetType(String.Format(CultureInfo.InvariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    }







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
                SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized."));
        }
#else
        SQLiteLog.Initialize();
#endif

        string version =
#if NET_40 || NET_45 || NET_451
            "4.0.0.0";
#else
            "3.5.0.0";
#endif

        _dbProviderServicesType = Type.GetType(String.Format(CultureInfo.InvariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    }
Changes to System.Data.SQLite/SQLite3.cs.
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    /// The opaque pointer returned to us by the sqlite provider
    /// </summary>
    protected internal SQLiteConnectionHandle _sql;
    protected string _fileName;
    protected bool _usePool;
    protected int _poolVersion;

#if (NET_35 || NET_40 || NET_45) && !PLATFORM_COMPACTFRAMEWORK
    private bool _buildingSchema;
#endif

    /// <summary>
    /// The user-defined functions registered on this connection
    /// </summary>
    protected List<SQLiteFunction> _functions;







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    /// The opaque pointer returned to us by the sqlite provider
    /// </summary>
    protected internal SQLiteConnectionHandle _sql;
    protected string _fileName;
    protected bool _usePool;
    protected int _poolVersion;

#if (NET_35 || NET_40 || NET_45 || NET_451) && !PLATFORM_COMPACTFRAMEWORK
    private bool _buildingSchema;
#endif

    /// <summary>
    /// The user-defined functions registered on this connection
    /// </summary>
    protected List<SQLiteFunction> _functions;
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
              }

              if (cmd != null)
                cmd.SetTypes(typedefs);

              return cmd;
            }
#if (NET_35 || NET_40 || NET_45) && !PLATFORM_COMPACTFRAMEWORK
            else if (_buildingSchema == false && String.Compare(GetLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0)
            {
              strRemain = "";
              _buildingSchema = true;
              try
              {
                ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions;







|







953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
              }

              if (cmd != null)
                cmd.SetTypes(typedefs);

              return cmd;
            }
#if (NET_35 || NET_40 || NET_45 || NET_451) && !PLATFORM_COMPACTFRAMEWORK
            else if (_buildingSchema == false && String.Compare(GetLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0)
            {
              strRemain = "";
              _buildingSchema = true;
              try
              {
                ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions;
Changes to System.Data.SQLite/SQLiteDefineConstants.cs.
63
64
65
66
67
68
69




70
71
72
73
74
75
76
#if NET_40
            "NET_40",
#endif

#if NET_45
            "NET_45",
#endif





#if NET_COMPACT_20
            "NET_COMPACT_20",
#endif

#if PLATFORM_COMPACTFRAMEWORK
            "PLATFORM_COMPACTFRAMEWORK",







>
>
>
>







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#if NET_40
            "NET_40",
#endif

#if NET_45
            "NET_45",
#endif

#if NET_451
            "NET_451",
#endif

#if NET_COMPACT_20
            "NET_COMPACT_20",
#endif

#if PLATFORM_COMPACTFRAMEWORK
            "PLATFORM_COMPACTFRAMEWORK",
Changes to Tests/common.eagle.
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
        #       options, it will be assumed that it was enabled for the interop
        #       assembly if it was enabled for the managed assembly.
        #
        foreach defineConstant [list \
            CHECK_STATE COUNT_HANDLE DEBUG INTEROP_CODEC INTEROP_DEBUG \
            INTEROP_EXTENSION_FUNCTIONS INTEROP_LEGACY_CLOSE INTEROP_LOG \
            INTEROP_TEST_EXTENSION INTEROP_VIRTUAL_TABLE NET_20 NET_35 \
            NET_40 NET_45 NET_COMPACT_20 PLATFORM_COMPACTFRAMEWORK \
            PRELOAD_NATIVE_LIBRARY RETARGETABLE SQLITE_STANDARD \
            THROW_ON_DISPOSED TRACE TRACE_CONNECTION TRACE_HANDLE \
            TRACE_PRELOAD TRACE_STATEMENT TRACE_WARNING TRACK_MEMORY_BYTES \
            USE_INTEROP_DLL USE_PREPARE_V2 WINDOWS] {
          #
          # NOTE: Check if the compile-time option is listed in the list of
          #       "define constants" kept track of by the managed assembly.







|







2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
        #       options, it will be assumed that it was enabled for the interop
        #       assembly if it was enabled for the managed assembly.
        #
        foreach defineConstant [list \
            CHECK_STATE COUNT_HANDLE DEBUG INTEROP_CODEC INTEROP_DEBUG \
            INTEROP_EXTENSION_FUNCTIONS INTEROP_LEGACY_CLOSE INTEROP_LOG \
            INTEROP_TEST_EXTENSION INTEROP_VIRTUAL_TABLE NET_20 NET_35 \
            NET_40 NET_45 NET_451 NET_COMPACT_20 PLATFORM_COMPACTFRAMEWORK \
            PRELOAD_NATIVE_LIBRARY RETARGETABLE SQLITE_STANDARD \
            THROW_ON_DISPOSED TRACE TRACE_CONNECTION TRACE_HANDLE \
            TRACE_PRELOAD TRACE_STATEMENT TRACE_WARNING TRACK_MEMORY_BYTES \
            USE_INTEROP_DLL USE_PREPARE_V2 WINDOWS] {
          #
          # NOTE: Check if the compile-time option is listed in the list of
          #       "define constants" kept track of by the managed assembly.
Changes to testlinq/Program.cs.
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
                          territories.Regions = db.Regions.First();

                          db.AddObject("Territories", territories);
                      }

                      try
                      {
#if NET_40 || NET_45
                          db.SaveChanges(SaveOptions.None);
#else
                          db.SaveChanges(false);
#endif
                      }
                      catch (Exception e)
                      {







|







251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
                          territories.Regions = db.Regions.First();

                          db.AddObject("Territories", territories);
                      }

                      try
                      {
#if NET_40 || NET_45 || NET_451
                          db.SaveChanges(SaveOptions.None);
#else
                          db.SaveChanges(false);
#endif
                      }
                      catch (Exception e)
                      {
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
              }
          }
          else
          {
              using (northwindEFEntities db = new northwindEFEntities())
              {
                  bool once = false;
#if NET_40 || NET_45
                  var query = from t in db.Territories
                    where territoryIds.AsQueryable<long>().Contains<long>(t.TerritoryID)
                    orderby t.TerritoryID
                    select t;

                  foreach (Territories territories in query)
                  {







|







274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
              }
          }
          else
          {
              using (northwindEFEntities db = new northwindEFEntities())
              {
                  bool once = false;
#if NET_40 || NET_45 || NET_451
                  var query = from t in db.Territories
                    where territoryIds.AsQueryable<long>().Contains<long>(t.TerritoryID)
                    orderby t.TerritoryID
                    select t;

                  foreach (Territories territories in query)
                  {
Changes to tools/install/Installer.cs.
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
        Default = Medium
    }
    #endregion

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

    #region Installer Class
#if NET_40 || NET_45
    [SecurityCritical()]
#else
    [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
#endif
    internal static class Installer
    {
        #region Unsafe Native Methods Class







|







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
        Default = Medium
    }
    #endregion

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

    #region Installer Class
#if NET_40 || NET_45 || NET_451
    [SecurityCritical()]
#else
    [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
#endif
    internal static class Installer
    {
        #region Unsafe Native Methods Class