sub.py 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
###################################################################
 #           Copyright (c) 2020 by TAOS Technologies, Inc.
 #                     All rights reserved.
 #
 #  This file is proprietary and confidential to TAOS Technologies.
 #  No part of this file may be reproduced, stored, transmitted, 
 #  disclosed or used in any form or by any means other than as 
 #  expressly provided by the written permission from Jianhui Tao
 #
###################################################################

# -*- coding: utf-8 -*-  

import sys
import os
import time
import datetime
from util.log import *

class TDSub:
	def __init__(self):
		self.consumedRows = 0
		self.consumedCols = 0

	def init(self, sub):
		self.sub = sub

	def close(self, keepProgress):
		self.sub.close(keepProgress)	

	def consume(self):
32 33 34 35
		self.result = self.sub.consume()
		self.result.fetch_all()
		self.consumedRows = self.result.row_count
		self.consumedCols = self.result.field_count
36 37 38 39 40 41 42 43 44
		return self.consumedRows

	def checkRows(self, expectRows):
		if self.consumedRows != expectRows:
			tdLog.exit("consumed rows:%d != expect:%d" % (self.consumedRows, expectRows))
		tdLog.info("consumed rows:%d == expect:%d" % (self.consumedRows, expectRows))
	

tdSub = TDSub()