def bulk_insert_status(self, status_list): values = [utils.convert_status(status) for status in status_list] c = self.conn.cursor() c.executemany(("INSERT OR REPLACE INTO status " " (id,sid,uid,text,photo, created_at,added_at,data) " " VALUES (?,?,?,?,?,?,?,?) "), values) self.conn.commit() print "%d 条消息已存储到数据库" % c.rowcount return c
def insert_status(self, status): values = utils.convert_status(status) c = self.conn.cursor() c.execute(("INSERT OR REPLACE INTO status " " (id,sid,uid,created_at,added_at,data) " " VALUES (?,?,?,?,?,?) "), *values) self.conn.commit() print "insert_status: %d rows inserted to db" % c.rowcount return c
def insert_status(self, status): values = utils.convert_status(status) c = self.conn.cursor() c.execute(("INSERT OR REPLACE INTO status " " (id,sid,uid,text,photo, created_at,added_at,data) " " VALUES (?,?,?,?,?,?,?,?) "), *values) self.conn.commit() print "insert_status: %d rows inserted to database" % c.rowcount return c
def bulk_insert_status(self, status_list): values = [utils.convert_status(status) for status in status_list] c = self.conn.cursor() c.executemany(("INSERT OR REPLACE INTO status " " (id,sid,uid,created_at,added_at,data) " " VALUES (?,?,?,?,?,?) "), values) self.conn.commit() print "bulk_insert_status: %d rows inserted to db" % c.rowcount return c