Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58b5ceffc0 | |||
| 36a2476499 | |||
| 53525f54c3 | |||
| 71ed745ab7 | |||
| 42db6fc0dc |
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,12 +0,0 @@
|
||||
*.suo
|
||||
*.exe
|
||||
*.dll
|
||||
*.pdb
|
||||
*.user
|
||||
*/bin/*
|
||||
*/obj/*
|
||||
.vs
|
||||
/packages/
|
||||
|
||||
/.issues/
|
||||
|
||||
21
LICENSE.txt
21
LICENSE.txt
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012-2025 Valeriano A.R.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 18
|
||||
VisualStudioVersion = 18.0.11205.157 d18.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.DatabaseExplorer", "VAR.DatabaseExplorer\VAR.DatabaseExplorer.csproj", "{79531B74-3062-4A71-9953-5702BEBDEC0E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{32C218F4-05C0-4F12-815F-02E82FCD5131}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitignore = .gitignore
|
||||
LICENSE.txt = LICENSE.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C8555709-4E29-4BE1-B4CC-0EA1195E8C1C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,205 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using VAR.DatabaseExplorer.Code.DataAccess;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.BusinessLogic
|
||||
{
|
||||
public class DatabaseBL
|
||||
{
|
||||
internal static Database Database_Get(string connectionString)
|
||||
{
|
||||
Database database = DatabaseDA.GetInfo(connectionString);
|
||||
return database;
|
||||
}
|
||||
|
||||
public static Database Database_GetSchema(string connectionString, bool fillTableDefinitions = false, bool fillProcDefinitions = false, bool fillViewDefinitions = false)
|
||||
{
|
||||
Database database = DatabaseDA.GetInfo(connectionString);
|
||||
database.Tables = TableBL.Table_GetAll(connectionString, fillTableDefinitions, fillViewDefinitions);
|
||||
database.Procedures = ProcedureBL.Procedure_GetAll(connectionString, fillProcDefinitions);
|
||||
return database;
|
||||
}
|
||||
|
||||
public static void Database_GenerateDocumentation(TextWriter txtWriter, Database database)
|
||||
{
|
||||
// Poner cabecera de la documentacion
|
||||
txtWriter.WriteLine("<!DOCTYPE html>");
|
||||
txtWriter.WriteLine("<html><head><title>" + database.Name + "</title></head>");
|
||||
txtWriter.WriteLine("<body>");
|
||||
|
||||
// Iterar cada tabla
|
||||
foreach (Table table in database.Tables)
|
||||
{
|
||||
// Cabecera de la info de tabla
|
||||
txtWriter.WriteLine("<h2>" + table.Schema + "." + table.Name + "</h2>");
|
||||
|
||||
// Iterar las columnas
|
||||
txtWriter.WriteLine("<table>");
|
||||
txtWriter.WriteLine("<thead><tr><th>Nombre</th><th>Tipo</th><th>Tamaño</th><th>Primaria</th></tr></thead>");
|
||||
txtWriter.WriteLine("<tbody>");
|
||||
foreach (Column c in table.Columns)
|
||||
{
|
||||
txtWriter.WriteLine("<tr><td>" +
|
||||
c.Name + "</td><td>" +
|
||||
c.Type + "</td><td>" +
|
||||
c.Size + "</td><td>" +
|
||||
c.PK + "</td></tr>");
|
||||
}
|
||||
txtWriter.WriteLine("</tbody></table>");
|
||||
}
|
||||
|
||||
// Iterar cada procedimiento
|
||||
foreach (Procedure proc in database.Procedures)
|
||||
{
|
||||
// Cabecera de la info del procedimiento
|
||||
txtWriter.WriteLine("<h2>" + proc.Schema + "." + proc.Name + "</h2>");
|
||||
|
||||
txtWriter.WriteLine("<pre><code>");
|
||||
txtWriter.WriteLine(proc.Definition);
|
||||
txtWriter.WriteLine("</code></pre>");
|
||||
}
|
||||
|
||||
// Poner pie y cerrar fichero
|
||||
txtWriter.WriteLine("</body></html>");
|
||||
}
|
||||
|
||||
public static void Database_ExportData(TextWriter txtWriter, string connectionString, Database database, List<Table> tablesToExportData)
|
||||
{
|
||||
const int OneMegaByte = 1 * 1024 * 1024;
|
||||
const int MaxSizePerBatch = OneMegaByte;
|
||||
const int MaxSizePerFile = OneMegaByte * 32;
|
||||
|
||||
// Preparar cabecera del script
|
||||
txtWriter.WriteLine("SET NOCOUNT ON;");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
|
||||
List<Table> tables = database.Tables;
|
||||
if (tablesToExportData.Any())
|
||||
{
|
||||
tables = tables.Where(t =>
|
||||
tablesToExportData.Select(tted => tted.Schema).Contains(t.Schema) &&
|
||||
tablesToExportData.Select(tted => tted.Name).Contains(t.Name) &&
|
||||
tablesToExportData.Select(tted => tted.Type).Contains(t.Type)).ToList();
|
||||
}
|
||||
|
||||
// Desactivar todas las FKs
|
||||
txtWriter.WriteLine("-- Disable all constraints");
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
if (table.Type != "BASE TABLE") { continue; }
|
||||
|
||||
string tableName = string.Format("[{0}].[{1}]", table.Schema, table.Name);
|
||||
txtWriter.WriteLine(string.Format("ALTER TABLE {0} NOCHECK CONSTRAINT all;", tableName));
|
||||
}
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
|
||||
// Prepara información a exportar
|
||||
long batchLength = 0;
|
||||
long fileLength = 0;
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
TableBL.Table_ExportData(table, txtWriter, connectionString, (lenght, onSplit) =>
|
||||
{
|
||||
batchLength += lenght;
|
||||
fileLength += lenght;
|
||||
|
||||
if (batchLength > MaxSizePerBatch)
|
||||
{
|
||||
txtWriter.WriteLine("PRINT '...';");
|
||||
txtWriter.WriteLine("GO");
|
||||
batchLength = 0;
|
||||
onSplit?.Invoke(txtWriter);
|
||||
}
|
||||
if (fileLength > MaxSizePerFile)
|
||||
{
|
||||
txtWriter.WriteLine("PRINT '...';");
|
||||
txtWriter.WriteLine("GO");
|
||||
SplittingStreamWriter.Split(txtWriter);
|
||||
fileLength = 0;
|
||||
batchLength = 0;
|
||||
onSplit?.Invoke(txtWriter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Activar todas las FKs
|
||||
txtWriter.WriteLine("-- Enable all constraints");
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
if (table.Type != "BASE TABLE") { continue; }
|
||||
|
||||
string tableName = string.Format("[{0}].[{1}]", table.Schema, table.Name);
|
||||
txtWriter.WriteLine(string.Format("ALTER TABLE {0} WITH CHECK CHECK CONSTRAINT all;", tableName));
|
||||
}
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
}
|
||||
|
||||
public static void Database_ExportTables(TextWriter txtWriter, string connectionString, Database database)
|
||||
{
|
||||
foreach (Table table in database.Tables)
|
||||
{
|
||||
TableBL.Table_GenerateCreate(table, txtWriter);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Database_ExportFunctions(StreamWriter txtWriter, Database database)
|
||||
{
|
||||
List<Procedure> exportedRoutines = new List<Procedure>();
|
||||
|
||||
int exportedOnLoopCount = 0;
|
||||
do
|
||||
{
|
||||
exportedOnLoopCount = 0;
|
||||
foreach (Procedure routine in database.Procedures)
|
||||
{
|
||||
if (exportedRoutines.Any(er => er.Schema == routine.Schema && er.Name == routine.Name)) { continue; }
|
||||
if (routine.Dependencies.Count > 0)
|
||||
{
|
||||
if (routine.Dependencies.Any(pd => exportedRoutines.Any(er => er.Schema == pd.Schema && er.Name == pd.Name) == false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ProcedureBL.Procedure_GenerateCreate(routine, txtWriter);
|
||||
exportedRoutines.Add(routine);
|
||||
exportedOnLoopCount++;
|
||||
}
|
||||
} while (exportedOnLoopCount > 0);
|
||||
}
|
||||
|
||||
public static void Database_ExportSchemas(StreamWriter txtWriter, string connectionString, Database database)
|
||||
{
|
||||
// Preparar cabecera del script
|
||||
txtWriter.WriteLine("SET NOCOUNT ON;");
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
|
||||
List<string> schemas = DatabaseDA.GetSchemas(connectionString);
|
||||
foreach (string schema in schemas)
|
||||
{
|
||||
txtWriter.WriteLine(string.Format("CREATE SCHEMA [{0}];", schema));
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Database_ExportViews(StreamWriter txtWriter, Database database)
|
||||
{
|
||||
// Preparar cabecera del script
|
||||
txtWriter.WriteLine("SET NOCOUNT ON;");
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
|
||||
foreach (Table table in database.Tables)
|
||||
{
|
||||
if (table.Type != "VIEW") { continue; }
|
||||
TableBL.View_GenerateCreate(table, txtWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using VAR.DatabaseExplorer.Code.DataAccess;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.BusinessLogic
|
||||
{
|
||||
public class ProcedureBL
|
||||
{
|
||||
public static List<Procedure> Procedure_GetAll(string connectionString, bool fillDefinition = false)
|
||||
{
|
||||
List<Procedure> procedures = ProcedureDA.GetAllProcedures(connectionString);
|
||||
if (fillDefinition)
|
||||
{
|
||||
// Get all definitions
|
||||
List<ProcedureDefinition> definitions = ProcedureDA.GetProcedureDefinitions(connectionString, null, null);
|
||||
foreach (Procedure procedure in procedures)
|
||||
{
|
||||
var sbDefinition = new StringBuilder();
|
||||
foreach (ProcedureDefinition definition in definitions)
|
||||
{
|
||||
if (procedure.Schema == definition.ProcedureSchema && procedure.Name == definition.ProcedureName)
|
||||
{
|
||||
sbDefinition.Append(definition.Definition);
|
||||
}
|
||||
}
|
||||
procedure.Definition = sbDefinition.ToString();
|
||||
}
|
||||
Procedure_AssingDependencies(procedures);
|
||||
}
|
||||
return procedures;
|
||||
}
|
||||
|
||||
private static void Procedure_AssignDependency(Procedure procedure, Procedure procedureDep)
|
||||
{
|
||||
if (procedure.Dependencies.Any(pd => procedureDep.Schema == pd.Schema && procedureDep.Name == pd.Name)) { return; }
|
||||
procedure.Dependencies.Add(procedureDep);
|
||||
}
|
||||
|
||||
private static void Procedure_CheckDependencies(IEnumerable<Procedure> procedures, Procedure procedureDep, string strProcFullName)
|
||||
{
|
||||
foreach (Procedure procedure in procedures)
|
||||
{
|
||||
if (procedure.Schema == procedureDep.Schema && procedure.Name == procedureDep.Name) { continue; }
|
||||
|
||||
if (string.IsNullOrEmpty(procedure.DefinitionLowercase))
|
||||
{
|
||||
procedure.DefinitionLowercase = procedure.Definition.ToLower();
|
||||
}
|
||||
if (procedure.DefinitionLowercase.Contains(strProcFullName))
|
||||
{
|
||||
Procedure_AssignDependency(procedure, procedureDep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Procedure_AssingDependencies(IEnumerable<Procedure> procedures)
|
||||
{
|
||||
foreach (Procedure procedureDep in procedures)
|
||||
{
|
||||
string strProcFullName;
|
||||
string strProcedureSchema = procedureDep.Schema.ToLower();
|
||||
string strProcedureName = procedureDep.Name.ToLower();
|
||||
|
||||
strProcFullName = string.Format("{0}.{1} ", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
strProcFullName = string.Format("{0}.{1}(", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
|
||||
strProcFullName = string.Format("[{0}].{1} ", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
strProcFullName = string.Format("[{0}].{1}(", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
strProcFullName = string.Format("{0}.[{1}]", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
strProcFullName = string.Format("[{0}].[{1}]", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
|
||||
strProcFullName = string.Format("\"{0}\".{1} ", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
strProcFullName = string.Format("\"{0}\".{1}(", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
strProcFullName = string.Format("{0}.\"{1}\"", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
strProcFullName = string.Format("\"{0}\".\"{1}\"", strProcedureSchema, strProcedureName);
|
||||
Procedure_CheckDependencies(procedures, procedureDep, strProcFullName);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Procedure_GenerateCreate(Procedure routine, StreamWriter txtWriter)
|
||||
{
|
||||
string routineName = string.Format("[{0}].[{1}]", routine.Schema, routine.Name);
|
||||
if (routine.Type.ToUpper() == "PROCEDURE")
|
||||
{
|
||||
txtWriter.WriteLine(string.Format("PRINT '*** Creating procedure {0}....';", routineName));
|
||||
txtWriter.WriteLine(string.Format("IF EXISTS (SELECT TOP 1 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = '{0}' AND ROUTINE_NAME = '{1}')", routine.Schema, routine.Name));
|
||||
txtWriter.WriteLine("BEGIN");
|
||||
txtWriter.WriteLine(string.Format(" DROP PROCEDURE {0};", routineName));
|
||||
txtWriter.WriteLine("END");
|
||||
}
|
||||
if (routine.Type.ToUpper() == "FUNCTION")
|
||||
{
|
||||
txtWriter.WriteLine(string.Format("PRINT '*** Creating function {0}....';", routineName));
|
||||
txtWriter.WriteLine(string.Format("IF EXISTS (SELECT TOP 1 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = '{0}' AND ROUTINE_NAME = '{1}')", routine.Schema, routine.Name));
|
||||
txtWriter.WriteLine("BEGIN");
|
||||
txtWriter.WriteLine(string.Format(" DROP FUNCTION {0};", routineName));
|
||||
txtWriter.WriteLine("END");
|
||||
}
|
||||
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(routine.Definition);
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine();
|
||||
}
|
||||
|
||||
public static List<Procedure> Procedure_VerifyAndGetInvalidProcedures(string connectionString)
|
||||
{
|
||||
List<Procedure> procedures = ProcedureDA.GetAllProcedures(connectionString);
|
||||
List<Procedure> invalidProcedures = new List<Procedure>();
|
||||
foreach (Procedure procedure in procedures)
|
||||
{
|
||||
if (DatabaseDA.VerifyModule(connectionString, procedure.Schema, procedure.Name) == false)
|
||||
{
|
||||
invalidProcedures.Add(procedure);
|
||||
}
|
||||
}
|
||||
return invalidProcedures;
|
||||
}
|
||||
|
||||
public static void Procedure_DeleteProcedures(string connectionString, List<Procedure> procedures)
|
||||
{
|
||||
ProcedureDA.Procedure_DeleteProcedures(connectionString, procedures);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using VAR.DatabaseExplorer.Code.DataAccess;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.BusinessLogic
|
||||
{
|
||||
public class TableBL
|
||||
{
|
||||
public static List<Table> Table_GetAll(string connectionString, bool fillColumns = false, bool fillViewDefinitions = false)
|
||||
{
|
||||
List<Table> tables = TableDA.GetAllTables(connectionString);
|
||||
if (fillColumns)
|
||||
{
|
||||
List<Column> allColumns = ColumnDA.GetColumns(connectionString, null, null);
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
table.Columns = allColumns.Where(c => c.TableName == table.Name && c.TableSchema == table.Schema).ToList();
|
||||
}
|
||||
}
|
||||
if (fillViewDefinitions)
|
||||
{
|
||||
// Get all view definitions
|
||||
List<ViewDefinition> definitions = TableDA.GetViewDefinitions(connectionString, null, null);
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
var sbDefinition = new StringBuilder();
|
||||
foreach (ViewDefinition definition in definitions)
|
||||
{
|
||||
if (table.Schema == definition.ViewSchema && table.Name == definition.ViewName)
|
||||
{
|
||||
sbDefinition.Append(definition.Definition);
|
||||
}
|
||||
}
|
||||
table.ViewDefinition = sbDefinition.ToString();
|
||||
}
|
||||
}
|
||||
return tables;
|
||||
}
|
||||
|
||||
public static void Table_ExportData(Table t, TextWriter txtWriter, string conectionString, Action<int, Action<TextWriter>> notifyLenght = null)
|
||||
{
|
||||
if (t.Type != "BASE TABLE") { return; }
|
||||
|
||||
string tableName = string.Format("[{0}].[{1}]", t.Schema, t.Name);
|
||||
txtWriter.WriteLine(string.Format("PRINT '*** Importing data of {0}....';", tableName));
|
||||
IEnumerable<TableRow> rows = TableDA.GetData(conectionString, tableName);
|
||||
if (t.Columns.Any(c => c.Indentity))
|
||||
{
|
||||
txtWriter.WriteLine(string.Format("-- {0}", tableName));
|
||||
txtWriter.WriteLine(string.Format("DELETE FROM {0};", tableName));
|
||||
txtWriter.WriteLine(string.Format("DBCC CHECKIDENT ('{0}', RESEED, 0);", tableName));
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Format("SET IDENTITY_INSERT {0} ON;", tableName));
|
||||
foreach (TableRow row in rows)
|
||||
{
|
||||
int lenght = TableRowHelper.TableRow_GenerateInsert(txtWriter, row, tableName);
|
||||
notifyLenght?.Invoke(lenght, (txt) =>
|
||||
{
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Format("SET IDENTITY_INSERT {0} ON;", tableName));
|
||||
});
|
||||
}
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Format("SET IDENTITY_INSERT {0} OFF;", tableName));
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
txtWriter.WriteLine(string.Format("-- {0}", tableName));
|
||||
txtWriter.WriteLine(string.Format("DELETE FROM {0};", tableName));
|
||||
txtWriter.WriteLine("GO");
|
||||
foreach (TableRow row in rows)
|
||||
{
|
||||
int lenght = TableRowHelper.TableRow_GenerateInsert(txtWriter, row, tableName);
|
||||
notifyLenght?.Invoke(lenght, null);
|
||||
}
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Table_GenerateCreate(Table table, TextWriter txtWriter)
|
||||
{
|
||||
if (table.Type != "BASE TABLE") { return; }
|
||||
|
||||
string tableName = string.Format("[{0}].[{1}]", table.Schema, table.Name);
|
||||
txtWriter.WriteLine(string.Format("PRINT '*** Creating tabla {0}....';", tableName));
|
||||
txtWriter.WriteLine(string.Format("IF EXISTS (SELECT TOP 1 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{0}' AND TABLE_NAME = '{1}')", table.Schema, table.Name));
|
||||
txtWriter.WriteLine("BEGIN");
|
||||
txtWriter.WriteLine(string.Format(" DROP TABLE {0};", tableName));
|
||||
txtWriter.WriteLine("END");
|
||||
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(string.Format("CREATE TABLE {0} (", tableName));
|
||||
bool firstColumn = true;
|
||||
foreach (Column c in table.Columns)
|
||||
{
|
||||
if (firstColumn == false)
|
||||
{
|
||||
txtWriter.WriteLine(",");
|
||||
}
|
||||
txtWriter.Write(" [");
|
||||
txtWriter.Write(c.Name);
|
||||
txtWriter.Write("] ");
|
||||
if (
|
||||
c.Type == "nvarchar" ||
|
||||
c.Type == "varchar" ||
|
||||
c.Type == "char" ||
|
||||
c.Type == "nchar" ||
|
||||
c.Type == "binary" ||
|
||||
c.Type == "varbinary" ||
|
||||
false)
|
||||
{
|
||||
if (c.Size < 0)
|
||||
{
|
||||
txtWriter.Write(string.Format("{0}(MAX)", c.Type));
|
||||
}
|
||||
else
|
||||
{
|
||||
txtWriter.Write(string.Format("{0}({1})", c.Type, c.Size));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txtWriter.Write(c.Type);
|
||||
}
|
||||
if (string.IsNullOrEmpty(c.Colation) == false && (
|
||||
c.Type == "nvarchar" ||
|
||||
c.Type == "varchar" ||
|
||||
c.Type == "char" ||
|
||||
c.Type == "nchar" ||
|
||||
false
|
||||
))
|
||||
{
|
||||
txtWriter.Write(string.Format(" COLLATE {0}", c.Colation));
|
||||
}
|
||||
if (c.Nullable)
|
||||
{
|
||||
txtWriter.Write(" NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
txtWriter.Write(" NOT NULL");
|
||||
}
|
||||
if (c.PK)
|
||||
{
|
||||
txtWriter.Write(" PRIMARY KEY");
|
||||
}
|
||||
if (c.Indentity)
|
||||
{
|
||||
txtWriter.Write(" IDENTITY(1,1)");
|
||||
}
|
||||
firstColumn = false;
|
||||
|
||||
}
|
||||
txtWriter.WriteLine();
|
||||
txtWriter.WriteLine(string.Format(");"));
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine();
|
||||
}
|
||||
|
||||
public static void View_GenerateCreate(Table table, StreamWriter txtWriter)
|
||||
{
|
||||
if (table.Type != "VIEW") { return; }
|
||||
|
||||
string viewName = string.Format("[{0}].[{1}]", table.Schema, table.Name);
|
||||
txtWriter.WriteLine(string.Format("PRINT '*** Creating view {0}....';", viewName));
|
||||
txtWriter.WriteLine(string.Format("IF EXISTS (SELECT TOP 1 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{0}' AND TABLE_NAME = '{1}')", table.Schema, table.Name));
|
||||
txtWriter.WriteLine("BEGIN");
|
||||
txtWriter.WriteLine(string.Format(" DROP VIEW {0};", viewName));
|
||||
txtWriter.WriteLine("END");
|
||||
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine(table.ViewDefinition);
|
||||
txtWriter.WriteLine("GO");
|
||||
txtWriter.WriteLine();
|
||||
}
|
||||
|
||||
public static List<Table> View_VerifyAndGetInvalidViews(string connectionString)
|
||||
{
|
||||
List<Table> tables = TableDA.GetAllTables(connectionString);
|
||||
List<Table> invalidViews = new List<Table>();
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
if (table.Type != "VIEW") { continue; }
|
||||
if (DatabaseDA.VerifyModule(connectionString, table.Schema, table.Name) == false)
|
||||
{
|
||||
invalidViews.Add(table);
|
||||
}
|
||||
}
|
||||
return invalidViews;
|
||||
}
|
||||
|
||||
public static void View_DeleteViews(string connectionString, List<Table> views)
|
||||
{
|
||||
TableDA.View_DeleteViews(connectionString, views);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataAccess
|
||||
{
|
||||
public class ColumnDA
|
||||
{
|
||||
public static List<Column> GetColumns(string conexionString, string tableSchema, string tableName)
|
||||
{
|
||||
var columns = new List<Column>();
|
||||
var cnx = new SqlConnection(conexionString);
|
||||
|
||||
// Preparar comando y parametros
|
||||
var da = new SqlDataAdapter(@"
|
||||
SELECT
|
||||
col.TABLE_SCHEMA TableSchema,
|
||||
col.TABLE_NAME TableName,
|
||||
col.COLUMN_NAME AS ColumnName,
|
||||
col.DATA_TYPE AS Type,
|
||||
col.CHARACTER_MAXIMUM_LENGTH AS Size,
|
||||
c.KeyType AS KeyType,
|
||||
col.IS_NULLABLE AS Nullable,
|
||||
CASE WHEN (COLUMNPROPERTY(object_id(col.TABLE_SCHEMA+'.'+col.TABLE_NAME), col.COLUMN_NAME, 'IsIdentity') = 1) THEN 1 ELSE 0 END IsIdentity,
|
||||
col.COLLATION_NAME Colation,
|
||||
NULL EmptyColumn
|
||||
FROM INFORMATION_SCHEMA.COLUMNS AS col
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
k.TABLE_SCHEMA TableSchema,
|
||||
k.TABLE_NAME TableName,
|
||||
k.COLUMN_NAME ColumnName,
|
||||
c.CONSTRAINT_TYPE KeyType
|
||||
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS k
|
||||
LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS c
|
||||
ON k.CONSTRAINT_NAME=c.CONSTRAINT_NAME AND
|
||||
k.TABLE_NAME=c.TABLE_NAME AND
|
||||
k.TABLE_SCHEMA=c.TABLE_SCHEMA
|
||||
) c ON col.COLUMN_NAME=c.ColumnName AND
|
||||
col.TABLE_NAME=c.TableName AND
|
||||
col.TABLE_SCHEMA=c.TableSchema AND
|
||||
c.KeyType = 'PRIMARY KEY'
|
||||
WHERE (@TableName IS NULL OR col.TABLE_NAME=@TableName) AND
|
||||
(@TableSchema IS NULL OR col.TABLE_SCHEMA=@TableSchema)
|
||||
ORDER BY col.TABLE_SCHEMA, col.TABLE_NAME, col.ORDINAL_POSITION
|
||||
", cnx);
|
||||
var prm = new SqlParameter("@TableName", SqlDbType.VarChar, 100) { Value = (object)tableName ?? DBNull.Value };
|
||||
da.SelectCommand.Parameters.Add(prm);
|
||||
prm = new SqlParameter("@TableSchema", SqlDbType.VarChar, 100) { Value = (object)tableSchema ?? DBNull.Value };
|
||||
da.SelectCommand.Parameters.Add(prm);
|
||||
|
||||
// Obtener datatable con las columnas
|
||||
var dt = new DataTable();
|
||||
cnx.Open();
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
// Recorrer datatable estableciendo la lista de columnas
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
Column col = new Column();
|
||||
|
||||
col.TableSchema = Convert.ToString(dr["TableSchema"]);
|
||||
col.TableName = Convert.ToString(dr["TableName"]);
|
||||
col.Name = Convert.ToString(dr["ColumnName"]);
|
||||
|
||||
col.Type = Convert.ToString(dr["Type"]);
|
||||
|
||||
if ((dr["Size"] is DBNull) == false)
|
||||
{
|
||||
col.Size = Convert.ToInt32(dr["Size"]);
|
||||
}
|
||||
|
||||
string strNullable = (Convert.ToString(dr["Nullable"])).ToLower();
|
||||
col.Nullable = (strNullable == "yes") || (strNullable == "1") || (strNullable == "true");
|
||||
|
||||
string KeyType = Convert.ToString(dr["KeyType"]).ToLower();
|
||||
if (KeyType.Contains("primary"))
|
||||
{
|
||||
col.PK = true;
|
||||
}
|
||||
col.Indentity = Convert.ToBoolean(dr["IsIdentity"]);
|
||||
col.Colation = Convert.ToString(dr["Colation"]);
|
||||
|
||||
columns.Add(col);
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataAccess
|
||||
{
|
||||
public class DatabaseDA
|
||||
{
|
||||
public static List<Database> GetAllDatabases(string connectionString)
|
||||
{
|
||||
var databases = new List<Database>();
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
|
||||
cnx.Open();
|
||||
DataTable dt = cnx.GetSchema("Databases");
|
||||
cnx.Close();
|
||||
dt.DefaultView.Sort = "database_name ASC, create_date ASC";
|
||||
dt = dt.DefaultView.ToTable();
|
||||
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
databases.Add(new Database
|
||||
{
|
||||
Name = (string)dr["database_name"],
|
||||
CreateDate = (DateTime)dr["create_date"]
|
||||
});
|
||||
}
|
||||
return databases;
|
||||
}
|
||||
|
||||
public static Database GetInfo(string connectionString)
|
||||
{
|
||||
string databaseName = null;
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
string strCmd = string.Format(@"
|
||||
SELECT
|
||||
[name] DatabaseName,
|
||||
[create_date] CreateDate
|
||||
FROM sys.databases
|
||||
WHERE database_id = DB_ID();
|
||||
");
|
||||
var da = new SqlDataAdapter(strCmd, cnx);
|
||||
var dt = new DataTable();
|
||||
cnx.Open();
|
||||
databaseName = cnx.Database;
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
if(dt.Rows.Count == 0)
|
||||
{
|
||||
return new Database
|
||||
{
|
||||
Name = databaseName,
|
||||
CreateDate = DateTime.UtcNow,
|
||||
};
|
||||
}
|
||||
|
||||
var database = new Database
|
||||
{
|
||||
Name = Convert.ToString(dt.Rows[0]["DatabaseName"]),
|
||||
CreateDate = Convert.ToDateTime(dt.Rows[0]["CreateDate"]),
|
||||
};
|
||||
return database;
|
||||
}
|
||||
|
||||
public static List<string> GetSchemas(string connectionString)
|
||||
{
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
string strCmd = string.Format(@"
|
||||
select s.name as schema_name
|
||||
from sys.schemas s
|
||||
where s.principal_id = 1 AND schema_id != 1
|
||||
order by s.name
|
||||
");
|
||||
var da = new SqlDataAdapter(strCmd, cnx);
|
||||
var dt = new DataTable();
|
||||
cnx.Open();
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
List<string> schemas = dt.AsEnumerable().Select(dr => Convert.ToString(dr["schema_name"])).ToList();
|
||||
return schemas;
|
||||
}
|
||||
|
||||
public static bool SupportedSqlServerVersion(string serverVersion)
|
||||
{
|
||||
return
|
||||
serverVersion.StartsWith("10.") ||
|
||||
serverVersion.StartsWith("11.") ||
|
||||
serverVersion.StartsWith("12.") ||
|
||||
serverVersion.StartsWith("13.") ||
|
||||
serverVersion.StartsWith("14.") ||
|
||||
serverVersion.StartsWith("15.") ||
|
||||
serverVersion.StartsWith("16.") ||
|
||||
false;
|
||||
}
|
||||
|
||||
public static bool VerifyModule(string connectionString, string schema, string name)
|
||||
{
|
||||
SqlDataAdapter dataAdapter;
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
cnx.Open();
|
||||
|
||||
string procedureName = string.Format("[{0}].[{1}]", schema, name);
|
||||
|
||||
if (SupportedSqlServerVersion(cnx.ServerVersion))
|
||||
{
|
||||
dataAdapter = new SqlDataAdapter(@"
|
||||
BEGIN TRY
|
||||
EXECUTE sys.sp_refreshsqlmodule @Name;
|
||||
SELECT 1 'OK';
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SELECT 0 'OK';
|
||||
END CATCH
|
||||
", cnx);
|
||||
dataAdapter.SelectCommand.Parameters.AddWithValue("@Name", (object)procedureName ?? DBNull.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnx.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
var dt = new DataTable();
|
||||
dataAdapter.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
int isOK = Convert.ToInt32(dt.Rows[0][0]);
|
||||
|
||||
return isOK != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Text;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataAccess
|
||||
{
|
||||
public class ProcedureDA
|
||||
{
|
||||
public static List<Procedure> GetAllProcedures(string connectionString)
|
||||
{
|
||||
var procedures = new List<Procedure>();
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
|
||||
var da = new SqlDataAdapter(
|
||||
"SELECT ROUTINE_NAME Name, ROUTINE_SCHEMA [Schema], CREATED CreateDate, ROUTINE_TYPE [Type] FROM INFORMATION_SCHEMA.ROUTINES",
|
||||
cnx);
|
||||
var dt = new DataTable();
|
||||
cnx.Open();
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
procedures.Add(new Procedure
|
||||
{
|
||||
Schema = Convert.ToString(dr["Schema"]),
|
||||
Name = Convert.ToString(dr["Name"]),
|
||||
Type = Convert.ToString(dr["Type"]),
|
||||
CreateDate = Convert.ToDateTime(dr["CreateDate"]),
|
||||
});
|
||||
}
|
||||
return procedures;
|
||||
}
|
||||
|
||||
public static string GetProcedureDefinition(string connectionString, string schema, string name)
|
||||
{
|
||||
SqlDataAdapter dataAdapter;
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
cnx.Open();
|
||||
|
||||
if (DatabaseDA.SupportedSqlServerVersion(cnx.ServerVersion))
|
||||
{
|
||||
dataAdapter = new SqlDataAdapter(@"
|
||||
SELECT
|
||||
sn.name ProcedureSchema,
|
||||
sp.name ProcedureName,
|
||||
ISNULL(smsp.definition, ssmsp.definition) AS [Definition]
|
||||
FROM sys.all_objects AS sp
|
||||
INNER JOIN sys.schemas sn ON sp.schema_id = sn.schema_id
|
||||
LEFT OUTER JOIN sys.sql_modules AS smsp ON smsp.object_id = sp.object_id
|
||||
LEFT OUTER JOIN sys.system_sql_modules AS ssmsp ON ssmsp.object_id = sp.object_id
|
||||
WHERE
|
||||
(sp.type = N'P' OR sp.type = N'RF' OR sp.type = N'PC' OR sp.type = N'IF' OR sp.type = N'FN' OR sp.type = N'TF')
|
||||
AND
|
||||
(@name IS NULL OR sp.name = @name) AND
|
||||
(@schema IS NULL OR sn.name = @schema)
|
||||
", cnx);
|
||||
dataAdapter.SelectCommand.Parameters.AddWithValue("@Name", name);
|
||||
dataAdapter.SelectCommand.Parameters.AddWithValue("@Schema", schema);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnx.Close();
|
||||
return null;
|
||||
}
|
||||
|
||||
var dt = new DataTable();
|
||||
dataAdapter.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
var sbProc = new StringBuilder();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string strProcBlock = Convert.ToString(dr["Definition"]);
|
||||
strProcBlock = strProcBlock.Replace("\r", "").Replace("\n", "\r\n");
|
||||
sbProc.Append(strProcBlock);
|
||||
}
|
||||
|
||||
return sbProc.ToString();
|
||||
}
|
||||
|
||||
public static List<ProcedureDefinition> GetProcedureDefinitions(string connectionString, string schema, string name)
|
||||
{
|
||||
SqlDataAdapter dataAdapter;
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
cnx.Open();
|
||||
|
||||
if (DatabaseDA.SupportedSqlServerVersion(cnx.ServerVersion))
|
||||
{
|
||||
dataAdapter = new SqlDataAdapter(@"
|
||||
SELECT
|
||||
sn.name ProcedureSchema,
|
||||
sp.name ProcedureName,
|
||||
ISNULL(smsp.definition, ssmsp.definition) AS [Definition]
|
||||
FROM sys.all_objects AS sp
|
||||
INNER JOIN sys.schemas sn ON sp.schema_id = sn.schema_id
|
||||
LEFT OUTER JOIN sys.sql_modules AS smsp ON smsp.object_id = sp.object_id
|
||||
LEFT OUTER JOIN sys.system_sql_modules AS ssmsp ON ssmsp.object_id = sp.object_id
|
||||
WHERE
|
||||
(sp.type = N'P' OR sp.type = N'RF' OR sp.type = N'PC' OR sp.type = N'IF' OR sp.type = N'FN' OR sp.type = N'TF')
|
||||
AND
|
||||
(@name IS NULL OR sp.name = @name) AND
|
||||
(@schema IS NULL OR sn.name = @schema)
|
||||
", cnx);
|
||||
dataAdapter.SelectCommand.Parameters.AddWithValue("@Name", (object)name ?? DBNull.Value);
|
||||
dataAdapter.SelectCommand.Parameters.AddWithValue("@Schema", (object)schema ?? DBNull.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnx.Close();
|
||||
return null;
|
||||
}
|
||||
|
||||
var dt = new DataTable();
|
||||
dataAdapter.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
var definitions = new List<ProcedureDefinition>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string strProcSchema = Convert.ToString(dr["ProcedureSchema"]);
|
||||
string strProcName = Convert.ToString(dr["ProcedureName"]);
|
||||
string strProcBlock = Convert.ToString(dr["Definition"]);
|
||||
strProcBlock = strProcBlock.Replace("\r", "").Replace("\n", "\r\n");
|
||||
definitions.Add(new ProcedureDefinition { ProcedureSchema = strProcSchema, ProcedureName = strProcName, Definition = strProcBlock });
|
||||
}
|
||||
|
||||
return definitions;
|
||||
}
|
||||
|
||||
public static void Procedure_DeleteProcedures(string connectionString, List<Procedure> procedures)
|
||||
{
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
cnx.Open();
|
||||
|
||||
foreach (Procedure procedure in procedures)
|
||||
{
|
||||
string strCmd = null;
|
||||
if (procedure.Type == "FUNCTION")
|
||||
{
|
||||
strCmd = string.Format("DROP FUNCTION [{0}].[{1}]", procedure.Schema, procedure.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
strCmd = string.Format("DROP PROCEDURE [{0}].[{1}]", procedure.Schema, procedure.Name);
|
||||
}
|
||||
var cmd = new SqlCommand(strCmd, cnx);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
cnx.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Sql;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataAccess
|
||||
{
|
||||
public class ServerDA
|
||||
{
|
||||
public static List<Server> GetAllServers()
|
||||
{
|
||||
var servers = new List<Server>();
|
||||
SqlDataSourceEnumerator enumerador = SqlDataSourceEnumerator.Instance;
|
||||
|
||||
DataTable dtServers = enumerador.GetDataSources();
|
||||
dtServers.DefaultView.Sort = "ServerName ASC, InstanceName ASC, Version ASC";
|
||||
dtServers = dtServers.DefaultView.ToTable();
|
||||
|
||||
foreach (DataRow dr in dtServers.Rows)
|
||||
{
|
||||
servers.Add(new Server
|
||||
{
|
||||
Name = (dr["ServerName"] == DBNull.Value) ? string.Empty : (string)dr["ServerName"],
|
||||
Instance = (dr["InstanceName"] == DBNull.Value) ? string.Empty : (string)dr["InstanceName"],
|
||||
Version = (dr["Version"] == DBNull.Value) ? "???" : (string)dr["Version"]
|
||||
});
|
||||
}
|
||||
return servers;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataAccess
|
||||
{
|
||||
public class TableDA
|
||||
{
|
||||
public static List<Table> GetAllTables(string connectionString)
|
||||
{
|
||||
var tables = new List<Table>();
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
|
||||
cnx.Open();
|
||||
DataTable dt = cnx.GetSchema("Tables");
|
||||
cnx.Close();
|
||||
dt.DefaultView.Sort = "TABLE_SCHEMA ASC, TABLE_NAME ASC, TABLE_TYPE ASC";
|
||||
dt = dt.DefaultView.ToTable();
|
||||
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
Table table = new Table
|
||||
{
|
||||
Schema = (string)dr["TABLE_SCHEMA"],
|
||||
Name = (string)dr["TABLE_NAME"],
|
||||
Type = (string)dr["TABLE_TYPE"]
|
||||
};
|
||||
|
||||
tables.Add(table);
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
public static List<ViewDefinition> GetViewDefinitions(string connectionString, string schema = null, string name = null)
|
||||
{
|
||||
SqlDataAdapter dataAdapter;
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
cnx.Open();
|
||||
|
||||
if (DatabaseDA.SupportedSqlServerVersion(cnx.ServerVersion))
|
||||
{
|
||||
dataAdapter = new SqlDataAdapter(@"
|
||||
SELECT
|
||||
sn.name ViewSchema,
|
||||
SO.name ViewName,
|
||||
ISNULL(SM.definition, SM.definition) AS [Definition]
|
||||
FROM sys.sql_modules SM
|
||||
INNER JOIN sys.Objects SO ON SM.Object_id = SO.Object_id
|
||||
INNER JOIN sys.schemas sn ON SO.schema_id = sn.schema_id
|
||||
WHERE SO.type = 'v'
|
||||
AND
|
||||
(@name IS NULL OR SO.name = @name) AND
|
||||
(@schema IS NULL OR sn.name = @schema)
|
||||
", cnx);
|
||||
dataAdapter.SelectCommand.Parameters.AddWithValue("@Name", (object)name ?? DBNull.Value);
|
||||
dataAdapter.SelectCommand.Parameters.AddWithValue("@Schema", (object)schema ?? DBNull.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnx.Close();
|
||||
return null;
|
||||
}
|
||||
|
||||
var dt = new DataTable();
|
||||
dataAdapter.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
var definitions = new List<ViewDefinition>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string strViewSchema = Convert.ToString(dr["ViewSchema"]);
|
||||
string strViewName = Convert.ToString(dr["ViewName"]);
|
||||
string strDefinition = Convert.ToString(dr["Definition"]);
|
||||
strDefinition = strDefinition.Replace("\r", "").Replace("\n", "\r\n");
|
||||
definitions.Add(new ViewDefinition { ViewSchema = strViewSchema, ViewName = strViewName, Definition = strDefinition });
|
||||
}
|
||||
|
||||
return definitions;
|
||||
}
|
||||
|
||||
public static IEnumerable<TableRow> GetData(string connectionString, string tableFullName)
|
||||
{
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
string strCmd = string.Format("SELECT * FROM {0}", tableFullName);
|
||||
var cmd = new SqlCommand(strCmd, cnx);
|
||||
cnx.Open();
|
||||
SqlDataReader reader = cmd.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
TableRow row = TableRowHelper.ConvertFromDataRecord(reader);
|
||||
yield return row;
|
||||
}
|
||||
cnx.Close();
|
||||
}
|
||||
|
||||
public static void View_DeleteViews(string connectionString, List<Table> views)
|
||||
{
|
||||
var cnx = new SqlConnection(connectionString);
|
||||
cnx.Open();
|
||||
|
||||
foreach (Table view in views)
|
||||
{
|
||||
string strCmd = string.Format("DROP VIEW [{0}].[{1}]", view.Schema, view.Name);
|
||||
var cmd = new SqlCommand(strCmd, cnx);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
cnx.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code
|
||||
{
|
||||
public static class DataTableHelper
|
||||
{
|
||||
public static void DataTable_GenerateInserts(TextWriter txtWriter, DataTable dataTable, string destTable)
|
||||
{
|
||||
const int OneMegaByte = 1 * 1024 * 1024;
|
||||
const int MaxSizePerBatch = OneMegaByte;
|
||||
var nfi = new NumberFormatInfo { NumberDecimalSeparator = "." };
|
||||
|
||||
var sbColumns = new StringBuilder();
|
||||
foreach (DataColumn dc in dataTable.Columns)
|
||||
{
|
||||
// El nombre de la columna
|
||||
if (sbColumns.Length > 0) { sbColumns.Append(", "); }
|
||||
sbColumns.AppendFormat("[{0}]", dc.ColumnName);
|
||||
}
|
||||
int size = 0;
|
||||
// Recorrer la tabla de datos
|
||||
foreach (DataRow dr in dataTable.Rows)
|
||||
{
|
||||
var sbValues = new StringBuilder();
|
||||
foreach (DataColumn dc in dataTable.Columns)
|
||||
{
|
||||
// El valor de la columna
|
||||
if (sbValues.Length > 0) { sbValues.Append(", "); }
|
||||
object valor = dr[dc];
|
||||
if (valor == DBNull.Value || valor == null)
|
||||
{
|
||||
// NULOS
|
||||
sbValues.Append("NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
string type = dc.DataType.Name.ToLower();
|
||||
if (type == "string")
|
||||
{
|
||||
// Cadenas
|
||||
sbValues.AppendFormat("N'{0}'", ((string)valor).Replace("'", "''"));
|
||||
}
|
||||
else if (type == "short" || type == "int16")
|
||||
{
|
||||
// short
|
||||
sbValues.Append(((short)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "int" || type == "int32")
|
||||
{
|
||||
// int
|
||||
sbValues.Append(((int)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "long" || type == "int64")
|
||||
{
|
||||
// long
|
||||
sbValues.Append(((long)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "decimal")
|
||||
{
|
||||
// Decimales
|
||||
sbValues.Append(((decimal)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "bit" || type == "bool" || type == "boolean")
|
||||
{
|
||||
// Booleanos
|
||||
sbValues.Append(((bool)valor) ? "1" : "0");
|
||||
}
|
||||
else if (type == "byte[]")
|
||||
{
|
||||
// Arrays de bytes (imágenes, archivos etc)
|
||||
sbValues.AppendFormat("0x{0}", BitConverter.ToString(((byte[])valor)).Replace("-", ""));
|
||||
}
|
||||
else if (type == "datetime")
|
||||
{
|
||||
// DateTime
|
||||
sbValues.AppendFormat("'{0}'", ((DateTime)valor).ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otros
|
||||
sbValues.AppendFormat("'{0}'", valor.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Insertar fila a la datatable destino
|
||||
string strLine = string.Format("INSERT INTO {0} ({1}) VALUES ({2});",
|
||||
destTable, sbColumns.ToString(), sbValues.ToString());
|
||||
if ((size + strLine.Length) >= MaxSizePerBatch)
|
||||
{
|
||||
txtWriter.WriteLine("PRINT '...';");
|
||||
txtWriter.WriteLine("GO");
|
||||
size = 0;
|
||||
}
|
||||
size += strLine.Length;
|
||||
txtWriter.WriteLine(strLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
[Serializable]
|
||||
public class Column
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string TableSchema { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string TableName { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Type { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public int Size { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public bool Nullable { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public bool PK { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public bool Indentity { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Colation { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
[Serializable]
|
||||
public class Database
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<Table> Tables { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<Procedure> Procedures { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
[Serializable]
|
||||
public class Procedure
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string Schema { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Type { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Definition { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string DefinitionLowercase { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public List<Procedure> Dependencies { get; } = new List<Procedure>();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
public class ProcedureDefinition
|
||||
{
|
||||
public string ProcedureSchema { get; set; }
|
||||
public string ProcedureName { get; set; }
|
||||
public string Definition { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
[Serializable]
|
||||
public class Server
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Instance { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Version { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<User> Users { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<Database> Databases { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
[Serializable]
|
||||
public class Table
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string Schema { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Type { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<Column> Columns { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string ViewDefinition { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
public class TableRow
|
||||
{
|
||||
public List<TableCell> Cells { get; } = new List<TableCell>();
|
||||
}
|
||||
|
||||
public class TableCell
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public object Data { get; set; }
|
||||
public Type DataType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
[Serializable]
|
||||
public class User
|
||||
{
|
||||
[XmlAttribute]
|
||||
public bool ImplicitUser { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.Code.DataTransfer
|
||||
{
|
||||
public class ViewDefinition
|
||||
{
|
||||
public string ViewSchema { get; set; }
|
||||
public string ViewName { get; set; }
|
||||
public string Definition { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code
|
||||
{
|
||||
class SplittingStreamWriter : TextWriter
|
||||
{
|
||||
private string _baseFileName = null;
|
||||
private int _fileNumber = 0;
|
||||
|
||||
private StreamWriter _currentStreamWriter = null;
|
||||
|
||||
public SplittingStreamWriter(string baseFileName)
|
||||
{
|
||||
_baseFileName = baseFileName;
|
||||
_currentStreamWriter = new StreamWriter(string.Format(_baseFileName, _fileNumber));
|
||||
}
|
||||
|
||||
public override void Write(char value)
|
||||
{
|
||||
_currentStreamWriter.Write(value);
|
||||
}
|
||||
|
||||
public override void Write(string value)
|
||||
{
|
||||
_currentStreamWriter.Write(value);
|
||||
}
|
||||
|
||||
public override void WriteLine()
|
||||
{
|
||||
_currentStreamWriter.WriteLine();
|
||||
}
|
||||
|
||||
public override void WriteLine(string value)
|
||||
{
|
||||
_currentStreamWriter.WriteLine(value);
|
||||
}
|
||||
|
||||
public override Encoding Encoding
|
||||
{
|
||||
get { return Encoding.Default; }
|
||||
}
|
||||
|
||||
public void Split()
|
||||
{
|
||||
_currentStreamWriter.Close();
|
||||
_fileNumber++;
|
||||
_currentStreamWriter = new StreamWriter(string.Format(_baseFileName, _fileNumber));
|
||||
}
|
||||
|
||||
public static void Split(object obj)
|
||||
{
|
||||
SplittingStreamWriter splittingStreamWriter = obj as SplittingStreamWriter;
|
||||
if (obj == null) { return; }
|
||||
splittingStreamWriter.Split();
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
_currentStreamWriter.Close();
|
||||
_currentStreamWriter = null;
|
||||
_fileNumber = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Code
|
||||
{
|
||||
public class TableRowHelper
|
||||
{
|
||||
public static TableRow ConvertFromDataRecord(IDataRecord record)
|
||||
{
|
||||
var row = new TableRow();
|
||||
int columnNumber = record.FieldCount;
|
||||
for (int i = 0; i < columnNumber; i++)
|
||||
{
|
||||
TableCell cell = new TableCell
|
||||
{
|
||||
Name = record.GetName(i),
|
||||
Data = record.GetValue(i),
|
||||
DataType = record.GetFieldType(i),
|
||||
};
|
||||
row.Cells.Add(cell);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
public static int TableRow_GenerateInsert(TextWriter txtWriter, TableRow row, string destTable)
|
||||
{
|
||||
var nfi = new NumberFormatInfo { NumberDecimalSeparator = "." };
|
||||
|
||||
var sbColumns = new StringBuilder();
|
||||
foreach (TableCell cell in row.Cells)
|
||||
{
|
||||
// El nombre de la columna
|
||||
if (sbColumns.Length > 0) { sbColumns.Append(", "); }
|
||||
sbColumns.AppendFormat("[{0}]", cell.Name);
|
||||
}
|
||||
var sbValues = new StringBuilder();
|
||||
foreach (TableCell cell in row.Cells)
|
||||
{
|
||||
// El valor de la columna
|
||||
if (sbValues.Length > 0) { sbValues.Append(", "); }
|
||||
object valor = cell.Data;
|
||||
if (valor == DBNull.Value || valor == null)
|
||||
{
|
||||
// NULOS
|
||||
sbValues.Append("NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
string type = cell.DataType.Name.ToLower();
|
||||
if (type == "string")
|
||||
{
|
||||
// Cadenas
|
||||
sbValues.AppendFormat("N'{0}'", ((string)valor).Replace("'", "''"));
|
||||
}
|
||||
else if (type == "short" || type == "int16")
|
||||
{
|
||||
// short
|
||||
sbValues.Append(((short)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "int" || type == "int32")
|
||||
{
|
||||
// int
|
||||
sbValues.Append(((int)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "long" || type == "int64")
|
||||
{
|
||||
// long
|
||||
sbValues.Append(((long)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "decimal")
|
||||
{
|
||||
// Decimales
|
||||
sbValues.Append(((decimal)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "float")
|
||||
{
|
||||
// Float
|
||||
sbValues.Append(((float)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "double")
|
||||
{
|
||||
// Double
|
||||
sbValues.Append(((double)valor).ToString(nfi));
|
||||
}
|
||||
else if (type == "bit" || type == "bool" || type == "boolean")
|
||||
{
|
||||
// Booleanos
|
||||
sbValues.Append(((bool)valor) ? "1" : "0");
|
||||
}
|
||||
else if (type == "byte[]")
|
||||
{
|
||||
// Arrays de bytes (imágenes, archivos etc)
|
||||
sbValues.AppendFormat("0x{0}", BitConverter.ToString(((byte[])valor)).Replace("-", ""));
|
||||
}
|
||||
else if (type == "datetime")
|
||||
{
|
||||
// DateTime
|
||||
sbValues.AppendFormat("'{0}'", ((DateTime)valor).ToString("yyyy-MM-ddTHH:mm:ss.fff"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otros
|
||||
sbValues.AppendFormat("'{0}'", valor.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
string strLine = string.Format("INSERT INTO {0} ({1}) VALUES ({2});",
|
||||
destTable, sbColumns.ToString(), sbValues.ToString());
|
||||
txtWriter.WriteLine(strLine);
|
||||
return strLine.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Controls
|
||||
{
|
||||
[DefaultProperty("Items")]
|
||||
[DefaultEvent("SelectedIndexChanged")]
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.AutoDispatch)]
|
||||
[Docking(DockingBehavior.Ask)]
|
||||
public class CustomListView : ListView
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private ListViewItemComparer itemComparer = new ListViewItemComparer();
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Properties
|
||||
|
||||
private bool allowSorting = false;
|
||||
|
||||
public bool AllowSorting
|
||||
{
|
||||
get { return allowSorting; }
|
||||
set { allowSorting = value; }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Control life cicle
|
||||
|
||||
public CustomListView()
|
||||
{
|
||||
ColumnClick += CustomListView_ColumnClick;
|
||||
}
|
||||
|
||||
#endregion Control life cicle
|
||||
|
||||
#region Events
|
||||
|
||||
private void CustomListView_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
if (!allowSorting) { return; }
|
||||
itemComparer.SetColumn(e.Column);
|
||||
ListViewItemSorter = itemComparer;
|
||||
Sort();
|
||||
}
|
||||
|
||||
#endregion Events
|
||||
}
|
||||
|
||||
#region ListViewItemComparer
|
||||
|
||||
internal class ListViewItemComparer : IComparer
|
||||
{
|
||||
private int _col;
|
||||
private bool _ascending;
|
||||
|
||||
public void SetColumn(int col)
|
||||
{
|
||||
_col = col;
|
||||
_ascending = _col != col || !_ascending;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
var itemA = (ListViewItem)x;
|
||||
var itemB = (ListViewItem)y;
|
||||
|
||||
if (itemA.SubItems.Count <= _col || itemB.SubItems.Count <= _col)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return _ascending
|
||||
? String.CompareOrdinal(itemA.SubItems[_col].Text, itemB.SubItems[_col].Text)
|
||||
: String.CompareOrdinal(itemB.SubItems[_col].Text, itemA.SubItems[_col].Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion ListViewItemComparer
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Controls
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.AutoDispatch)]
|
||||
public class CustomTextBox : TextBox
|
||||
{
|
||||
#region SetTabWidth
|
||||
|
||||
private const int EM_SETTABSTOPS = 0x00CB;
|
||||
|
||||
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern IntPtr SendMessage(IntPtr h, int msg, int wParam, int[] lParam);
|
||||
|
||||
protected void SetTabWidth(int tabWidth)
|
||||
{
|
||||
SendMessage(Handle, EM_SETTABSTOPS, 1, new int[] { tabWidth * 4 });
|
||||
}
|
||||
|
||||
#endregion SetTabWidth
|
||||
|
||||
private int _tabWidth = 8;
|
||||
|
||||
public int TabWidth
|
||||
{
|
||||
get { return _tabWidth; }
|
||||
set
|
||||
{
|
||||
_tabWidth = value;
|
||||
SetTabWidth(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VAR.DatabaseExplorer.Controls
|
||||
{
|
||||
public class WindowButton : Button
|
||||
{
|
||||
#region Properties
|
||||
|
||||
private Form _window = null;
|
||||
|
||||
public Form Window
|
||||
{
|
||||
get { return _window; }
|
||||
set { _window = value; }
|
||||
}
|
||||
|
||||
private bool _active = false;
|
||||
|
||||
public bool Active
|
||||
{
|
||||
get { return _active; }
|
||||
set
|
||||
{
|
||||
_active = value;
|
||||
ForeColor = _active ? Color.Black : Color.Gray;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Creator
|
||||
|
||||
public WindowButton()
|
||||
{
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
Click += WindowButton_Click;
|
||||
}
|
||||
|
||||
#endregion Creator
|
||||
|
||||
#region Events
|
||||
|
||||
private void WindowButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_window == null) { return; }
|
||||
_window.Activate();
|
||||
}
|
||||
|
||||
#endregion Events
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using VAR.DatabaseExplorer.UI;
|
||||
|
||||
namespace VAR.DatabaseExplorer
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
private static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FrmMain());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("DatabaseExplorer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("VAR")]
|
||||
[assembly: AssemblyProduct("DatabaseExplorer")]
|
||||
[assembly: AssemblyCopyright("Copyright © VAR 2012-2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("31f76805-336c-471c-8af2-a4c1364e97b9")]
|
||||
[assembly: AssemblyVersion("1.0.0.*")]
|
||||
84
VAR.DatabaseExplorer/UI/FrmData.Designer.cs
generated
84
VAR.DatabaseExplorer/UI/FrmData.Designer.cs
generated
@@ -1,84 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
partial class FrmData
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dgvDatos = new System.Windows.Forms.DataGridView();
|
||||
this.btnRefresh = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvDatos)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dgvDatos
|
||||
//
|
||||
this.dgvDatos.AllowUserToAddRows = false;
|
||||
this.dgvDatos.AllowUserToDeleteRows = false;
|
||||
this.dgvDatos.AllowUserToOrderColumns = true;
|
||||
this.dgvDatos.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dgvDatos.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvDatos.Location = new System.Drawing.Point(12, 18);
|
||||
this.dgvDatos.Name = "dgvDatos";
|
||||
this.dgvDatos.ReadOnly = true;
|
||||
this.dgvDatos.Size = new System.Drawing.Size(347, 273);
|
||||
this.dgvDatos.TabIndex = 0;
|
||||
this.dgvDatos.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDatos_CellDoubleClick);
|
||||
this.dgvDatos.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvDatos_CellFormatting);
|
||||
//
|
||||
// btnRefresh
|
||||
//
|
||||
this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnRefresh.Location = new System.Drawing.Point(12, 297);
|
||||
this.btnRefresh.Name = "btnRefresh";
|
||||
this.btnRefresh.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnRefresh.TabIndex = 1;
|
||||
this.btnRefresh.Text = "Refresh";
|
||||
this.btnRefresh.UseVisualStyleBackColor = true;
|
||||
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
|
||||
//
|
||||
// FrmDatos
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(371, 332);
|
||||
this.Controls.Add(this.btnRefresh);
|
||||
this.Controls.Add(this.dgvDatos);
|
||||
this.Name = "FrmDatos";
|
||||
this.Text = "frmDatos";
|
||||
this.Load += new System.EventHandler(this.frmDatos_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvDatos)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dgvDatos;
|
||||
private System.Windows.Forms.Button btnRefresh;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
public partial class FrmData : Form
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private readonly string _conexionString = string.Empty;
|
||||
private readonly string _tableSchema = string.Empty;
|
||||
private readonly string _tableName = string.Empty;
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Form life cycle
|
||||
|
||||
public FrmData(string conexionString, string tableSchema, string tableName)
|
||||
{
|
||||
InitializeComponent();
|
||||
_conexionString = conexionString;
|
||||
_tableSchema = tableSchema;
|
||||
_tableName = tableName;
|
||||
_conexionString = conexionString;
|
||||
LoadDataFromTable();
|
||||
}
|
||||
|
||||
private void frmDatos_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Form life cycle
|
||||
|
||||
#region Events
|
||||
|
||||
private void dgvDatos_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void dgvDatos_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
if (e.DesiredType == typeof(Image))
|
||||
{
|
||||
if (e.Value is DBNull || (e.Value is byte[] && ((byte[])e.Value).Length <= 0))
|
||||
{
|
||||
e.Value = new Bitmap(1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadDataFromTable();
|
||||
}
|
||||
|
||||
#endregion Events
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void LoadDataFromTable()
|
||||
{
|
||||
Text = _tableSchema + @"." + _tableName;
|
||||
string tableFullName = "[" + _tableSchema + "].[" + _tableName + "]";
|
||||
var dt = new DataTable();
|
||||
var cnx = new SqlConnection(_conexionString);
|
||||
var da = new SqlDataAdapter("select * from " + tableFullName, cnx);
|
||||
cnx.Open();
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
dgvDatos.DataSource = dt;
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
370
VAR.DatabaseExplorer/UI/FrmDatabase.Designer.cs
generated
370
VAR.DatabaseExplorer/UI/FrmDatabase.Designer.cs
generated
@@ -1,370 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
partial class FrmDatabase
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lblConString = new System.Windows.Forms.Label();
|
||||
this.btnCopiarConString = new System.Windows.Forms.Button();
|
||||
this.menuBaseDatos = new System.Windows.Forms.MenuStrip();
|
||||
this.btnVerDatos = new System.Windows.Forms.Button();
|
||||
this.lblTituloTabla = new System.Windows.Forms.Label();
|
||||
this.lblTituloDB = new System.Windows.Forms.Label();
|
||||
this.btnDocGen = new System.Windows.Forms.Button();
|
||||
this.btnProcs = new System.Windows.Forms.Button();
|
||||
this.btnExec = new System.Windows.Forms.Button();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.btnRefresh = new System.Windows.Forms.Button();
|
||||
this.lsvTablas = new VAR.DatabaseExplorer.Controls.CustomListView();
|
||||
this.colEsquema = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colNombreTabla = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colTipo = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.btnVerify = new System.Windows.Forms.Button();
|
||||
this.btnExportSchema = new System.Windows.Forms.Button();
|
||||
this.btnExportData = new System.Windows.Forms.Button();
|
||||
this.lsvColumnas = new VAR.DatabaseExplorer.Controls.CustomListView();
|
||||
this.colNombreColumna = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colTipoDatos = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colClave = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colNullable = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.txtConString = new VAR.DatabaseExplorer.Controls.CustomTextBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblConString
|
||||
//
|
||||
this.lblConString.AutoSize = true;
|
||||
this.lblConString.Location = new System.Drawing.Point(9, 9);
|
||||
this.lblConString.Name = "lblConString";
|
||||
this.lblConString.Size = new System.Drawing.Size(105, 13);
|
||||
this.lblConString.TabIndex = 1;
|
||||
this.lblConString.Text = "Cadena de conexion";
|
||||
//
|
||||
// btnCopiarConString
|
||||
//
|
||||
this.btnCopiarConString.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCopiarConString.Location = new System.Drawing.Point(742, 4);
|
||||
this.btnCopiarConString.Name = "btnCopiarConString";
|
||||
this.btnCopiarConString.Size = new System.Drawing.Size(52, 23);
|
||||
this.btnCopiarConString.TabIndex = 3;
|
||||
this.btnCopiarConString.Text = "Copiar";
|
||||
this.btnCopiarConString.UseVisualStyleBackColor = true;
|
||||
this.btnCopiarConString.Click += new System.EventHandler(this.btnCopiarConString_Click);
|
||||
//
|
||||
// menuBaseDatos
|
||||
//
|
||||
this.menuBaseDatos.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuBaseDatos.Name = "menuBaseDatos";
|
||||
this.menuBaseDatos.Size = new System.Drawing.Size(806, 24);
|
||||
this.menuBaseDatos.TabIndex = 18;
|
||||
//
|
||||
// btnVerDatos
|
||||
//
|
||||
this.btnVerDatos.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnVerDatos.Location = new System.Drawing.Point(392, 485);
|
||||
this.btnVerDatos.Name = "btnVerDatos";
|
||||
this.btnVerDatos.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnVerDatos.TabIndex = 11;
|
||||
this.btnVerDatos.Text = "Ver Datos";
|
||||
this.btnVerDatos.UseVisualStyleBackColor = true;
|
||||
this.btnVerDatos.Click += new System.EventHandler(this.btnVerDatos_Click);
|
||||
//
|
||||
// lblTituloTabla
|
||||
//
|
||||
this.lblTituloTabla.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTituloTabla.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.lblTituloTabla.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblTituloTabla.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lblTituloTabla.Location = new System.Drawing.Point(3, 0);
|
||||
this.lblTituloTabla.Name = "lblTituloTabla";
|
||||
this.lblTituloTabla.Size = new System.Drawing.Size(464, 37);
|
||||
this.lblTituloTabla.TabIndex = 12;
|
||||
this.lblTituloTabla.Text = "lblTituloTabla";
|
||||
this.lblTituloTabla.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblTituloDB
|
||||
//
|
||||
this.lblTituloDB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTituloDB.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.lblTituloDB.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblTituloDB.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.lblTituloDB.Location = new System.Drawing.Point(3, 0);
|
||||
this.lblTituloDB.Name = "lblTituloDB";
|
||||
this.lblTituloDB.Size = new System.Drawing.Size(326, 37);
|
||||
this.lblTituloDB.TabIndex = 13;
|
||||
this.lblTituloDB.Text = "lblTituloDB";
|
||||
this.lblTituloDB.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// btnDocGen
|
||||
//
|
||||
this.btnDocGen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnDocGen.Location = new System.Drawing.Point(181, 485);
|
||||
this.btnDocGen.Name = "btnDocGen";
|
||||
this.btnDocGen.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnDocGen.TabIndex = 14;
|
||||
this.btnDocGen.Text = "Doc";
|
||||
this.btnDocGen.UseVisualStyleBackColor = true;
|
||||
this.btnDocGen.Click += new System.EventHandler(this.btnDocGen_Click);
|
||||
//
|
||||
// btnProcs
|
||||
//
|
||||
this.btnProcs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnProcs.Location = new System.Drawing.Point(84, 485);
|
||||
this.btnProcs.Name = "btnProcs";
|
||||
this.btnProcs.Size = new System.Drawing.Size(87, 23);
|
||||
this.btnProcs.TabIndex = 15;
|
||||
this.btnProcs.Text = "Procedimientos";
|
||||
this.btnProcs.UseVisualStyleBackColor = true;
|
||||
this.btnProcs.Click += new System.EventHandler(this.btnProcs_Click);
|
||||
//
|
||||
// btnExec
|
||||
//
|
||||
this.btnExec.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnExec.Location = new System.Drawing.Point(177, 485);
|
||||
this.btnExec.Name = "btnExec";
|
||||
this.btnExec.Size = new System.Drawing.Size(45, 23);
|
||||
this.btnExec.TabIndex = 16;
|
||||
this.btnExec.Text = "Exec";
|
||||
this.btnExec.UseVisualStyleBackColor = true;
|
||||
this.btnExec.Click += new System.EventHandler(this.btnExec_Click);
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(1, 32);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnRefresh);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblTituloDB);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnExec);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lsvTablas);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnProcs);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnVerify);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnExportSchema);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnExportData);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lblTituloTabla);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnDocGen);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lsvColumnas);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnVerDatos);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(806, 511);
|
||||
this.splitContainer1.SplitterDistance = 332;
|
||||
this.splitContainer1.TabIndex = 17;
|
||||
//
|
||||
// btnRefresh
|
||||
//
|
||||
this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnRefresh.Location = new System.Drawing.Point(3, 485);
|
||||
this.btnRefresh.Name = "btnRefresh";
|
||||
this.btnRefresh.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnRefresh.TabIndex = 14;
|
||||
this.btnRefresh.Text = "Refresh";
|
||||
this.btnRefresh.UseVisualStyleBackColor = true;
|
||||
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
|
||||
//
|
||||
// lsvTablas
|
||||
//
|
||||
this.lsvTablas.AllowSorting = true;
|
||||
this.lsvTablas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvTablas.CheckBoxes = true;
|
||||
this.lsvTablas.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colEsquema,
|
||||
this.colNombreTabla,
|
||||
this.colTipo});
|
||||
this.lsvTablas.FullRowSelect = true;
|
||||
this.lsvTablas.HideSelection = false;
|
||||
this.lsvTablas.Location = new System.Drawing.Point(3, 40);
|
||||
this.lsvTablas.Name = "lsvTablas";
|
||||
this.lsvTablas.Size = new System.Drawing.Size(326, 439);
|
||||
this.lsvTablas.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.lsvTablas.TabIndex = 4;
|
||||
this.lsvTablas.UseCompatibleStateImageBehavior = false;
|
||||
this.lsvTablas.View = System.Windows.Forms.View.Details;
|
||||
this.lsvTablas.SelectedIndexChanged += new System.EventHandler(this.lsvTablas_SelectedIndexChanged);
|
||||
//
|
||||
// colEsquema
|
||||
//
|
||||
this.colEsquema.Text = "Esquema";
|
||||
//
|
||||
// colNombreTabla
|
||||
//
|
||||
this.colNombreTabla.Text = "Tabla";
|
||||
this.colNombreTabla.Width = 169;
|
||||
//
|
||||
// colTipo
|
||||
//
|
||||
this.colTipo.Text = "Tipo";
|
||||
this.colTipo.Width = 71;
|
||||
//
|
||||
// btnVerify
|
||||
//
|
||||
this.btnVerify.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnVerify.Location = new System.Drawing.Point(262, 485);
|
||||
this.btnVerify.Name = "btnVerify";
|
||||
this.btnVerify.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnVerify.TabIndex = 17;
|
||||
this.btnVerify.Text = "Verify";
|
||||
this.btnVerify.UseVisualStyleBackColor = true;
|
||||
this.btnVerify.Click += new System.EventHandler(this.btnVerify_Click);
|
||||
//
|
||||
// btnExportSchema
|
||||
//
|
||||
this.btnExportSchema.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnExportSchema.Location = new System.Drawing.Point(84, 485);
|
||||
this.btnExportSchema.Name = "btnExportSchema";
|
||||
this.btnExportSchema.Size = new System.Drawing.Size(91, 23);
|
||||
this.btnExportSchema.TabIndex = 16;
|
||||
this.btnExportSchema.Text = "ExportSchema";
|
||||
this.btnExportSchema.UseVisualStyleBackColor = true;
|
||||
this.btnExportSchema.Click += new System.EventHandler(this.BtnExportSchema_Click);
|
||||
//
|
||||
// btnExportData
|
||||
//
|
||||
this.btnExportData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnExportData.Location = new System.Drawing.Point(3, 485);
|
||||
this.btnExportData.Name = "btnExportData";
|
||||
this.btnExportData.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnExportData.TabIndex = 15;
|
||||
this.btnExportData.Text = "ExportData";
|
||||
this.btnExportData.UseVisualStyleBackColor = true;
|
||||
this.btnExportData.Click += new System.EventHandler(this.btnExportData_Click);
|
||||
//
|
||||
// lsvColumnas
|
||||
//
|
||||
this.lsvColumnas.AllowSorting = false;
|
||||
this.lsvColumnas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvColumnas.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colNombreColumna,
|
||||
this.colTipoDatos,
|
||||
this.colClave,
|
||||
this.colNullable});
|
||||
this.lsvColumnas.FullRowSelect = true;
|
||||
this.lsvColumnas.HideSelection = false;
|
||||
this.lsvColumnas.Location = new System.Drawing.Point(3, 40);
|
||||
this.lsvColumnas.Name = "lsvColumnas";
|
||||
this.lsvColumnas.Size = new System.Drawing.Size(464, 439);
|
||||
this.lsvColumnas.TabIndex = 6;
|
||||
this.lsvColumnas.UseCompatibleStateImageBehavior = false;
|
||||
this.lsvColumnas.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// colNombreColumna
|
||||
//
|
||||
this.colNombreColumna.Text = "Columna";
|
||||
this.colNombreColumna.Width = 122;
|
||||
//
|
||||
// colTipoDatos
|
||||
//
|
||||
this.colTipoDatos.Text = "Tipo de Datos";
|
||||
this.colTipoDatos.Width = 81;
|
||||
//
|
||||
// colClave
|
||||
//
|
||||
this.colClave.Text = "Clave";
|
||||
this.colClave.Width = 71;
|
||||
//
|
||||
// colNullable
|
||||
//
|
||||
this.colNullable.Text = "Nullable";
|
||||
//
|
||||
// txtConString
|
||||
//
|
||||
this.txtConString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtConString.Location = new System.Drawing.Point(120, 6);
|
||||
this.txtConString.Name = "txtConString";
|
||||
this.txtConString.ReadOnly = true;
|
||||
this.txtConString.Size = new System.Drawing.Size(616, 20);
|
||||
this.txtConString.TabIndex = 0;
|
||||
this.txtConString.TabWidth = 8;
|
||||
//
|
||||
// FrmDatabase
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(806, 543);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.btnCopiarConString);
|
||||
this.Controls.Add(this.lblConString);
|
||||
this.Controls.Add(this.txtConString);
|
||||
this.Controls.Add(this.menuBaseDatos);
|
||||
this.MainMenuStrip = this.menuBaseDatos;
|
||||
this.Name = "FrmDatabase";
|
||||
this.Text = "Base de Datos";
|
||||
this.Load += new System.EventHandler(this.frmBaseDatos_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private VAR.DatabaseExplorer.Controls.CustomTextBox txtConString;
|
||||
private System.Windows.Forms.Label lblConString;
|
||||
private System.Windows.Forms.Button btnCopiarConString;
|
||||
private VAR.DatabaseExplorer.Controls.CustomListView lsvTablas;
|
||||
private System.Windows.Forms.ColumnHeader colNombreTabla;
|
||||
private System.Windows.Forms.ColumnHeader colEsquema;
|
||||
private System.Windows.Forms.ColumnHeader colTipo;
|
||||
private VAR.DatabaseExplorer.Controls.CustomListView lsvColumnas;
|
||||
private System.Windows.Forms.ColumnHeader colNombreColumna;
|
||||
private System.Windows.Forms.ColumnHeader colTipoDatos;
|
||||
private System.Windows.Forms.MenuStrip menuBaseDatos;
|
||||
private System.Windows.Forms.ColumnHeader colClave;
|
||||
private System.Windows.Forms.Button btnVerDatos;
|
||||
private System.Windows.Forms.Label lblTituloTabla;
|
||||
private System.Windows.Forms.Label lblTituloDB;
|
||||
private System.Windows.Forms.Button btnDocGen;
|
||||
private System.Windows.Forms.Button btnProcs;
|
||||
private System.Windows.Forms.Button btnExec;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.ColumnHeader colNullable;
|
||||
private System.Windows.Forms.Button btnRefresh;
|
||||
private System.Windows.Forms.Button btnExportData;
|
||||
private System.Windows.Forms.Button btnExportSchema;
|
||||
private System.Windows.Forms.Button btnVerify;
|
||||
}
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using VAR.DatabaseExplorer.Code;
|
||||
using VAR.DatabaseExplorer.Code.BusinessLogic;
|
||||
using VAR.DatabaseExplorer.Code.DataAccess;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
public partial class FrmDatabase : Form
|
||||
{
|
||||
private string _connectionString;
|
||||
|
||||
private string _tableSchema;
|
||||
private string _tableName;
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
List<Table> tables = TableBL.Table_GetAll(_connectionString);
|
||||
lsvTablas.Items.Clear();
|
||||
foreach (Table table in tables)
|
||||
{
|
||||
ListViewItem item = lsvTablas.Items.Add(table.Schema);
|
||||
item.SubItems.Add(table.Name);
|
||||
item.SubItems.Add(table.Type);
|
||||
}
|
||||
|
||||
lsvColumnas.Items.Clear();
|
||||
}
|
||||
|
||||
public FrmDatabase(string connectionString)
|
||||
{
|
||||
InitializeComponent();
|
||||
_connectionString = connectionString;
|
||||
txtConString.Text = connectionString;
|
||||
}
|
||||
|
||||
private void frmBaseDatos_Load(object sender, EventArgs e)
|
||||
{
|
||||
Initialize();
|
||||
Database database = DatabaseBL.Database_Get(_connectionString);
|
||||
Text = database.Name;
|
||||
lblTituloDB.Text = database.Name;
|
||||
lblTituloTabla.Text = "";
|
||||
}
|
||||
|
||||
private void btnCopiarConString_Click(object sender, EventArgs e)
|
||||
{
|
||||
Clipboard.SetText(txtConString.Text);
|
||||
}
|
||||
|
||||
private void lsvTablas_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lsvTablas.SelectedItems.Count != 1) { return; }
|
||||
|
||||
ListViewItem item = lsvTablas.SelectedItems[0];
|
||||
_tableSchema = item.SubItems[0].Text;
|
||||
_tableName = item.SubItems[1].Text;
|
||||
|
||||
lblTituloTabla.Text = _tableSchema + @"." + _tableName;
|
||||
|
||||
List<Column> columns = ColumnDA.GetColumns(_connectionString, _tableSchema, _tableName);
|
||||
lsvColumnas.Items.Clear();
|
||||
foreach (Column col in columns)
|
||||
{
|
||||
ListViewItem subitem = lsvColumnas.Items.Add(col.Name);
|
||||
string type = string.Format("{0}{1}", col.Type, col.Size > 0 ? string.Format("({0})", col.Size) : string.Empty);
|
||||
subitem.SubItems.Add(type);
|
||||
subitem.SubItems.Add(col.PK ? "PK" : string.Empty);
|
||||
subitem.SubItems.Add(col.Nullable ? "Null" : "NotNull");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnVerDatos_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_tableSchema) || string.IsNullOrEmpty(_tableName)) { return; }
|
||||
|
||||
var form = new FrmData(_connectionString, _tableSchema, _tableName);
|
||||
FrmMain.AddForm(form);
|
||||
}
|
||||
|
||||
private void btnProcs_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new FrmRoutines(_connectionString);
|
||||
FrmMain.AddForm(form);
|
||||
}
|
||||
|
||||
private void btnExec_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new FrmExec(_connectionString);
|
||||
FrmMain.AddForm(form);
|
||||
}
|
||||
|
||||
private void btnDocGen_Click(object sender, EventArgs e)
|
||||
{
|
||||
Parent.Enabled = false;
|
||||
|
||||
Database database = DatabaseBL.Database_GetSchema(connectionString: _connectionString, fillTableDefinitions: true, fillProcDefinitions: true);
|
||||
|
||||
string fixedDatabaseName = database.Name.Replace(' ', '_');
|
||||
var streamWriter = new StreamWriter(fixedDatabaseName + ".documentation.html");
|
||||
DatabaseBL.Database_GenerateDocumentation(streamWriter, database);
|
||||
streamWriter.Close();
|
||||
|
||||
Parent.Enabled = true;
|
||||
}
|
||||
|
||||
private void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
private void btnExportData_Click(object sender, EventArgs e)
|
||||
{
|
||||
Parent.Enabled = false;
|
||||
|
||||
List<Table> tablesToExportData = new List<Table>();
|
||||
foreach (ListViewItem checkedItem in lsvTablas.CheckedItems)
|
||||
{
|
||||
Table tableToExportData = new Table()
|
||||
{
|
||||
Schema = checkedItem.SubItems[0].Text.ToString(), //Schema
|
||||
Name = checkedItem.SubItems[1].Text.ToString(), //Name
|
||||
Type = checkedItem.SubItems[2].Text.ToString(), //Type
|
||||
};
|
||||
tablesToExportData.Add(tableToExportData);
|
||||
}
|
||||
|
||||
Database database = DatabaseBL.Database_GetSchema(connectionString: _connectionString, fillTableDefinitions: true);
|
||||
string fixedDatabaseName = database.Name.Replace(' ', '_');
|
||||
var streamWriter = new SplittingStreamWriter("05." + fixedDatabaseName + ".{0:000}.Data.sql");
|
||||
DatabaseBL.Database_ExportData(streamWriter, _connectionString, database, tablesToExportData);
|
||||
streamWriter.Close();
|
||||
|
||||
Parent.Enabled = true;
|
||||
}
|
||||
|
||||
private void BtnExportSchema_Click(object sender, EventArgs e)
|
||||
{
|
||||
Parent.Enabled = false;
|
||||
|
||||
Database database = DatabaseBL.Database_GetSchema(connectionString: _connectionString, fillTableDefinitions: true, fillProcDefinitions: true, fillViewDefinitions: true);
|
||||
string fixedDatabaseName = database.Name.Replace(' ', '_');
|
||||
|
||||
// Schemas
|
||||
var streamWriterSchemas = new StreamWriter("01." + fixedDatabaseName + ".Schemas.sql");
|
||||
DatabaseBL.Database_ExportSchemas(streamWriterSchemas, _connectionString, database);
|
||||
streamWriterSchemas.Close();
|
||||
|
||||
// Tables
|
||||
var streamWriterTables = new StreamWriter("02." + fixedDatabaseName + ".Tables.sql");
|
||||
DatabaseBL.Database_ExportTables(streamWriterTables, _connectionString, database);
|
||||
streamWriterTables.Close();
|
||||
|
||||
// Routines
|
||||
var streamWriterRoutines = new StreamWriter("03." + fixedDatabaseName + ".Routines.sql");
|
||||
DatabaseBL.Database_ExportFunctions(streamWriterRoutines, database);
|
||||
streamWriterRoutines.Close();
|
||||
|
||||
// Views
|
||||
var streamWriterViews = new StreamWriter("04." + fixedDatabaseName + ".Views.sql");
|
||||
DatabaseBL.Database_ExportViews(streamWriterViews, database);
|
||||
streamWriterViews.Close();
|
||||
|
||||
Parent.Enabled = true;
|
||||
}
|
||||
|
||||
private void btnVerify_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<Procedure> invalidProcedures = ProcedureBL.Procedure_VerifyAndGetInvalidProcedures(connectionString: _connectionString);
|
||||
List<Table> invalidViews = TableBL.View_VerifyAndGetInvalidViews(connectionString: _connectionString);
|
||||
|
||||
if (invalidProcedures.Count != 0)
|
||||
{
|
||||
string message = string.Format("Delete {0} Procedures?", invalidProcedures.Count);
|
||||
if (MessageBox.Show(this, message, "Delete Procedures?", MessageBoxButtons.OKCancel) == DialogResult.OK)
|
||||
{
|
||||
ProcedureBL.Procedure_DeleteProcedures(_connectionString, invalidProcedures);
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidViews.Count != 0)
|
||||
{
|
||||
string message = string.Format("Delete {0} Views?", invalidViews.Count);
|
||||
if (MessageBox.Show(this, message, "Delete Views?", MessageBoxButtons.OKCancel) == DialogResult.OK)
|
||||
{
|
||||
TableBL.View_DeleteViews(_connectionString, invalidViews);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuBaseDatos.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>41</value>
|
||||
</metadata>
|
||||
</root>
|
||||
153
VAR.DatabaseExplorer/UI/FrmExec.Designer.cs
generated
153
VAR.DatabaseExplorer/UI/FrmExec.Designer.cs
generated
@@ -1,153 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
partial class FrmExec
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnExec = new System.Windows.Forms.Button();
|
||||
this.dgvDatos = new System.Windows.Forms.DataGridView();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.btnGenInserts = new System.Windows.Forms.Button();
|
||||
this.txtCommand = new VAR.DatabaseExplorer.Controls.CustomTextBox();
|
||||
this.txtDestTable = new System.Windows.Forms.TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvDatos)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnExec
|
||||
//
|
||||
this.btnExec.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnExec.Location = new System.Drawing.Point(532, 66);
|
||||
this.btnExec.Name = "btnExec";
|
||||
this.btnExec.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnExec.TabIndex = 0;
|
||||
this.btnExec.Text = "Exec";
|
||||
this.btnExec.UseVisualStyleBackColor = true;
|
||||
this.btnExec.Click += new System.EventHandler(this.btnExec_Click);
|
||||
//
|
||||
// dgvDatos
|
||||
//
|
||||
this.dgvDatos.AllowUserToAddRows = false;
|
||||
this.dgvDatos.AllowUserToDeleteRows = false;
|
||||
this.dgvDatos.AllowUserToOrderColumns = true;
|
||||
this.dgvDatos.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dgvDatos.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvDatos.Location = new System.Drawing.Point(3, 3);
|
||||
this.dgvDatos.Name = "dgvDatos";
|
||||
this.dgvDatos.ReadOnly = true;
|
||||
this.dgvDatos.Size = new System.Drawing.Size(604, 338);
|
||||
this.dgvDatos.TabIndex = 2;
|
||||
this.dgvDatos.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvDatos_CellFormatting);
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(12, 12);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.txtDestTable);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnGenInserts);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.txtCommand);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnExec);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.dgvDatos);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(610, 440);
|
||||
this.splitContainer1.SplitterDistance = 92;
|
||||
this.splitContainer1.TabIndex = 3;
|
||||
//
|
||||
// btnGenInserts
|
||||
//
|
||||
this.btnGenInserts.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnGenInserts.Location = new System.Drawing.Point(3, 66);
|
||||
this.btnGenInserts.Name = "btnGenInserts";
|
||||
this.btnGenInserts.Size = new System.Drawing.Size(102, 23);
|
||||
this.btnGenInserts.TabIndex = 2;
|
||||
this.btnGenInserts.Text = "Genera INSERTs";
|
||||
this.btnGenInserts.UseVisualStyleBackColor = true;
|
||||
this.btnGenInserts.Click += new System.EventHandler(this.btnGenInserts_Click);
|
||||
//
|
||||
// txtCommand
|
||||
//
|
||||
this.txtCommand.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtCommand.Font = new System.Drawing.Font("Lucida Console", 8.25F);
|
||||
this.txtCommand.Location = new System.Drawing.Point(3, 3);
|
||||
this.txtCommand.Multiline = true;
|
||||
this.txtCommand.Name = "txtCommand";
|
||||
this.txtCommand.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtCommand.Size = new System.Drawing.Size(604, 57);
|
||||
this.txtCommand.TabIndex = 1;
|
||||
this.txtCommand.TabWidth = 8;
|
||||
//
|
||||
// txtDestTable
|
||||
//
|
||||
this.txtDestTable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtDestTable.Location = new System.Drawing.Point(111, 68);
|
||||
this.txtDestTable.Name = "txtDestTable";
|
||||
this.txtDestTable.Size = new System.Drawing.Size(126, 20);
|
||||
this.txtDestTable.TabIndex = 3;
|
||||
//
|
||||
// FrmExec
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(634, 464);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "FrmExec";
|
||||
this.Text = "Exec";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvDatos)).EndInit();
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnExec;
|
||||
private VAR.DatabaseExplorer.Controls.CustomTextBox txtCommand;
|
||||
private System.Windows.Forms.DataGridView dgvDatos;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.Button btnGenInserts;
|
||||
private System.Windows.Forms.TextBox txtDestTable;
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using VAR.DatabaseExplorer.Code;
|
||||
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
public partial class FrmExec : Form
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private readonly string _cnxString;
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Form life cycle
|
||||
|
||||
public FrmExec(string cnxString)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_cnxString = cnxString;
|
||||
}
|
||||
|
||||
#endregion Form life cycle
|
||||
|
||||
#region Events
|
||||
|
||||
private void btnExec_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataTable dt = Exec();
|
||||
dgvDatos.DataSource = dt;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnGenInserts_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataTable dataTable = Exec();
|
||||
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
DataTableHelper.DataTable_GenerateInserts(stringWriter, dataTable, txtDestTable.Text);
|
||||
|
||||
// Preparar la datatable destino
|
||||
var destDataTable = new DataTable();
|
||||
destDataTable.Columns.Add("Cmd", typeof(String));
|
||||
foreach (string cmd in stringWriter.GetStringBuilder().ToString().Split('\n'))
|
||||
{
|
||||
destDataTable.Rows.Add(new object[] { cmd });
|
||||
}
|
||||
|
||||
dgvDatos.DataSource = destDataTable;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvDatos_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
if (e.DesiredType == typeof(Image))
|
||||
{
|
||||
if (e.Value is DBNull || (e.Value is byte[] && ((byte[])e.Value).Length <= 0))
|
||||
{
|
||||
e.Value = new Bitmap(1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Events
|
||||
|
||||
#region Private methods
|
||||
|
||||
private DataTable Exec()
|
||||
{
|
||||
// Establecer conexion
|
||||
var cnx = new SqlConnection(_cnxString);
|
||||
|
||||
// Obtener resultado en un datatable.
|
||||
var da = new SqlDataAdapter(txtCommand.Text, cnx);
|
||||
var dt = new DataTable();
|
||||
cnx.Open();
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
110
VAR.DatabaseExplorer/UI/FrmMain.Designer.cs
generated
110
VAR.DatabaseExplorer/UI/FrmMain.Designer.cs
generated
@@ -1,110 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
partial class FrmMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.menuPrincipal = new System.Windows.Forms.MenuStrip();
|
||||
this.menuServidor = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuSQLServerSearch = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.flowpnlWindows = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.menuConectionString = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuPrincipal.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuPrincipal
|
||||
//
|
||||
this.menuPrincipal.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuServidor});
|
||||
this.menuPrincipal.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuPrincipal.Name = "menuPrincipal";
|
||||
this.menuPrincipal.Size = new System.Drawing.Size(800, 24);
|
||||
this.menuPrincipal.TabIndex = 4;
|
||||
this.menuPrincipal.Text = "menuPrincipal";
|
||||
//
|
||||
// menuServidor
|
||||
//
|
||||
this.menuServidor.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuSQLServerSearch,
|
||||
this.menuConectionString});
|
||||
this.menuServidor.Name = "menuServidor";
|
||||
this.menuServidor.Size = new System.Drawing.Size(62, 20);
|
||||
this.menuServidor.Text = "Servidor";
|
||||
//
|
||||
// menuSQLServerSearch
|
||||
//
|
||||
this.menuSQLServerSearch.Name = "menuSQLServerSearch";
|
||||
this.menuSQLServerSearch.Size = new System.Drawing.Size(180, 22);
|
||||
this.menuSQLServerSearch.Text = "SQL Server Search";
|
||||
this.menuSQLServerSearch.Click += new System.EventHandler(this.menuSQLServerSearch_Click);
|
||||
//
|
||||
// flowpnlWindows
|
||||
//
|
||||
this.flowpnlWindows.AutoSize = true;
|
||||
this.flowpnlWindows.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flowpnlWindows.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.flowpnlWindows.Location = new System.Drawing.Point(0, 24);
|
||||
this.flowpnlWindows.Name = "flowpnlWindows";
|
||||
this.flowpnlWindows.Size = new System.Drawing.Size(800, 0);
|
||||
this.flowpnlWindows.TabIndex = 6;
|
||||
//
|
||||
// menuConectionString
|
||||
//
|
||||
this.menuConectionString.Name = "menuConectionString";
|
||||
this.menuConectionString.Size = new System.Drawing.Size(180, 22);
|
||||
this.menuConectionString.Text = "Conection String";
|
||||
this.menuConectionString.Click += new System.EventHandler(this.menuConectionString_Click);
|
||||
//
|
||||
// FrmMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 601);
|
||||
this.Controls.Add(this.flowpnlWindows);
|
||||
this.Controls.Add(this.menuPrincipal);
|
||||
this.IsMdiContainer = true;
|
||||
this.MainMenuStrip = this.menuPrincipal;
|
||||
this.Name = "FrmMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Explorador de Servidores";
|
||||
this.MdiChildActivate += new System.EventHandler(this.FrmPrincipal_MdiChildActivate);
|
||||
this.menuPrincipal.ResumeLayout(false);
|
||||
this.menuPrincipal.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.MenuStrip menuPrincipal;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuServidor;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuSQLServerSearch;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowpnlWindows;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuConectionString;
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using VAR.DatabaseExplorer.Controls;
|
||||
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
public partial class FrmMain : Form
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private static FrmMain _currentInstance;
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Creator
|
||||
|
||||
public FrmMain()
|
||||
{
|
||||
_currentInstance = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion Creator
|
||||
|
||||
#region WindowList
|
||||
|
||||
private List<Form> listChilds = new List<Form>();
|
||||
|
||||
public static void AddForm(Form frm)
|
||||
{
|
||||
frm.MdiParent = _currentInstance;
|
||||
frm.WindowState = FormWindowState.Maximized;
|
||||
frm.Show();
|
||||
_currentInstance.listChilds.Add(frm);
|
||||
frm.FormClosed += _currentInstance.FrmPrincipal_OnChildClose;
|
||||
_currentInstance.RefreshWindowButtons();
|
||||
}
|
||||
|
||||
protected void FrmPrincipal_OnChildClose(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
listChilds.Remove((Form)sender);
|
||||
RefreshWindowButtons();
|
||||
}
|
||||
|
||||
private void FrmPrincipal_MdiChildActivate(object sender, EventArgs e)
|
||||
{
|
||||
RefreshWindowButtons();
|
||||
}
|
||||
|
||||
private void RefreshWindowButtons()
|
||||
{
|
||||
int childCount = listChilds.Count;
|
||||
int delta = childCount - flowpnlWindows.Controls.Count;
|
||||
if (delta < 0)
|
||||
{
|
||||
int dest = flowpnlWindows.Controls.Count + delta;
|
||||
for (int i = flowpnlWindows.Controls.Count - 1; i >= dest; i--)
|
||||
{
|
||||
flowpnlWindows.Controls.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
else if (delta > 0)
|
||||
{
|
||||
for (int i = 0; i < delta; i++)
|
||||
{
|
||||
flowpnlWindows.Controls.Add(new WindowButton());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < childCount; i++)
|
||||
{
|
||||
WindowButton btn = (WindowButton)flowpnlWindows.Controls[i];
|
||||
Form frm = listChilds[i];
|
||||
btn.Text = frm.Text;
|
||||
btn.Window = frm;
|
||||
btn.Active = (frm == ActiveMdiChild);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion WindowList
|
||||
|
||||
#region Menus
|
||||
|
||||
private void menuSQLServerSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
var frm = new FrmSQLServerSearch();
|
||||
FrmMain.AddForm(frm);
|
||||
}
|
||||
|
||||
private void menuConectionString_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion Menus
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuPrincipal.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>14, 6</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>32</value>
|
||||
</metadata>
|
||||
</root>
|
||||
160
VAR.DatabaseExplorer/UI/FrmRoutines.Designer.cs
generated
160
VAR.DatabaseExplorer/UI/FrmRoutines.Designer.cs
generated
@@ -1,160 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
partial class FrmRoutines
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lsvProcs = new VAR.DatabaseExplorer.Controls.CustomListView();
|
||||
this.colNombre = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colSchema = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colFecha = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colTipo = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.txtProc = new VAR.DatabaseExplorer.Controls.CustomTextBox();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.btnRefresh = new System.Windows.Forms.Button();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lsvProcs
|
||||
//
|
||||
this.lsvProcs.Activation = System.Windows.Forms.ItemActivation.OneClick;
|
||||
this.lsvProcs.AllowSorting = true;
|
||||
this.lsvProcs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvProcs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colNombre,
|
||||
this.colSchema,
|
||||
this.colFecha,
|
||||
this.colTipo});
|
||||
this.lsvProcs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lsvProcs.FullRowSelect = true;
|
||||
this.lsvProcs.GridLines = true;
|
||||
this.lsvProcs.Location = new System.Drawing.Point(0, 0);
|
||||
this.lsvProcs.Name = "lsvProcs";
|
||||
this.lsvProcs.Size = new System.Drawing.Size(352, 449);
|
||||
this.lsvProcs.TabIndex = 0;
|
||||
this.lsvProcs.UseCompatibleStateImageBehavior = false;
|
||||
this.lsvProcs.View = System.Windows.Forms.View.Details;
|
||||
this.lsvProcs.SelectedIndexChanged += new System.EventHandler(this.lsvProcs_SelectedIndexChanged);
|
||||
//
|
||||
// colNombre
|
||||
//
|
||||
this.colNombre.Text = "Nombre";
|
||||
this.colNombre.Width = 120;
|
||||
//
|
||||
// colSchema
|
||||
//
|
||||
this.colSchema.Text = "Schema";
|
||||
//
|
||||
// colFecha
|
||||
//
|
||||
this.colFecha.Text = "Fecha";
|
||||
this.colFecha.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.colFecha.Width = 84;
|
||||
//
|
||||
// colTipo
|
||||
//
|
||||
this.colTipo.Text = "Tipo";
|
||||
//
|
||||
// txtProc
|
||||
//
|
||||
this.txtProc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtProc.Font = new System.Drawing.Font("Lucida Console", 8.25F);
|
||||
this.txtProc.Location = new System.Drawing.Point(3, 3);
|
||||
this.txtProc.Multiline = true;
|
||||
this.txtProc.Name = "txtProc";
|
||||
this.txtProc.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.txtProc.Size = new System.Drawing.Size(352, 475);
|
||||
this.txtProc.TabIndex = 1;
|
||||
this.txtProc.TabWidth = 4;
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(12, 12);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnRefresh);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lsvProcs);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.txtProc);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(717, 481);
|
||||
this.splitContainer1.SplitterDistance = 355;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
// btnRefresh
|
||||
//
|
||||
this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnRefresh.Location = new System.Drawing.Point(3, 455);
|
||||
this.btnRefresh.Name = "btnRefresh";
|
||||
this.btnRefresh.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnRefresh.TabIndex = 1;
|
||||
this.btnRefresh.Text = "Refresh";
|
||||
this.btnRefresh.UseVisualStyleBackColor = true;
|
||||
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
|
||||
//
|
||||
// FrmProcedimientos
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(741, 505);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "FrmProcedimientos";
|
||||
this.Text = "frmProcedimientos";
|
||||
this.Load += new System.EventHandler(this.frmProcedimientos_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.PerformLayout();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private VAR.DatabaseExplorer.Controls.CustomListView lsvProcs;
|
||||
private System.Windows.Forms.ColumnHeader colNombre;
|
||||
private System.Windows.Forms.ColumnHeader colFecha;
|
||||
private VAR.DatabaseExplorer.Controls.CustomTextBox txtProc;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.ColumnHeader colTipo;
|
||||
private System.Windows.Forms.ColumnHeader colSchema;
|
||||
private System.Windows.Forms.Button btnRefresh;
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Windows.Forms;
|
||||
using VAR.DatabaseExplorer.Code.DataAccess;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
public partial class FrmRoutines : Form
|
||||
{
|
||||
#region Declarations
|
||||
|
||||
private string _connectionString;
|
||||
|
||||
private readonly SqlConnection _cnx;
|
||||
|
||||
#endregion Declarations
|
||||
|
||||
#region Form life cycle
|
||||
|
||||
public FrmRoutines(string cnxString)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_connectionString = cnxString;
|
||||
_cnx = new SqlConnection(cnxString);
|
||||
}
|
||||
|
||||
private void frmProcedimientos_Load(object sender, EventArgs e)
|
||||
{
|
||||
lsvProcs_LoadData();
|
||||
}
|
||||
|
||||
#endregion Form life cycle
|
||||
|
||||
#region Events
|
||||
|
||||
private void lsvProcs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lsvProcs.SelectedItems.Count <= 0) { return; }
|
||||
|
||||
string name = lsvProcs.SelectedItems[0].SubItems[0].Text;
|
||||
string schema = lsvProcs.SelectedItems[0].SubItems[1].Text;
|
||||
|
||||
string procDefinition = ProcedureDA.GetProcedureDefinition(_connectionString, schema, name);
|
||||
txtProc.Text = procDefinition;
|
||||
}
|
||||
|
||||
private void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
lsvProcs_LoadData();
|
||||
}
|
||||
|
||||
#endregion Events
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void lsvProcs_LoadData()
|
||||
{
|
||||
List<Procedure> procs = ProcedureDA.GetAllProcedures(_connectionString);
|
||||
|
||||
lsvProcs.Items.Clear();
|
||||
foreach (Procedure proc in procs)
|
||||
{
|
||||
ListViewItem item = lsvProcs.Items.Add(proc.Name);
|
||||
item.SubItems.Add(proc.Schema);
|
||||
item.SubItems.Add(proc.CreateDate.ToShortDateString());
|
||||
item.SubItems.Add(proc.Type);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private methods
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
264
VAR.DatabaseExplorer/UI/FrmSQLServerSearch.Designer.cs
generated
264
VAR.DatabaseExplorer/UI/FrmSQLServerSearch.Designer.cs
generated
@@ -1,264 +0,0 @@
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
partial class FrmSQLServerSearch
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lsvServidores = new VAR.DatabaseExplorer.Controls.CustomListView();
|
||||
this.colNombreServidor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colInstancia = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colVersion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.btnListarServidores = new System.Windows.Forms.Button();
|
||||
this.lblServidor = new System.Windows.Forms.Label();
|
||||
this.txtServidor = new VAR.DatabaseExplorer.Controls.CustomTextBox();
|
||||
this.lblUsuario = new System.Windows.Forms.Label();
|
||||
this.lblContrasenha = new System.Windows.Forms.Label();
|
||||
this.txtUsuario = new VAR.DatabaseExplorer.Controls.CustomTextBox();
|
||||
this.TxtContrasenha = new VAR.DatabaseExplorer.Controls.CustomTextBox();
|
||||
this.btnListarBBDD = new System.Windows.Forms.Button();
|
||||
this.lsvBBDD = new VAR.DatabaseExplorer.Controls.CustomListView();
|
||||
this.colDBName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colFechaCreacion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lsvServidores
|
||||
//
|
||||
this.lsvServidores.AllowSorting = true;
|
||||
this.lsvServidores.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvServidores.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colNombreServidor,
|
||||
this.colInstancia,
|
||||
this.colVersion});
|
||||
this.lsvServidores.FullRowSelect = true;
|
||||
this.lsvServidores.HideSelection = false;
|
||||
this.lsvServidores.Location = new System.Drawing.Point(3, 32);
|
||||
this.lsvServidores.Name = "lsvServidores";
|
||||
this.lsvServidores.Size = new System.Drawing.Size(306, 386);
|
||||
this.lsvServidores.TabIndex = 1;
|
||||
this.lsvServidores.UseCompatibleStateImageBehavior = false;
|
||||
this.lsvServidores.View = System.Windows.Forms.View.Details;
|
||||
this.lsvServidores.SelectedIndexChanged += new System.EventHandler(this.lsvServidores_SelectedIndexChanged);
|
||||
//
|
||||
// colNombreServidor
|
||||
//
|
||||
this.colNombreServidor.Text = "Servidor";
|
||||
this.colNombreServidor.Width = 110;
|
||||
//
|
||||
// colInstancia
|
||||
//
|
||||
this.colInstancia.Text = "Instancia";
|
||||
this.colInstancia.Width = 94;
|
||||
//
|
||||
// colVersion
|
||||
//
|
||||
this.colVersion.Text = "Version";
|
||||
this.colVersion.Width = 73;
|
||||
//
|
||||
// btnListarServidores
|
||||
//
|
||||
this.btnListarServidores.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnListarServidores.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnListarServidores.Name = "btnListarServidores";
|
||||
this.btnListarServidores.Size = new System.Drawing.Size(306, 23);
|
||||
this.btnListarServidores.TabIndex = 2;
|
||||
this.btnListarServidores.Text = "Listar Servidores";
|
||||
this.btnListarServidores.UseVisualStyleBackColor = true;
|
||||
this.btnListarServidores.Click += new System.EventHandler(this.btnListarServidores_Click);
|
||||
//
|
||||
// lblServidor
|
||||
//
|
||||
this.lblServidor.AutoSize = true;
|
||||
this.lblServidor.Location = new System.Drawing.Point(3, 8);
|
||||
this.lblServidor.Name = "lblServidor";
|
||||
this.lblServidor.Size = new System.Drawing.Size(46, 13);
|
||||
this.lblServidor.TabIndex = 3;
|
||||
this.lblServidor.Text = "Servidor";
|
||||
//
|
||||
// txtServidor
|
||||
//
|
||||
this.txtServidor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtServidor.Location = new System.Drawing.Point(70, 6);
|
||||
this.txtServidor.Name = "txtServidor";
|
||||
this.txtServidor.Size = new System.Drawing.Size(218, 20);
|
||||
this.txtServidor.TabIndex = 4;
|
||||
this.txtServidor.TabWidth = 8;
|
||||
//
|
||||
// lblUsuario
|
||||
//
|
||||
this.lblUsuario.AutoSize = true;
|
||||
this.lblUsuario.Location = new System.Drawing.Point(3, 35);
|
||||
this.lblUsuario.Name = "lblUsuario";
|
||||
this.lblUsuario.Size = new System.Drawing.Size(43, 13);
|
||||
this.lblUsuario.TabIndex = 5;
|
||||
this.lblUsuario.Text = "Usuario";
|
||||
//
|
||||
// lblContrasenha
|
||||
//
|
||||
this.lblContrasenha.AutoSize = true;
|
||||
this.lblContrasenha.Location = new System.Drawing.Point(3, 61);
|
||||
this.lblContrasenha.Name = "lblContrasenha";
|
||||
this.lblContrasenha.Size = new System.Drawing.Size(61, 13);
|
||||
this.lblContrasenha.TabIndex = 6;
|
||||
this.lblContrasenha.Text = "Contraseña";
|
||||
//
|
||||
// txtUsuario
|
||||
//
|
||||
this.txtUsuario.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUsuario.Location = new System.Drawing.Point(70, 32);
|
||||
this.txtUsuario.Name = "txtUsuario";
|
||||
this.txtUsuario.Size = new System.Drawing.Size(218, 20);
|
||||
this.txtUsuario.TabIndex = 7;
|
||||
this.txtUsuario.TabWidth = 8;
|
||||
//
|
||||
// TxtContrasenha
|
||||
//
|
||||
this.TxtContrasenha.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TxtContrasenha.Location = new System.Drawing.Point(70, 58);
|
||||
this.TxtContrasenha.Name = "TxtContrasenha";
|
||||
this.TxtContrasenha.Size = new System.Drawing.Size(218, 20);
|
||||
this.TxtContrasenha.TabIndex = 8;
|
||||
this.TxtContrasenha.TabWidth = 8;
|
||||
this.TxtContrasenha.UseSystemPasswordChar = true;
|
||||
//
|
||||
// btnListarBBDD
|
||||
//
|
||||
this.btnListarBBDD.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnListarBBDD.Location = new System.Drawing.Point(6, 84);
|
||||
this.btnListarBBDD.Name = "btnListarBBDD";
|
||||
this.btnListarBBDD.Size = new System.Drawing.Size(282, 23);
|
||||
this.btnListarBBDD.TabIndex = 9;
|
||||
this.btnListarBBDD.Text = "Listar BBDD";
|
||||
this.btnListarBBDD.UseVisualStyleBackColor = true;
|
||||
this.btnListarBBDD.Click += new System.EventHandler(this.btnListarBBDD_Click);
|
||||
//
|
||||
// lsvBBDD
|
||||
//
|
||||
this.lsvBBDD.AllowSorting = true;
|
||||
this.lsvBBDD.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lsvBBDD.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colDBName,
|
||||
this.colFechaCreacion});
|
||||
this.lsvBBDD.FullRowSelect = true;
|
||||
this.lsvBBDD.HideSelection = false;
|
||||
this.lsvBBDD.Location = new System.Drawing.Point(6, 113);
|
||||
this.lsvBBDD.Name = "lsvBBDD";
|
||||
this.lsvBBDD.Size = new System.Drawing.Size(282, 305);
|
||||
this.lsvBBDD.TabIndex = 11;
|
||||
this.lsvBBDD.UseCompatibleStateImageBehavior = false;
|
||||
this.lsvBBDD.View = System.Windows.Forms.View.Details;
|
||||
this.lsvBBDD.DoubleClick += new System.EventHandler(this.lsvBBDD_DoubleClick);
|
||||
//
|
||||
// colDBName
|
||||
//
|
||||
this.colDBName.Text = "Base de Datos";
|
||||
this.colDBName.Width = 165;
|
||||
//
|
||||
// colFechaCreacion
|
||||
//
|
||||
this.colFechaCreacion.Text = "Fecha de Creacion";
|
||||
this.colFechaCreacion.Width = 107;
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.Location = new System.Drawing.Point(12, 12);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lsvServidores);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.btnListarServidores);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lblServidor);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lsvBBDD);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.txtServidor);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.btnListarBBDD);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lblUsuario);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lblContrasenha);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.TxtContrasenha);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.txtUsuario);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(607, 421);
|
||||
this.splitContainer1.SplitterDistance = 312;
|
||||
this.splitContainer1.TabIndex = 12;
|
||||
//
|
||||
// FrmSQLServerSearch
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(631, 445);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "FrmSQLServerSearch";
|
||||
this.Text = "SQL Server Search";
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private VAR.DatabaseExplorer.Controls.CustomListView lsvServidores;
|
||||
private System.Windows.Forms.Button btnListarServidores;
|
||||
private System.Windows.Forms.ColumnHeader colNombreServidor;
|
||||
private System.Windows.Forms.ColumnHeader colInstancia;
|
||||
private System.Windows.Forms.ColumnHeader colVersion;
|
||||
private System.Windows.Forms.Label lblServidor;
|
||||
private VAR.DatabaseExplorer.Controls.CustomTextBox txtServidor;
|
||||
private System.Windows.Forms.Label lblUsuario;
|
||||
private System.Windows.Forms.Label lblContrasenha;
|
||||
private VAR.DatabaseExplorer.Controls.CustomTextBox txtUsuario;
|
||||
private VAR.DatabaseExplorer.Controls.CustomTextBox TxtContrasenha;
|
||||
private System.Windows.Forms.Button btnListarBBDD;
|
||||
private VAR.DatabaseExplorer.Controls.CustomListView lsvBBDD;
|
||||
private System.Windows.Forms.ColumnHeader colDBName;
|
||||
private System.Windows.Forms.ColumnHeader colFechaCreacion;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Windows.Forms;
|
||||
using VAR.DatabaseExplorer.Code.DataAccess;
|
||||
using VAR.DatabaseExplorer.Code.DataTransfer;
|
||||
|
||||
namespace VAR.DatabaseExplorer.UI
|
||||
{
|
||||
public partial class FrmSQLServerSearch : Form
|
||||
{
|
||||
public FrmSQLServerSearch()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnListarServidores_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<Server> servers = ServerDA.GetAllServers();
|
||||
|
||||
lsvServidores.Items.Clear();
|
||||
lsvBBDD.Items.Clear();
|
||||
foreach (Server server in servers)
|
||||
{
|
||||
ListViewItem item = lsvServidores.Items.Add(server.Name);
|
||||
item.SubItems.Add(server.Instance);
|
||||
item.SubItems.Add(server.Version);
|
||||
}
|
||||
}
|
||||
|
||||
private void lsvServidores_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lsvServidores.SelectedItems.Count > 0)
|
||||
{
|
||||
ListViewItem item = lsvServidores.SelectedItems[0];
|
||||
txtServidor.Text = string.IsNullOrEmpty(item.SubItems[1].Text)
|
||||
? item.SubItems[0].Text
|
||||
: string.Format("{0}/{1}", item.SubItems[0].Text, item.SubItems[1].Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnListarBBDD_Click(object sender, EventArgs e)
|
||||
{
|
||||
string connectionString = BuildConnectionString(txtServidor.Text, null, txtUsuario.Text, TxtContrasenha.Text);
|
||||
List<Database> databases = DatabaseDA.GetAllDatabases(connectionString);
|
||||
|
||||
lsvBBDD.Items.Clear();
|
||||
foreach (Database database in databases)
|
||||
{
|
||||
ListViewItem item = lsvBBDD.Items.Add(database.Name);
|
||||
item.SubItems.Add(database.CreateDate.ToShortDateString());
|
||||
}
|
||||
}
|
||||
|
||||
private void lsvBBDD_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (lsvBBDD.SelectedItems.Count != 1) return;
|
||||
string databaseName = lsvBBDD.SelectedItems[0].SubItems[0].Text;
|
||||
// Llamar a la venta de la base de datos
|
||||
string connectionStirng = BuildConnectionString(txtServidor.Text, databaseName, txtUsuario.Text, TxtContrasenha.Text);
|
||||
var frm = new FrmDatabase(connectionStirng);
|
||||
FrmMain.AddForm(frm);
|
||||
}
|
||||
|
||||
private string BuildConnectionString(string server, string database, string user, string password)
|
||||
{
|
||||
var constructor = new SqlConnectionStringBuilder();
|
||||
constructor.DataSource = string.IsNullOrEmpty(server) ? "localhost" : server;
|
||||
if (string.IsNullOrEmpty(database) == false)
|
||||
{
|
||||
constructor.InitialCatalog = database;
|
||||
}
|
||||
if (string.IsNullOrEmpty(user))
|
||||
{
|
||||
constructor.IntegratedSecurity = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
constructor.UserID = user;
|
||||
constructor.Password = password;
|
||||
}
|
||||
return constructor.ConnectionString;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,201 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{79531B74-3062-4A71-9953-5702BEBDEC0E}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VAR.DatabaseExplorer</RootNamespace>
|
||||
<AssemblyName>VAR.DatabaseExplorer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>VAR.DatabaseExplorer.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Oracle.ManagedDataAccess.19.18.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Code\BusinessLogic\DatabaseBL.cs" />
|
||||
<Compile Include="Code\BusinessLogic\ProcedureBL.cs" />
|
||||
<Compile Include="Code\BusinessLogic\TableBL.cs" />
|
||||
<Compile Include="Code\DataAccess\ColumnDA.cs" />
|
||||
<Compile Include="Code\DataAccess\DatabaseDA.cs" />
|
||||
<Compile Include="Code\DataAccess\ProcedureDA.cs" />
|
||||
<Compile Include="Code\DataAccess\ServerDA.cs" />
|
||||
<Compile Include="Code\DataAccess\TableDA.cs" />
|
||||
<Compile Include="Code\DataTransfer\Column.cs" />
|
||||
<Compile Include="Code\DataTransfer\Database.cs" />
|
||||
<Compile Include="Code\DataTransfer\TableRow.cs" />
|
||||
<Compile Include="Code\DataTransfer\Procedure.cs" />
|
||||
<Compile Include="Code\DataTransfer\ProcedureDefinition.cs" />
|
||||
<Compile Include="Code\DataTransfer\Server.cs" />
|
||||
<Compile Include="Code\DataTransfer\Table.cs" />
|
||||
<Compile Include="Code\DataTransfer\User.cs" />
|
||||
<Compile Include="Code\DataTransfer\ViewDefinition.cs" />
|
||||
<Compile Include="Code\SplittingStreamWriter.cs" />
|
||||
<Compile Include="Code\TableRowHelper.cs" />
|
||||
<Compile Include="Controls\CustomListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\CustomTextBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\WindowButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmDatabase.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmDatabase.Designer.cs">
|
||||
<DependentUpon>FrmDatabase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmData.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmData.Designer.cs">
|
||||
<DependentUpon>FrmData.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmExec.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmExec.Designer.cs">
|
||||
<DependentUpon>FrmExec.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmMain.Designer.cs">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmRoutines.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmRoutines.Designer.cs">
|
||||
<DependentUpon>FrmRoutines.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmSQLServerSearch.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmSQLServerSearch.Designer.cs">
|
||||
<DependentUpon>FrmSQLServerSearch.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Code\DataTableHelper.cs" />
|
||||
<EmbeddedResource Include="UI\FrmDatabase.resx">
|
||||
<DependentUpon>FrmDatabase.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\FrmData.resx">
|
||||
<DependentUpon>FrmData.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\FrmExec.resx">
|
||||
<DependentUpon>FrmExec.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\FrmMain.resx">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\FrmRoutines.resx">
|
||||
<DependentUpon>FrmRoutines.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\FrmSQLServerSearch.resx">
|
||||
<DependentUpon>FrmSQLServerSearch.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="app.manifest" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,76 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on and is
|
||||
is designed to work with. Uncomment the appropriate elements and Windows will
|
||||
automatically selected the most compatible environment. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
</assembly>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Oracle.ManagedDataAccess" version="19.18.0" targetFramework="net48" />
|
||||
</packages>
|
||||
0
issues/.keep
Normal file
0
issues/.keep
Normal file
13
issues/1.yaml
Normal file
13
issues/1.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
id: 1
|
||||
title: Exporting schema, exports internal views on AzureSQL
|
||||
state: open
|
||||
tags: bug
|
||||
|
||||
While connected to a AzureSQL database, exporting schema exports some internal views only useful in AzureSQL database types.
|
||||
|
||||
Identify these internal views and avoid exporting them.
|
||||
|
||||
----
|
||||
|
||||
|
||||
Additionally some schemas on premise are not exported.
|
||||
6
issues/2.yaml
Normal file
6
issues/2.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
id: 2
|
||||
title: It does not export sizes of decimal columns.
|
||||
state: open
|
||||
tags: bug
|
||||
|
||||
|
||||
75
issues/3.yaml
Normal file
75
issues/3.yaml
Normal file
@@ -0,0 +1,75 @@
|
||||
id: 3
|
||||
title: Add support for Indexes exportation
|
||||
state: open
|
||||
tags: enhancement
|
||||
|
||||
```sql
|
||||
DECLARE cIX CURSOR FOR
|
||||
SELECT OBJECT_NAME(SI.Object_ID), SI.Object_ID, OBJECT_SCHEMA_NAME(SI.Object_ID) ,SI.Name, SI.Index_ID
|
||||
FROM Sys.Indexes SI
|
||||
LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC ON SI.Name = TC.CONSTRAINT_NAME AND OBJECT_NAME(SI.Object_ID) = TC.TABLE_NAME
|
||||
WHERE TC.CONSTRAINT_NAME IS NULL
|
||||
AND OBJECTPROPERTY(SI.Object_ID, 'IsUserTable') = 1
|
||||
ORDER BY OBJECT_NAME(SI.Object_ID), SI.Index_ID
|
||||
|
||||
DECLARE @IxSchema SYSNAME
|
||||
DECLARE @IxTable SYSNAME
|
||||
DECLARE @IxTableID INT
|
||||
DECLARE @IxName SYSNAME
|
||||
DECLARE @IxID INT
|
||||
|
||||
-- Loop through all indexes
|
||||
OPEN cIX
|
||||
FETCH NEXT FROM cIX INTO @IxTable, @IxTableID, @IxSchema, @IxName, @IxID
|
||||
WHILE (@@FETCH_STATUS = 0)
|
||||
BEGIN
|
||||
DECLARE @IXSQL NVARCHAR(4000) SET @IXSQL = ''
|
||||
SET @IXSQL = 'CREATE '
|
||||
|
||||
-- Check if the index is unique
|
||||
IF (INDEXPROPERTY(@IxTableID, @IxName, 'IsUnique') = 1)
|
||||
SET @IXSQL = @IXSQL + 'UNIQUE '
|
||||
-- Check if the index is clustered
|
||||
IF (INDEXPROPERTY(@IxTableID, @IxName, 'IsClustered') = 1)
|
||||
SET @IXSQL = @IXSQL + 'CLUSTERED '
|
||||
|
||||
SET @IXSQL = @IXSQL + 'INDEX ' + @IxName + ' ON ' + @IxSchema+'.'+@IxTable + '('
|
||||
|
||||
-- Get all columns of the index
|
||||
DECLARE cIxColumn CURSOR FOR
|
||||
SELECT SC.Name
|
||||
FROM Sys.Index_Columns IC
|
||||
JOIN Sys.Columns SC ON IC.Object_ID = SC.Object_ID AND IC.Column_ID = SC.Column_ID
|
||||
WHERE IC.Object_ID = @IxTableID AND Index_ID = @IxID
|
||||
ORDER BY IC.Index_Column_ID
|
||||
|
||||
DECLARE @IxColumn SYSNAME
|
||||
DECLARE @IxFirstColumn BIT SET @IxFirstColumn = 1
|
||||
|
||||
-- Loop throug all columns of the index and append them to the CREATE statement
|
||||
OPEN cIxColumn
|
||||
FETCH NEXT FROM cIxColumn INTO @IxColumn
|
||||
WHILE (@@FETCH_STATUS = 0)
|
||||
BEGIN
|
||||
IF (@IxFirstColumn = 1)
|
||||
SET @IxFirstColumn = 0
|
||||
ELSE
|
||||
SET @IXSQL = @IXSQL + ', '
|
||||
|
||||
SET @IXSQL = @IXSQL + @IxColumn
|
||||
|
||||
FETCH NEXT FROM cIxColumn INTO @IxColumn
|
||||
END
|
||||
CLOSE cIxColumn
|
||||
DEALLOCATE cIxColumn
|
||||
|
||||
SET @IXSQL = @IXSQL + ')'
|
||||
-- Print out the CREATE statement for the index
|
||||
IF @IXSQL != '' BEGIN PRINT @IXSQL END
|
||||
|
||||
FETCH NEXT FROM cIX INTO @IxTable, @IxTableID, @IxSchema, @IxName, @IxID
|
||||
END
|
||||
|
||||
CLOSE cIX
|
||||
DEALLOCATE cIX
|
||||
```
|
||||
6
issues/4.yaml
Normal file
6
issues/4.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
id: 4
|
||||
title: Portar a dotnet y GtkSharp
|
||||
state: open
|
||||
tags: enhancement
|
||||
|
||||
|
||||
Reference in New Issue
Block a user