System.Data.SQLite

Check-in [92a5b1ec00]
Login

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

Overview
Comment:work in progress
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 92a5b1ec0008af5833210895f988cbb87c1d3aa3
User & Date: rmsimpson 2006-02-24 23:26:58.000
Context
2006-02-25
07:50
Work in progress check-in: 059f612efa user: rmsimpson tags: sourceforge
2006-02-24
23:26
work in progress check-in: 92a5b1ec00 user: rmsimpson tags: sourceforge
06:07
work in progress check-in: 1283114bab user: rmsimpson tags: sourceforge
Changes
Unified Diff Ignore Whitespace Patch
Changes to SQLite.Designer/SQLite.Designer.csproj.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    <AssemblyOriginatorKeyFile>
    </AssemblyOriginatorKeyFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoWarn>1701;1702;1699</NoWarn>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    <AssemblyOriginatorKeyFile>
    </AssemblyOriginatorKeyFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\designer\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoWarn>1701;1702;1699</NoWarn>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71


72
73
74
75

76
77
78
79
80
81
82
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.SQLite, Version=1.0.26.2, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>


    <Compile Include="SQLiteCommandDesigner.cs">
    </Compile>
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />

    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />







<
<
<
<






>
>




>







55
56
57
58
59
60
61




62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />




    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="SQLiteAdapterDesigner.cs">
    </Compile>
    <Compile Include="SQLiteCommandDesigner.cs">
    </Compile>
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
118
119
120
121
122
123
124



125
    <None Include="CtcComponents\PkgCmdID.h" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="C:\Program Files\Visual Studio 2005 SDK\2006.02\VisualStudioIntegration\Tools\Build\Microsoft.VsSDK.targets" />



</Project>







>
>
>

117
118
119
120
121
122
123
124
125
126
127
    <None Include="CtcComponents\PkgCmdID.h" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="C:\Program Files\Visual Studio 2005 SDK\2006.02\VisualStudioIntegration\Tools\Build\Microsoft.VsSDK.targets" />
  <PropertyGroup>
    <PostBuildEvent>COPY $(TargetPath) $(DevEnvDir)PrivateAssemblies</PostBuildEvent>
  </PropertyGroup>
</Project>
Added SQLite.Designer/SQLiteAdapterDesigner.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
namespace SQLite.Designer
{
  using System;
  using System.ComponentModel;
  using System.ComponentModel.Design;
  using System.Data.Common;
  using System.Collections;
  using System.Reflection;

  internal sealed class SQLiteAdapterDesigner : ComponentDesigner, IExtenderProvider
  {
    private ComponentDesigner _designer = null;

    public SQLiteAdapterDesigner()
    {
    }

    public override void Initialize(IComponent component)
    {
      base.Initialize(component);

      Assembly assm = Assembly.Load("Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
      if (assm != null)
      {
        Type type = assm.GetType("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner");
        if (type != null)
        {
          _designer = (ComponentDesigner)Activator.CreateInstance(type);
          _designer.Initialize(component);
        }
      }
    }

    protected override void Dispose(bool disposing)
    {
      if (_designer != null)
        ((IDisposable)_designer).Dispose();

      base.Dispose(disposing);
    }

    public override DesignerVerbCollection Verbs
    {
      get
      {
        return (_designer != null) ? _designer.Verbs : null;
      }
    }

    public override ICollection AssociatedComponents
    {
      get
      {
        return (_designer != null) ? _designer.AssociatedComponents : null;
      }
    }

    #region IExtenderProvider Members

    public bool CanExtend(object extendee)
    {
      return (extendee is DbDataAdapter);
    }

    #endregion
  }
}
Changes to SQLite.Designer/SQLiteCommandDesigner.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
namespace SQLite.Designer
{
  using System;
  using System.ComponentModel;
  using System.ComponentModel.Design;
  using System.Data.Common;
  using System.Data;

  [ProvideProperty("CommandDesignTimeVisible", typeof(IDbCommand))]
  internal sealed class SQLiteCommandDesigner : ComponentDesigner, IExtenderProvider
  {
    private object _designer;
    private Type _designerType;
    private bool visible;

    public SQLiteCommandDesigner()
    {
      _designerType = SQLiteDataAdapterToolboxItem._vsdesigner.GetType("Microsoft.VSDesigner.Data.VS.DataCommandDesigner");
      _designer = Activator.CreateInstance(_designerType);
    }

    public override void Initialize(IComponent component)
    {
      visible = ((DbCommand)component).DesignTimeVisible;

      ((ComponentDesigner)_designer).Initialize(component);
      base.Initialize(component);
    }

    public bool GetCommandDesignTimeVisible(IDbCommand cmd)
    {
      return visible;
    }

    public void SetCommandDesignTimeVisible(IDbCommand cmd, bool value)
    {
      visible = value;
      TypeDescriptor.Refresh(cmd);
    }

    protected override void PreFilterAttributes(System.Collections.IDictionary attributes)
    {
      base.PreFilterAttributes(attributes);
      DesignTimeVisibleAttribute att = new DesignTimeVisibleAttribute(visible);
      attributes[att.TypeId] = att;
    }

    public override DesignerVerbCollection Verbs
    {
      get
      {
        return ((ComponentDesigner)_designer).Verbs;
      }
    }
    #region IExtenderProvider Members

    public bool CanExtend(object extendee)
    {
      return (extendee is DbCommand);
    }









<


<
<
<
<


<
<




<
<
<



<
<
<
<
<
<
<
<
<
<
<



|



<
<
<
<
<
<
<







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
namespace SQLite.Designer
{
  using System;
  using System.ComponentModel;
  using System.ComponentModel.Design;
  using System.Data.Common;
  using System.Data;


  internal sealed class SQLiteCommandDesigner : ComponentDesigner, IExtenderProvider
  {




    public SQLiteCommandDesigner()
    {


    }

    public override void Initialize(IComponent component)
    {



      base.Initialize(component);
    }












    protected override void PreFilterAttributes(System.Collections.IDictionary attributes)
    {
      base.PreFilterAttributes(attributes);
      DesignTimeVisibleAttribute att = new DesignTimeVisibleAttribute(((DbCommand)Component).DesignTimeVisible);
      attributes[att.TypeId] = att;
    }








    #region IExtenderProvider Members

    public bool CanExtend(object extendee)
    {
      return (extendee is DbCommand);
    }

Changes to SQLite.Designer/SQLiteCommandHandler.cs.
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    private void Vacuum()
    {
      DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults("VACUUM", (int)System.Data.CommandType.Text, null, 0);
    }

    private void ChangePassword()
    {
      System.Data.SQLite.SQLiteConnection cnn = DataViewHierarchyAccessor.Connection.ConnectionSupport.ProviderObject as System.Data.SQLite.SQLiteConnection;
      if (cnn == null) return;
    }

    private void Refresh(int itemId)
    {
      IVsUIHierarchy hier = DataViewHierarchyAccessor.Hierarchy as IVsUIHierarchy;

      Guid g = VSConstants.GUID_VSStandardCommandSet97;







|
|







261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    private void Vacuum()
    {
      DataViewHierarchyAccessor.Connection.Command.ExecuteWithoutResults("VACUUM", (int)System.Data.CommandType.Text, null, 0);
    }

    private void ChangePassword()
    {
     // System.Data.SQLite.SQLiteConnection cnn = DataViewHierarchyAccessor.Connection.ConnectionSupport.ProviderObject as System.Data.SQLite.SQLiteConnection;
     // if (cnn == null) return;
    }

    private void Refresh(int itemId)
    {
      IVsUIHierarchy hier = DataViewHierarchyAccessor.Hierarchy as IVsUIHierarchy;

      Guid g = VSConstants.GUID_VSStandardCommandSet97;
Changes to SQLite.Designer/SQLiteConnectionProperties.cs.
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
42
  using System;
  using Microsoft.VisualStudio.Data.AdoDotNet;
  using Microsoft.VisualStudio.Data;
  using Microsoft.Win32;

  internal class SQLiteConnectionProperties : AdoDotNetConnectionProperties
  {


    static SQLiteConnectionProperties()
    {
      AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
    }

    static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
      if (args.Name.StartsWith("System.Data.SQLite", StringComparison.InvariantCultureIgnoreCase))
      {











        using (RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETFramework\\v2.0.50727\\AssemblyFoldersEx\\SQLite"))
        {
          if (key != null)
          {
            return System.Reflection.Assembly.LoadFrom(System.IO.Path.Combine(key.GetValue(null).ToString(), "System.Data.SQLite.DLL"));
          }
        }
      }
      return null;
    }


    public SQLiteConnectionProperties() : base("System.Data.SQLite")
    {
    }

    public SQLiteConnectionProperties(string connectionString) : base("System.Data.SQLite", connectionString)
    {







>
>





|



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







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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  using System;
  using Microsoft.VisualStudio.Data.AdoDotNet;
  using Microsoft.VisualStudio.Data;
  using Microsoft.Win32;

  internal class SQLiteConnectionProperties : AdoDotNetConnectionProperties
  {
    private static System.Reflection.Assembly _sqlite = null;

    static SQLiteConnectionProperties()
    {
      AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
    }

    private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
      if (args.Name.StartsWith("System.Data.SQLite", StringComparison.InvariantCultureIgnoreCase))
      {
        return SQLiteAssembly;
      }
      return null;
    }

    internal static System.Reflection.Assembly SQLiteAssembly
    {
      get
      {
        if (_sqlite == null)
        {
          using (RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETFramework\\v2.0.50727\\AssemblyFoldersEx\\SQLite"))
          {
            if (key != null)
            {
              _sqlite = System.Reflection.Assembly.LoadFrom(System.IO.Path.Combine(key.GetValue(null).ToString(), "System.Data.SQLite.DLL"));
            }
          }
        }
        return _sqlite;
      }
    }

    public SQLiteConnectionProperties() : base("System.Data.SQLite")
    {
    }

    public SQLiteConnectionProperties(string connectionString) : base("System.Data.SQLite", connectionString)
    {
Added SQLite.Designer/SQLiteConnectionStringEditor.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
namespace SQLite.Designer
{
  using System;
  using System.Reflection;
  using System.Data;
  using System.Data.Common;
  using System.ComponentModel.Design;
  using System.ComponentModel;

  internal sealed class SQLiteConnectionStringEditor : ObjectSelectorEditor
  {
    private ObjectSelectorEditor.Selector _selector = null;

    private Type _managerType = null;

    public SQLiteConnectionStringEditor()
    {
      Assembly assm = Assembly.Load("Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
      if (assm != null)
      {
        _managerType = assm.GetType("Microsoft.VSDesigner.Data.VS.VsConnectionManager");
      }
    }

    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
    {
      if (provider == null || context == null) return value;
      if (context.Instance == null) return value;

      try
      {
        context.OnComponentChanging();
        object newConnection = base.EditValue(provider, value);
        string connectionString = newConnection as string;
        int index = -1;

        if (connectionString == null && newConnection != null)
        {
          if (_managerType != null)
          {
            object manager = Activator.CreateInstance(_managerType, new object[] { provider });
            if (manager != null)
            {
              index = (int)_managerType.InvokeMember("AddNewConnection", BindingFlags.Instance | BindingFlags.InvokeMethod, null, manager, new object[] { "System.Data.SQLite" });
              if (index > -1 && _selector != null)
              {
                connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod, null, manager, new object[] { index });
                _selector.SelectedNode = _selector.AddNode((string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod, null, manager, new object[] { index }), connectionString, null);
              }
            }
          }
          // VsConnectionManager manager1 = new VsConnectionManager(serviceProvider);
          // manager1.AddNewConnection(this.ManagedProviderInvariantName);
        }

        if (String.IsNullOrEmpty(connectionString) == false)
        {
          value = connectionString;
        }
        context.OnComponentChanged();
      }
      catch
      {
      }
      return value;
    }

    protected override void FillTreeWithData(Selector selector, ITypeDescriptorContext context, IServiceProvider provider)
    {
      object manager = Activator.CreateInstance(_managerType, new object[] { provider });
      DbConnection connection = (DbConnection)context.Instance;
      ObjectSelectorEditor.SelectorNode node;

      _selector = selector;

      if (manager != null)
      {
        int items = (int)_managerType.InvokeMember("GetConnectionCount", BindingFlags.Instance | BindingFlags.InvokeMethod, null, manager, null);
        string dataProvider;
        string connectionString;
        string connectionName;

        for (int n = 0; n < items; n++)
        {
          connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod, null, manager, new object[] { n });
          connectionName = (string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod, null, manager, new object[] { n });
          dataProvider = (string)_managerType.InvokeMember("GetProvider", BindingFlags.Instance | BindingFlags.InvokeMethod, null, manager, new object[] { n });
          if (String.Compare(dataProvider, "System.Data.SQLite", true) == 0)
          {
            node = selector.AddNode(connectionName, connectionString, null);
            
            if (String.Compare(connectionString, connection.ConnectionString, true) == 0)
              selector.SelectedNode = node;
          }
        }
      }
    }
  }
}
Changes to SQLite.Designer/SQLiteDataAdapterToolboxItem.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
42
43
44
45
46
47
48
49
50
51
52

53

54
55
56
57
58
59
60
61
62
63
64
65
66
67

68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
namespace SQLite.Designer
{
  using System;
  using System.ComponentModel;
  using System.ComponentModel.Design;
  using System.Drawing.Design;
  using System.Data.SQLite;
  using System.Data.Common;
  using System.Reflection;
  using System.Collections.Generic;
  using System.Windows.Forms;
  using System.Drawing;
  using System.Runtime.Serialization;

  [Serializable]
  [ToolboxItem(typeof(SQLiteDataAdapterToolboxItem))]
  internal sealed class SQLiteDataAdapterToolboxItem : ToolboxItem
  {
    private static Type _wizard = null;
    internal static Assembly _vsdesigner = null;


    static SQLiteDataAdapterToolboxItem()
    {
      _vsdesigner = Assembly.Load("Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");

      _wizard = _vsdesigner.GetType("Microsoft.VSDesigner.Data.VS.DataAdapterWizard");
    }

    public SQLiteDataAdapterToolboxItem(Type type) : this(type, (Bitmap)null)
    {
    }


    public SQLiteDataAdapterToolboxItem(Type type, Bitmap bmp) : base(typeof(SQLiteDataAdapter))
    {
      DisplayName = "SQLiteDataAdapter";
    }

    private SQLiteDataAdapterToolboxItem(SerializationInfo info, StreamingContext context) : base(typeof(SQLiteDataAdapter))
    {
      Deserialize(info, context);
    }

    protected override IComponent[] CreateComponentsCore(IDesignerHost host)
    {
      SQLiteDataAdapter adp = new SQLiteDataAdapter();

      if (adp == null) return null;

      IContainer container = host.Container;

      adp.SelectCommand = new SQLiteCommand();

      adp.SelectCommand.DesignTimeVisible = false;

      container.Add(adp.SelectCommand, GenerateName(container, "SelectCommand"));

      adp.InsertCommand = new SQLiteCommand();
      adp.InsertCommand.DesignTimeVisible = false;
      container.Add(adp.InsertCommand, GenerateName(container, "InsertCommand"));

      adp.UpdateCommand = new SQLiteCommand();
      adp.UpdateCommand.DesignTimeVisible = false;
      container.Add(adp.UpdateCommand, GenerateName(container, "UpdateCommand"));

      adp.DeleteCommand = new SQLiteCommand();
      adp.DeleteCommand.DesignTimeVisible = false;
      container.Add(adp.DeleteCommand, GenerateName(container, "DeleteCommand"));


      ITypeResolutionService res = (ITypeResolutionService)host.GetService(typeof(ITypeResolutionService));
      if (res != null)
      {
        res.ReferenceAssembly(typeof(SQLiteDataAdapter).Assembly.GetName());
      }

      container.Add(adp);

      List<IComponent> list = new List<IComponent>();
      list.Add(adp);

      if (_wizard != null)
      {
        using (Form wizard = (Form)Activator.CreateInstance(_wizard, new object[] { host, adp }))
        {
          wizard.ShowDialog();
        }
      }

      if (adp.SelectCommand != null) list.Add(adp.SelectCommand);
      if (adp.InsertCommand != null) list.Add(adp.InsertCommand);
      if (adp.DeleteCommand != null) list.Add(adp.DeleteCommand);
      if (adp.UpdateCommand != null) list.Add(adp.UpdateCommand);

      return list.ToArray();      
    }

    private static string GenerateName(IContainer container, string baseName)
    {
      ComponentCollection coll = container.Components;






<












<
|
>



<







<
|




|






|

<
|

|
|
>
|
>
|

|
<
|

|
<
|

|
<
|
|
>
|
|

|

>
|


|



|





|
|
|
|







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
42
43
44

45
46
47
48
49
50
51
52
53
54

55
56
57

58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
namespace SQLite.Designer
{
  using System;
  using System.ComponentModel;
  using System.ComponentModel.Design;
  using System.Drawing.Design;

  using System.Data.Common;
  using System.Reflection;
  using System.Collections.Generic;
  using System.Windows.Forms;
  using System.Drawing;
  using System.Runtime.Serialization;

  [Serializable]
  [ToolboxItem(typeof(SQLiteDataAdapterToolboxItem))]
  internal sealed class SQLiteDataAdapterToolboxItem : ToolboxItem
  {
    private static Type _wizard = null;

    
    internal static Assembly _vsdesigner = null;
    static SQLiteDataAdapterToolboxItem()
    {
      _vsdesigner = Assembly.Load("Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");

      _wizard = _vsdesigner.GetType("Microsoft.VSDesigner.Data.VS.DataAdapterWizard");
    }

    public SQLiteDataAdapterToolboxItem(Type type) : this(type, (Bitmap)null)
    {
    }


    public SQLiteDataAdapterToolboxItem(Type type, Bitmap bmp) : base(type)
    {
      DisplayName = "SQLiteDataAdapter";
    }

    private SQLiteDataAdapterToolboxItem(SerializationInfo info, StreamingContext context)
    {
      Deserialize(info, context);
    }

    protected override IComponent[] CreateComponentsCore(IDesignerHost host)
    {
      DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SQLite");


      DbDataAdapter dataAdapter = fact.CreateDataAdapter();
      IContainer container = host.Container;
      
      using (DbCommand adapterCommand = fact.CreateCommand())
      {
        adapterCommand.DesignTimeVisible = false;
        dataAdapter.SelectCommand = (DbCommand)((ICloneable)adapterCommand).Clone();
        container.Add(dataAdapter.SelectCommand, GenerateName(container, "SelectCommand"));

        dataAdapter.InsertCommand = (DbCommand)((ICloneable)adapterCommand).Clone();

        container.Add(dataAdapter.InsertCommand, GenerateName(container, "InsertCommand"));

        dataAdapter.UpdateCommand = (DbCommand)((ICloneable)adapterCommand).Clone();

        container.Add(dataAdapter.UpdateCommand, GenerateName(container, "UpdateCommand"));

        dataAdapter.DeleteCommand = (DbCommand)((ICloneable)adapterCommand).Clone();

        container.Add(dataAdapter.DeleteCommand, GenerateName(container, "DeleteCommand"));
      }

      ITypeResolutionService typeResService = (ITypeResolutionService)host.GetService(typeof(ITypeResolutionService));
      if (typeResService != null)
      {
        typeResService.ReferenceAssembly(dataAdapter.GetType().Assembly.GetName());
      }

      container.Add(dataAdapter);

      List<IComponent> list = new List<IComponent>();
      list.Add(dataAdapter);

      if (_wizard != null)
      {
        using (Form wizard = (Form)Activator.CreateInstance(_wizard, new object[] { host, dataAdapter }))
        {
          wizard.ShowDialog();
        }
      }

      if (dataAdapter.SelectCommand != null) list.Add(dataAdapter.SelectCommand);
      if (dataAdapter.InsertCommand != null) list.Add(dataAdapter.InsertCommand);
      if (dataAdapter.DeleteCommand != null) list.Add(dataAdapter.DeleteCommand);
      if (dataAdapter.UpdateCommand != null) list.Add(dataAdapter.UpdateCommand);

      return list.ToArray();      
    }

    private static string GenerateName(IContainer container, string baseName)
    {
      ComponentCollection coll = container.Components;
Changes to SQLite.Interop/SQLite.Interop.vcproj.
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
			/>
			<Tool
				Name="VCWebDeploymentTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				Description="Merging binaries ..."
				CommandLine="..\bin\tools\mergebin.exe /S:.clr ..\System.Data.SQLite\bin\$(TargetFileName) $(TargetPath)&#x0D;&#x0A;sn -Ra $(TargetPath) ..\System.Data.SQLite\System.Data.SQLite.snk&#x0D;&#x0A;"
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"







|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
			/>
			<Tool
				Name="VCWebDeploymentTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				Description="Merging binaries ..."
				CommandLine="..\bin\tools\mergebin.exe /S:.clr ..\System.Data.SQLite\bin\$(TargetFileName) $(TargetPath)&#x0D;&#x0A;sn -Ra $(TargetPath) ..\System.Data.SQLite\System.Data.SQLite.snk&#x0D;&#x0A;COPY $(TargetDir)System.Data.SQLite.* $(VSInstallDir)Common7\IDE\PublicAssemblies"
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
455
456
457
458
459
460
461

462
463
464
465
466
467
468
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCWebDeploymentTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"

			/>
		</Configuration>
		<Configuration
			Name="Debug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"







>







455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCWebDeploymentTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="COPY $(TargetDir)System.Data.SQLite.* $(VSInstallDir)Common7\IDE\PublicAssemblies"
			/>
		</Configuration>
		<Configuration
			Name="Debug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
Changes to System.Data.SQLite/SQLiteConnection.cs.
482
483
484
485
486
487
488

489
490
491
492
493
494
495
    /// <description>N</description>
    /// <description>Y</description>
    /// </item>
    /// </list>
    /// </remarks>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue("")]

#endif
    public override string ConnectionString
    {
      get
      {
        return _connectionString;
      }







>







482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
    /// <description>N</description>
    /// <description>Y</description>
    /// </item>
    /// </list>
    /// </remarks>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue("")]
    [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.26.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string ConnectionString
    {
      get
      {
        return _connectionString;
      }
Changes to System.Data.SQLite/SQLiteDataAdapter.cs.
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

  /// <summary>
  /// SQLite implementation of DbDataAdapter.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [DefaultEvent("RowUpdated")]
  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.26.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
  [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
  public sealed class SQLiteDataAdapter : DbDataAdapter
  {
    private static object _updatingEventPH = new object();
    private static object _updatedEventPH = new object();

    /// <overloads>







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

  /// <summary>
  /// SQLite implementation of DbDataAdapter.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [DefaultEvent("RowUpdated")]
  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.26.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
  [Designer("SQLite.Designer.SQLiteAdapterDesigner, SQLite.Designer, Version=1.0.26.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
#endif
  public sealed class SQLiteDataAdapter : DbDataAdapter
  {
    private static object _updatingEventPH = new object();
    private static object _updatedEventPH = new object();

    /// <overloads>