diff commons/core/writer/MySqlTranscriptWriter.py @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents 769e306b7933
children
line wrap: on
line diff
--- a/commons/core/writer/MySqlTranscriptWriter.py	Mon Apr 22 11:11:10 2013 -0400
+++ b/commons/core/writer/MySqlTranscriptWriter.py	Mon Apr 29 03:20:15 2013 -0400
@@ -164,7 +164,7 @@
         @type  transcriptListParser: class L{TranscriptListParser<TranscriptListParser>}
         """
         self.transcriptListParser = transcriptListParser
-        self.mySqlConnection.executeManyQueriesIterator(self)
+        self.mySqlConnection.executeManyFormattedQueriesIterator(self)
             
             
     def getIterator(self):
@@ -178,7 +178,8 @@
                 self.createTable(chromosome)
             self.nbTranscriptsByChromosome[chromosome] = self.nbTranscriptsByChromosome.get(chromosome, 0) + 1
             values = transcript.getSqlValues()
-            yield "INSERT INTO '%s' (%s) VALUES (%s)" % (self.tables[chromosome].name, ", ".join(self.tables[chromosome].variables), ", ".join([MySqlTable.formatSql(values[variable], self.tables[chromosome].types[variable], self.tables[chromosome].sizes[variable]) for variable in self.tables[chromosome].variables]))
+            #yield "INSERT INTO '%s' (%s) VALUES (%s)" % (self.tables[chromosome].name, ", ".join(self.tables[chromosome].variables), ", ".join([MySqlTable.formatSql(values[variable], self.tables[chromosome].types[variable], self.tables[chromosome].sizes[variable]) for variable in self.tables[chromosome].variables]))
+            yield ("INSERT INTO '%s' (%s) VALUES (%s)" % (self.tables[chromosome].name, ", ".join(self.tables[chromosome].variables), ", ".join(["?"] * len(self.tables[chromosome].variables))), [values[variable] for variable in self.tables[chromosome].variables])
             progress.inc()
         progress.done()
             
@@ -190,7 +191,7 @@
         """
         for chromosome in self.transcriptValues:
             if chromosome in self.transcriptValues:
-                self.tables[chromosome].insertMany(self.transcriptValues[chromosome])
+                self.tables[chromosome].insertManyFormatted(self.transcriptValues[chromosome])
         self.transcriptValues = {}
         self.toBeWritten      = False
             
@@ -211,4 +212,4 @@
         Drop the tables
         """
         for chromosome in self.tables:
-            self.tables[chromosome].remove()
+            self.tables[chromosome].remove()
\ No newline at end of file