TableBL and ProcedureBL: Fix escaping of names.
This commit is contained in:
@@ -91,7 +91,7 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic
|
||||
|
||||
public static void Procedure_GenerateCreate(Procedure routine, StreamWriter txtWriter)
|
||||
{
|
||||
string routineName = string.Format("{0}.{1}", routine.Schema, routine.Name);
|
||||
string routineName = string.Format("[{0}].[{1}]", routine.Schema, routine.Name);
|
||||
if (routine.Type.ToUpper() == "PROCEDURE")
|
||||
{
|
||||
txtWriter.WriteLine(string.Format("PRINT '*** Creating procedure {0}....';", routineName));
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic
|
||||
{
|
||||
if (t.Type != "BASE TABLE") { return; }
|
||||
|
||||
string tableName = string.Format("{0}.{1}", t.Schema, t.Name);
|
||||
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))
|
||||
@@ -89,7 +89,7 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic
|
||||
{
|
||||
if (table.Type != "BASE TABLE") { return; }
|
||||
|
||||
string tableName = string.Format("{0}.{1}", table.Schema, table.Name);
|
||||
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");
|
||||
@@ -169,7 +169,7 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic
|
||||
{
|
||||
if (table.Type != "VIEW") { return; }
|
||||
|
||||
string viewName = string.Format("{0}.{1}", table.Schema, table.Name);
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user