MCPcopy Create free account
hub / github.com/apecloud/myduckserver / Run

Method Run

compatibility/pg/csharp/PGTest.cs:100–152  ·  view source on GitHub ↗
(NpgsqlCommand cmd)

Source from the content-addressed store, hash-verified

98 }
99
100 public bool Run(NpgsqlCommand cmd)
101 {
102 try
103 {
104 Console.WriteLine("Running test: " + query);
105 cmd.CommandText = query;
106 using (var reader = cmd.ExecuteReader())
107 {
108 if (!reader.HasRows)
109 {
110 if (expectedResults.Length != 0)
111 {
112 Console.Error.WriteLine($"Expected {expectedResults.Length} rows, got 0");
113 return false;
114 }
115 Console.WriteLine("Returns 0 rows");
116 return true;
117 }
118 if (reader.FieldCount != expectedResults[0].Length)
119 {
120 Console.Error.WriteLine($"Expected {expectedResults[0].Length} columns, got {reader.FieldCount}");
121 return false;
122 }
123 int rows = 0;
124 while (reader.Read())
125 {
126 for (int col = 0; col < expectedResults[rows].Length; col++)
127 {
128 string result = reader.GetValue(col).ToString().Trim();
129 if (expectedResults[rows][col] != result)
130 {
131 Console.Error.WriteLine($"Expected:\n'{expectedResults[rows][col]}'");
132 Console.Error.WriteLine($"Result:\n'{result}'");
133 return false;
134 }
135 }
136 rows++;
137 }
138 Console.WriteLine("Returns " + rows + " rows");
139 if (rows != expectedResults.Length)
140 {
141 Console.Error.WriteLine($"Expected {expectedResults.Length} rows");
142 return false;
143 }
144 return true;
145 }
146 }
147 catch (NpgsqlException e)
148 {
149 Console.Error.WriteLine(e.Message);
150 return false;
151 }
152 }
153 }
154 }
155

Callers 15

TestQueriesFunction · 0.45
TestQueryPlanTODOsFunction · 0.45
TestQueryPlansFunction · 0.45
TestSingleQueryPlanFunction · 0.45
TestImdbQueryPlansFunction · 0.45
TestTpccQueryPlansFunction · 0.45
TestTpchQueryPlansFunction · 0.45
TestTpcdsQueryPlansFunction · 0.45
TestIndexQueryPlansFunction · 0.45
RunCreateTableTestFunction · 0.45
RunAddColumnTestFunction · 0.45

Calls 1

GetValueMethod · 0.80

Tested by

no test coverage detected