Skip to content

Commit

Permalink
some signatures have single quotes. Since partitioning disallows boun…
Browse files Browse the repository at this point in the history
…d variables in SQL these signatures are inserted as literals. SIngle quotes are now quoted to avoid screwing up the SQL.

git-svn-id: https://socorro.googlecode.com/svn/trunk@830 efcc4bdc-162a-0410-a8af-5b4b46c5376d
  • Loading branch information
twobraids committed Feb 9, 2009
1 parent d41cdf0 commit f165094
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion socorro/processor/externalProcessor.py
Expand Up @@ -219,7 +219,7 @@ def analyzeFrames(self, reportId, dumpAnalysisLineIterator, databaseCursor, date
elif frameCounter:
break
dumpAnalysisLineIterator.stopUsingSecondaryCache()
signature = self.generateSignatureFromList(signatureList)
signature = self.generateSignatureFromList(signatureList).replace("'", "''")
if signature == '' or signature is None:
if crashedThread is None:
message = "No signature could be created because we don't know which thread crashed"
Expand All @@ -231,6 +231,7 @@ def analyzeFrames(self, reportId, dumpAnalysisLineIterator, databaseCursor, date
pass
processorErrorMessages.append(message)
logger.warning("%s - %s", threading.currentThread().getName(), message)
#logger.debug("%s - %s", threading.currentThread().getName(), (signature, '; '.join(processorErrorMessages), reportId, date_processed))
databaseCursor.execute("update reports set signature = '%s', processor_notes = '%s' where id = %s and date_processed = timestamp without time zone '%s'" % (signature, '; '.join(processorErrorMessages), reportId, date_processed))

if not analyzeReturnedLines:
Expand Down
2 changes: 1 addition & 1 deletion socorro/processor/processor.py
Expand Up @@ -509,7 +509,7 @@ def processJob (self, jobTuple):
socorro.lib.util.reportExceptionAndContinue(logger)
threadLocalDatabaseConnection.rollback()
processorErrorMessages.append(str(x))
message = '\n'.join(processorErrorMessages).replace("'", "''")
message = '; '.join(processorErrorMessages).replace("'", "''")
threadLocalCursor.execute("update jobs set completedDateTime = %s, success = False, message = %s where id = %s", (datetime.datetime.now(), message, jobId))
try:
threadLocalCursor.execute("update reports set started_datetime = timestamp without time zone '%s', completed_datetime = timestamp without time zone '%s', success = False, processor_notes = '%s' where id = %s and date_processed = timestamp without time zone '%s'" % (startedDateTime, datetime.datetime.now(), message, reportId, date_processed))
Expand Down

0 comments on commit f165094

Please sign in to comment.