def insert_project(project_name, project_descrip, html): pid = db.insert('project', name=project_name, create_date=now()) print pid if pid: itemid = db.insert('item', pid=99, title=project_name, text=project_descrip, html=html, create_date=now()) if pid and itemid: return pid else: return False
def update_project(pid, project_name, project_descrip, html): query_str = r'''update item i, project p set i.title='%s', i.text='%s', i.html='%s', i.update_date='%s' where p.id=%s and p.name=i.title and i.pid=99''' % (project_name.replace("'", "\\'"), project_descrip.replace("'", "\\'"), html.replace("'", "\\'"), now(), pid) # print query_str item_rlt = db.query(query_str) project_rlt = db.update('project', name=project_name, update_date=now(), where='id=%s' % pid) if item_rlt and project_rlt: return True else: return False
def update_project(pid, project_name, project_descrip, html): project_rlt = db.update( "project", name=project_name, description=project_descrip, update_date=now(), where="id=%s" % pid ) if project_rlt: return True else: return False
def login_record(ip): return db.insert('login', ip=ip, time=now())
def insert_project(project_name, project_descrip, html): pid = db.insert("project", name=project_name, description=project_descrip, create_date=now()) if pid: return pid else: return False