def delete(self):
     conn = settings.getDBConn()
     cursor = conn.cursor()
     cursor.execute("DELETE FROM "+self._table+" WHERE "+self._id_field+"=%s", (self.__dict__[self._id_field],) )
     conn.commit()
     cursor.close()
     conn.close()
 def insert(self):
     conn = settings.getDBConn()
     cursor = conn.cursor()
     cursor.execute(self._insert_sql(), self.__dict__ )
     self.id =  cursor.lastrowid
     conn.commit()
     cursor.close()
     conn.close()  
 def fillById(self, id):
     conn = settings.getDBConn()
     cursor = conn.cursor()
     cursor.execute(self._select_by_id_sql(), (id,) )
     for row in cursor:
         i=0;
         for field in self._all_possible_fields():
             self.__dict__[field] = row[i]
             i+=1
     cursor.close()
     conn.close()
 def loadByFilter(self, where_clause, params_tuple):
     str_sql = self._select_sql() +" WHERE "+ where_clause
     conn = settings.getDBConn()
     cursor = conn.cursor()
     cursor.execute(str_sql, params_tuple )
     result = []
     for row in cursor:
         new_obj = self.__class__()
         i=0;
         for field in self._all_possible_fields():
             new_obj.__dict__[field] = row[i]
             i+=1
         result.append(new_obj)
     cursor.close()
     conn.close()
     return result