sqlite query not working

Steve Holden steve at holdenweb.com
Tue Nov 7 16:09:51 EST 2006


John Salerno wrote:
> Hopefully this is enough code to reveal the problem. When I run the 
> program, there are no error messages produced, it's just that the values 
> I enter don't seem to get put into the database, even though the query 
> seems to be ok.
> 
> 
>      def OnSaveRecord(self, event):
>          textfield_values = []
>          for tab in self.notebook.GetCurrentPage().GetChildren():
>              for table in self.get_textfield_ids():
>                  table_values = []
>                  for textfield_id in table:
>                      table_values.append(xrc.XRCCTRL(tab, 
> textfield_id).GetValue())
>                  textfield_values.append(table_values)
>          res_id = self.create_id(textfield_values[0][0], 
> textfield_values[0][2])
>          for table in textfield_values:
>              table.insert(0, res_id)
>          self.save_to_database(textfield_values)
> 
>      def save_to_database(self, data):
>          # doesn't work?
>          self.connection.execute("""INSERT INTO Personal VALUES
>                                  (?,?,?,?,?,?,?,?,?,?)""", tuple(data[0]))

Have you tried adding a self.connection.commit() to the code? I don't 
know whether sqlite is transactional, but if it is then the changes will 
disappear without a commit.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list