From 7253362114bb88f2790681eaf9bfdc5bb87b114a Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Fri, 11 Feb 2011 23:35:45 +0000 Subject: [PATCH] Minor bug fix so that --file-write on MySQL via UNION query now works again --- lib/core/agent.py | 9 ++------- plugins/dbms/mysql/filesystem.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index 65dc33a79..774e3cf3d 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -434,13 +434,8 @@ class Agent: @rtype: C{str} """ - if unpack: - concatenatedQuery = "" - query = query.replace(", ", ",") - - fieldsSelectFrom, fieldsSelect, fieldsNoSelect, fieldsSelectTop, fieldsSelectCase, _, fieldsToCastStr, fieldsExists = self.getFields(query) - castedFields = self.nullCastConcatFields(fieldsToCastStr) - concatenatedQuery = query.replace(fieldsToCastStr, castedFields, 1) + if not unpack: + return query else: concatenatedQuery = query fieldsSelectFrom, fieldsSelect, fieldsNoSelect, fieldsSelectTop, fieldsSelectCase, _, fieldsToCastStr, fieldsExists = self.getFields(query) diff --git a/plugins/dbms/mysql/filesystem.py b/plugins/dbms/mysql/filesystem.py index f89b7250f..cec2ddccf 100644 --- a/plugins/dbms/mysql/filesystem.py +++ b/plugins/dbms/mysql/filesystem.py @@ -89,7 +89,7 @@ class Filesystem(GenericFilesystem): logger.debug(debugMsg) sqlQuery = "%s INTO DUMPFILE '%s'" % (fcEncodedStr, dFile) - unionUse(sqlQuery) + unionUse(sqlQuery, unpack=False) if confirm: self.askCheckWrittenFile(wFile, dFile, fileType)