def updateInfo(self, item, newlinks, oldlinks):
		'''爬虫爬完之后对数据库内容进行更新'''
		cur = self.conn.cursor()
		cur.execute("SELECT wid,did FROM Websites WHERE url=?", (item['url'],))
		wid, did = cur.fetchone()
		# website记录更新
		cur.execute("UPDATE Websites SET title=?,visited=1 WHERE wid=?", (item['title'], wid,))
		# 对应的domain记录中出度也需要更新
		cur.execute("UPDATE Domains SET outdegree=outdegree+? WHERE did=?", (len(item['links']), did,))

		# 对该网页中所有链接涉及的记录进行更新
		# 外部判断未出现过的链接
		for link,domain in newlinks:
			self.insertWebsite(link, domain)

		# 外部判断出现过的链接
		for link,domain in oldlinks:
			# 对对应的domain记录入度增加
			cur.execute("UPDATE Domains SET outdegree=outdegree+1 WHERE domain=?", (domain,))
		# 写入到文件
		self.conn.commit()
def test_packed(self):
        class X(Structure):
            _fields_ = [("a", c_byte),
                        ("b", c_longlong)]
            _pack_ = 1

        self.assertEqual(sizeof(X), 9)
        self.assertEqual(X.b.offset, 1)

        class X(Structure):
            _fields_ = [("a", c_byte),
                        ("b", c_longlong)]
            _pack_ = 2
        self.assertEqual(sizeof(X), 10)
        self.assertEqual(X.b.offset, 2)

        class X(Structure):
            _fields_ = [("a", c_byte),
                        ("b", c_longlong)]
            _pack_ = 4
        self.assertEqual(sizeof(X), 12)
        self.assertEqual(X.b.offset, 4)

        import struct
        longlong_size = struct.calcsize("q")
        longlong_align = struct.calcsize("bq") - longlong_size

        class X(Structure):
            _fields_ = [("a", c_byte),
                        ("b", c_longlong)]
            _pack_ = 8

        self.assertEqual(sizeof(X), longlong_align + longlong_size)
        self.assertEqual(X.b.offset, min(8, longlong_align))


        d = {"_fields_": [("a", "b"),
                          ("b", "q")],
             "_pack_": -1}
        self.assertRaises(ValueError, type(Structure), "X", (Structure,), d)

        # Issue 15989
        d = {"_fields_": [("a", c_byte)],
             "_pack_": _testcapi.INT_MAX + 1}
        self.assertRaises(ValueError, type(Structure), "X", (Structure,), d)
        d = {"_fields_": [("a", c_byte)],
             "_pack_": _testcapi.UINT_MAX + 2}
        self.assertRaises(ValueError, type(Structure), "X", (Structure,), d)