def url_short_new(url): id = _db.get( 'select `id` from url_short where url=%s limit 1', url) if id: id = id.id else: id = _db.execute( 'insert into `url_short` (url) values (%s)', url) return id
def post_reply(msg_id, who, text): return _db.execute('insert into `reply` (msg_id,who,t) values (%s,%s,%s)', msg_id, who, text)
def post_msg(who, text): return _db.execute('insert into `msg` (who,t) values (%s,%s)', who, text)
def post_reply(msg_id,who,text): return _db.execute( 'insert into `reply` (msg_id,who,t) values (%s,%s,%s)', msg_id,who,text)
def post_msg(who,text): return _db.execute('insert into `msg` (who,t) values (%s,%s)', who,text)
def chooseanswer(msg_id,reply_id): return _db.execute('update `msg` set answer_id = %s where id=%s' % (reply_id,msg_id))
def chooseanswer(msg_id, reply_id): return _db.execute('update `msg` set answer_id = %s where id=%s' % (reply_id, msg_id))