Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2456 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
8 changed files with 213 additions and 2 deletions
@ -0,0 +1,31 @@ |
|||||||
|
using System.Reflection; |
||||||
|
using System.Runtime.CompilerServices; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("SQLiteDbToolsProvider")] |
||||||
|
[assembly: AssemblyDescription("")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("SQLiteDbToolsProvider")] |
||||||
|
[assembly: AssemblyCopyright("")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)] |
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")] |
||||||
@ -0,0 +1,66 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<ProjectGuid>{5C1F6FB6-AB08-430D-8956-E2BE137470CD}</ProjectGuid> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>SQLiteDbToolsProvider</RootNamespace> |
||||||
|
<AssemblyName>SQLiteDbToolsProvider</AssemblyName> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<OutputPath>bin\Release\</OutputPath> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Drawing" /> |
||||||
|
<Reference Include="System.Windows.Forms" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||||
|
<Compile Include="Src\Forms\SQLiteArtefactFactory.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Folder Include="Configuration" /> |
||||||
|
<Folder Include="Src" /> |
||||||
|
<Folder Include="Resources" /> |
||||||
|
<Folder Include="Src\Forms" /> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||||
|
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||||
|
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||||
|
<Name>ICSharpCode.Core</Name> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\SharpDbTools\SharpDbTools.csproj"> |
||||||
|
<Project>{93B2D6DF-7588-40C0-8A35-CA0DD7328FC3}</Project> |
||||||
|
<Name>SharpDbTools</Name> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
</Project> |
||||||
@ -0,0 +1,98 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Dickon Field" email=""/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Data; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using SharpDbTools.Data; |
||||||
|
using SharpDbTools.Forms; |
||||||
|
|
||||||
|
namespace SharpDbTools.SQLite.Forms |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of MetaDataNodeBuilder.
|
||||||
|
/// TODO: currently this is just a flat list - need to reflect ownership
|
||||||
|
/// relationships such as schema etc
|
||||||
|
/// </summary>
|
||||||
|
public class SQLiteFormsArtefactFactory : FormsArtefactFactory |
||||||
|
{ |
||||||
|
public SQLiteFormsArtefactFactory() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public override TreeNode CreateMetaDataNode(string logicalConnectionName) |
||||||
|
{ |
||||||
|
LoggingService.Debug(this.GetType().ToString() |
||||||
|
+ ": creating MetaDataNode for: " + logicalConnectionName); |
||||||
|
// create root node of the metadata collections tree
|
||||||
|
|
||||||
|
string nodeName = ResourceService.GetString("SharpDbTools.Forms.DbObjectNodeName"); |
||||||
|
TreeNode metaNode = new TreeNode(nodeName); |
||||||
|
|
||||||
|
// retrieve the metadata for this logical connection name
|
||||||
|
|
||||||
|
DbModelInfo info = DbModelInfoService.GetDbModelInfo(logicalConnectionName); |
||||||
|
|
||||||
|
// retrieve the table listing the metadata collections
|
||||||
|
|
||||||
|
DataTable metadataCollectionsTable = info.Tables[TableNames.MetaDataCollections]; |
||||||
|
|
||||||
|
// if it exists then populate the tree
|
||||||
|
|
||||||
|
if (metadataCollectionsTable != null) { |
||||||
|
LoggingService.Debug(this.GetType().ToString() + ": found metadata collections table, " + |
||||||
|
" building node..."); |
||||||
|
for (int i = 0; i < TableNames.PrimaryObjects.Length; i++) { |
||||||
|
string metadataCollectionName = TableNames.PrimaryObjects[i]; |
||||||
|
LoggingService.Debug("looking for metadata: " + metadataCollectionName); |
||||||
|
DataTable metaCollectionTable = info.Tables[metadataCollectionName]; |
||||||
|
if (metaCollectionTable == null) continue; |
||||||
|
LoggingService.Debug("found metadata collection: " + metadataCollectionName); |
||||||
|
string nodeDisplayNameKey = "SharpDbTools.Data.PrimaryObjects." + metadataCollectionName; |
||||||
|
string nodeDisplayName = ResourceService.GetString(nodeDisplayNameKey); |
||||||
|
TreeNode collectionNode = new TreeNode(nodeDisplayName); |
||||||
|
collectionNode.Name = logicalConnectionName + ":Collection:" + metadataCollectionName; |
||||||
|
metaNode.Nodes.Add(collectionNode); |
||||||
|
foreach (DataRow dbObjectRow in metaCollectionTable.Rows) { |
||||||
|
TreeNode objectNode = null; |
||||||
|
switch(metadataCollectionName) { |
||||||
|
case "Tables": |
||||||
|
//LoggingService.Debug("found table row");
|
||||||
|
objectNode = new TableTreeNode((string)dbObjectRow[2], logicalConnectionName); |
||||||
|
break; |
||||||
|
default: |
||||||
|
objectNode = new TreeNode((string)dbObjectRow[2]); |
||||||
|
break; |
||||||
|
} |
||||||
|
collectionNode.Nodes.Add(objectNode); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return metaNode; |
||||||
|
} |
||||||
|
|
||||||
|
public override string[] GetDescribeTableFieldNames() |
||||||
|
{ |
||||||
|
return tableFieldsToDisplay; |
||||||
|
} |
||||||
|
public override string[] GetDescribeTableColumnHeaderNames() |
||||||
|
{ |
||||||
|
return tableFieldsColumnHeaders; |
||||||
|
} |
||||||
|
|
||||||
|
private static string[] tableFieldsToDisplay = |
||||||
|
new string [] {"COLUMN_NAME", "DATATYPE", |
||||||
|
"LENGTH", "PRECISION", "SCALE", "NULLABLE"}; |
||||||
|
private static string[] tableFieldsColumnHeaders = |
||||||
|
new string[] { "Column", "Type", "Length", "Precision", "Scale", "Nullable" }; |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue