示例#1
0
def finish_task():
    print "Choose task id to finish:"
    id = raw_input().strip()
    print "Your rate:"
    rate = raw_input().strip()
    sqlite3_api.update(
        "C:\Python27\python_scripts\\task.db",
        query_str="update task set status = 1, rate = {0} where id={1}".format(rate, id),
    )
示例#2
0
 def save_to_database(self):
     new_row = self.type, self.brief, self.description, self.start_date, self.end_date, self.status, self.rate
     if not self.id:
         sqlite3_api.insert(
             db_name="C:\Python27\python_scripts\\task.db",
             query_str="insert into task(type, brief, description, start_date, end_date, status, rate) values(?,?,?,?,?,?,?)",
             data=new_row,
         )
     else:
         sqlite3_api.update(
             db_name="C:\Python27\python_scripts\\task.db",
             query_str="update task set type={0}, brief={1}, description={2}, start_date={3}, end_date={4}, status={5}, rate={6} where id={7}".format(
                 new_row + (self.id,)
             ),
         )