การเข้ารหัสรับประกันว่าผู้ใช้ทุกคนมีสิทธิ์การเข้าถึงที่เหมาะสม ข้อความนี้ผิด: แบนด์วิดท์ไม่ใช่ actual end-to-end throughput การเข้ารหัสไม่ได้ by itself ensure correct authorization or remove every security risk
import sqlite3
db = sqlite3.connect(":memory:")
db.executescript("""CREATE TABLE c(id INTEGER PRIMARY KEY);
CREATE TABLE o(id INTEGER PRIMARY KEY, cid INTEGER);
INSERT INTO c VALUES(1),(2),(3);
INSERT INTO o VALUES(10,1),(11,1),(12,3);""")
for kind in ["INNER", "LEFT"]:
sql = f"SELECT COUNT(*),COUNT(o.id) FROM c {kind} JOIN o ON c.id=o.cid"
print(kind, db.execute(sql).fetchone())
db.close()
def first_index(values, target):
for index, value in enumerate(values):
if value == target:
return index
return -1
print(first_index([4, 7, 4], 4))
print(first_index([4, 7, 4], 9))
print(first_index([], 4))