Пример #1
0
  def testDisplayQueryResults(self):
    metadata = self.msgs.ResultSetMetadata(rowType=self.msgs.StructType(
        fields=[
            self.msgs.Field(name='colA'),
            self.msgs.Field(name='colB'),
            self.msgs.Field(name=None)
        ]))
    result_rows = [
        self.msgs.ResultSet.RowsValueListEntry(entry=[
            extra_types.JsonValue(string_value='A1'),
            extra_types.JsonValue(string_value='B1'),
            extra_types.JsonValue(string_value='C1')
        ]),
        self.msgs.ResultSet.RowsValueListEntry(entry=[
            extra_types.JsonValue(string_value='A2'),
            extra_types.JsonValue(string_value='B2'),
            extra_types.JsonValue(string_value='C2')
        ])
    ]
    results = self.msgs.ResultSet(metadata=metadata, rows=result_rows)
    DisplayQueryResults(results, self.out)

    self.AssertOutputEquals('colA  colB  (Unspecified)\n'
                            'A1    B1    C1\n'
                            'A2    B2    C2\n')
Пример #2
0
 def testDisplayQueryResultsPartitionedDmlMultipleResults(self):
   stats = self.msgs.ResultSetStats(rowCountLowerBound=3)
   results = self._SetupDmlResultSet(stats)
   DisplayQueryResults(results, self.out)
   self.AssertOutputEquals('Statement modified a lower bound of 3 rows\n')
Пример #3
0
 def testDisplayQueryResultsPartitionedDmlNoResults(self):
   stats = self.msgs.ResultSetStats(rowCountLowerBound=None)
   results = self._SetupDmlResultSet(stats)
   DisplayQueryResults(results, self.out)
   self.AssertOutputEquals('')
Пример #4
0
 def testDisplayQueryResultsDmlNoResults(self):
   stats = self.msgs.ResultSetStats(rowCountExact=None)
   results = self._SetupDmlResultSet(stats)
   DisplayQueryResults(results, self.out)
   self.AssertOutputEquals('')
Пример #5
0
 def testDisplayQueryResultsDmlMultipleResults(self):
   stats = self.msgs.ResultSetStats(rowCountExact=3)
   results = self._SetupDmlResultSet(stats)
   DisplayQueryResults(results, self.out)
   self.AssertOutputEquals('Statement modified 3 rows\n')