コード例 #1
0
ファイル: CommandExecutor.cs プロジェクト: DFineNormal/tSQLt
 private static String CreateConnectionStringToContextDatabase()
 {
     TestDatabaseFacade facade = new TestDatabaseFacade();
     String server = facade.ServerName;
     String database = facade.DatabaseName;
     System.Data.SqlClient.SqlConnectionStringBuilder builder =
       new System.Data.SqlClient.SqlConnectionStringBuilder();
     builder["Data Source"] = server;
     builder["Integrated Security"] = true;
     builder["Initial Catalog"] = database;
     String connectionString = builder.ConnectionString;
     return connectionString;
 }
コード例 #2
0
ファイル: CommandExecutor.cs プロジェクト: tSQLt/tmp
        private static String CreateConnectionStringToContextDatabase()
        {
            TestDatabaseFacade facade   = new TestDatabaseFacade();
            String             server   = facade.ServerName;
            String             database = facade.DatabaseName;

            System.Data.SqlClient.SqlConnectionStringBuilder builder =
                new System.Data.SqlClient.SqlConnectionStringBuilder();
            builder["Data Source"]         = server;
            builder["Integrated Security"] = true;
            builder["Initial Catalog"]     = database;
            String connectionString = builder.ConnectionString;

            return(connectionString);
        }
コード例 #3
0
ファイル: ResultSetFilter.cs プロジェクト: DFineNormal/tSQLt
 public ResultSetFilter(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }
コード例 #4
0
ファイル: TableFiller.cs プロジェクト: Donald-Frederick/tSQLt
 public TableFiller(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }
コード例 #5
0
ファイル: OutputCaptor.cs プロジェクト: tSQLt/tmp
 public OutputCaptor(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }
コード例 #6
0
 public ResultSetFilter(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }
コード例 #7
0
ファイル: tSQLtPrivate.cs プロジェクト: tSQLt/tmp
        public static SqlChars TableToString(SqlString TableName, SqlString OrderOption, SqlString ColumnList)
        {
            if (TableName.IsNull) {
                throw new Exception("Object name cannot be NULL");
            }

            if (OrderOption.IsNull)
            {
                OrderOption = "";
            }

            if (ColumnList.IsNull)
            {
                ColumnList = "";
            }

            TestDatabaseFacade testDbFacade = new TestDatabaseFacade();
            String selectStmt = getSqlStatement(ref TableName, ref OrderOption);
            SqlDataReader reader = testDbFacade.executeCommand(selectStmt);
            List<String[]> results = getTableStringArray(reader, ColumnList);

            int numRows = 0;
            int[] ColumnLength = new int[results[0].Length];
            foreach (String[] rowData in results) {
                for (int i = 0; i < rowData.Length; i++) {
                    ColumnLength[i] = Math.Max(ColumnLength[i], rowData[i].Length);
                }
                numRows++;
            }

            for (int i = 0; i < ColumnLength.Length; i++) {
                ColumnLength[i] = Math.Min(ColumnLength[i], MAX_COLUMN_WIDTH);
            }

            int size = 0;
            foreach (int i in ColumnLength) {
                size += 1 + i;
            }
            size++;
            size *= (numRows + 1);

            bool isHeader = true;
            StringBuilder output = new StringBuilder(size);
            foreach (String[] rowData in results) {
                if (!isHeader) {
                    output.AppendLine();
                }
                for (int i = 0; i < rowData.Length; i++) {
                    output.Append("|").Append(PadColumn(TrimToMaxLength(rowData[i]), ColumnLength[i]));
                }
                output.Append("|");

                if (isHeader) {
                    isHeader = false;
                    output.AppendLine();
                    for (int i = 0; i < rowData.Length; i++) {
                        output.Append("+");
                        output.Insert(output.Length, "-", ColumnLength[i]);
                    }
                    output.Append("+");
                }
            }

            return new SqlChars(output.ToString());
        }
コード例 #8
0
 public OutputCaptor(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }
コード例 #9
0
        public static SqlChars TableToString(SqlString TableName, SqlString OrderOption, SqlString ColumnList)
        {
            if (TableName.IsNull)
            {
                throw new Exception("Object name cannot be NULL");
            }

            if (OrderOption.IsNull)
            {
                OrderOption = "";
            }

            if (ColumnList.IsNull)
            {
                ColumnList = "";
            }

            TestDatabaseFacade testDbFacade = new TestDatabaseFacade();
            String             selectStmt   = getSqlStatement(ref TableName, ref OrderOption);
            SqlDataReader      reader       = testDbFacade.executeCommand(selectStmt);
            List <String[]>    results      = getTableStringArray(reader, ColumnList);

            int numRows = 0;

            int[] ColumnLength = new int[results[0].Length];
            foreach (String[] rowData in results)
            {
                for (int i = 0; i < rowData.Length; i++)
                {
                    ColumnLength[i] = Math.Max(ColumnLength[i], rowData[i].Length);
                }
                numRows++;
            }

            for (int i = 0; i < ColumnLength.Length; i++)
            {
                ColumnLength[i] = Math.Min(ColumnLength[i], MAX_COLUMN_WIDTH);
            }

            int size = 0;

            foreach (int i in ColumnLength)
            {
                size += 1 + i;
            }
            size++;
            size *= (numRows + 1);

            bool          isHeader = true;
            StringBuilder output   = new StringBuilder(size);

            foreach (String[] rowData in results)
            {
                if (!isHeader)
                {
                    output.AppendLine();
                }
                for (int i = 0; i < rowData.Length; i++)
                {
                    output.Append("|").Append(PadColumn(TrimToMaxLength(rowData[i]), ColumnLength[i]));
                }
                output.Append("|");

                if (isHeader)
                {
                    isHeader = false;
                    output.AppendLine();
                    for (int i = 0; i < rowData.Length; i++)
                    {
                        output.Append("+");
                        output.Insert(output.Length, "-", ColumnLength[i]);
                    }
                    output.Append("+");
                }
            }

            return(new SqlChars(output.ToString()));
        }
コード例 #10
0
 public MetaDataEqualityAsserter(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }
コード例 #11
0
 public ResultSetToTable(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }
コード例 #12
0
 public MetaDataEqualityAsserter(TestDatabaseFacade testDatabaseFacade)
 {
     this.testDatabaseFacade = testDatabaseFacade;
 }