This commit is contained in:
Miroslav Stampar 2019-12-06 16:02:25 +01:00
parent 82e6bc64c2
commit 292bdf4479

View File

@ -70,13 +70,12 @@ class Dump(object):
self._lock = threading.Lock() self._lock = threading.Lock()
def _write(self, data, newline=True, console=True, content_type=None): def _write(self, data, newline=True, console=True, content_type=None):
if conf.api:
dataToStdout(data, content_type=content_type, status=CONTENT_STATUS.COMPLETE)
return
text = "%s%s" % (data, "\n" if newline else " ") text = "%s%s" % (data, "\n" if newline else " ")
if console: if conf.api:
dataToStdout(data, content_type=content_type, status=CONTENT_STATUS.COMPLETE)
elif console:
dataToStdout(text) dataToStdout(text)
multiThreadMode = isMultiThreadMode() multiThreadMode = isMultiThreadMode()
@ -118,7 +117,6 @@ class Dump(object):
def string(self, header, data, content_type=None, sort=True): def string(self, header, data, content_type=None, sort=True):
if conf.api: if conf.api:
self._write(data, content_type=content_type) self._write(data, content_type=content_type)
return
if isListLike(data): if isListLike(data):
self.lister(header, data, content_type, sort) self.lister(header, data, content_type, sort)
@ -150,7 +148,6 @@ class Dump(object):
if conf.api: if conf.api:
self._write(elements, content_type=content_type) self._write(elements, content_type=content_type)
return
if elements: if elements:
self._write("%s [%d]:" % (header, len(elements))) self._write("%s [%d]:" % (header, len(elements)))
@ -202,7 +199,6 @@ class Dump(object):
if conf.api: if conf.api:
self._write(userSettings, content_type=content_type) self._write(userSettings, content_type=content_type)
return
if userSettings: if userSettings:
self._write("%s:" % header) self._write("%s:" % header)
@ -236,7 +232,6 @@ class Dump(object):
if isinstance(dbTables, dict) and len(dbTables) > 0: if isinstance(dbTables, dict) and len(dbTables) > 0:
if conf.api: if conf.api:
self._write(dbTables, content_type=CONTENT_TYPE.TABLES) self._write(dbTables, content_type=CONTENT_TYPE.TABLES)
return
maxlength = 0 maxlength = 0
@ -279,7 +274,6 @@ class Dump(object):
if isinstance(tableColumns, dict) and len(tableColumns) > 0: if isinstance(tableColumns, dict) and len(tableColumns) > 0:
if conf.api: if conf.api:
self._write(tableColumns, content_type=content_type) self._write(tableColumns, content_type=content_type)
return
for db, tables in tableColumns.items(): for db, tables in tableColumns.items():
if not db: if not db:
@ -353,7 +347,6 @@ class Dump(object):
if isinstance(dbTables, dict) and len(dbTables) > 0: if isinstance(dbTables, dict) and len(dbTables) > 0:
if conf.api: if conf.api:
self._write(dbTables, content_type=CONTENT_TYPE.COUNT) self._write(dbTables, content_type=CONTENT_TYPE.COUNT)
return
maxlength1 = len("Table") maxlength1 = len("Table")
maxlength2 = len("Entries") maxlength2 = len("Entries")
@ -412,7 +405,6 @@ class Dump(object):
if conf.api: if conf.api:
self._write(tableValues, content_type=CONTENT_TYPE.DUMP_TABLE) self._write(tableValues, content_type=CONTENT_TYPE.DUMP_TABLE)
return
dumpDbPath = os.path.join(conf.dumpPath, unsafeSQLIdentificatorNaming(db)) dumpDbPath = os.path.join(conf.dumpPath, unsafeSQLIdentificatorNaming(db))
@ -668,7 +660,6 @@ class Dump(object):
def dbColumns(self, dbColumnsDict, colConsider, dbs): def dbColumns(self, dbColumnsDict, colConsider, dbs):
if conf.api: if conf.api:
self._write(dbColumnsDict, content_type=CONTENT_TYPE.COLUMNS) self._write(dbColumnsDict, content_type=CONTENT_TYPE.COLUMNS)
return
for column in dbColumnsDict.keys(): for column in dbColumnsDict.keys():
if colConsider == "1": if colConsider == "1":