错误sqlite3.OperationalError:无此类列:false

时间:2019-05-14 11:54:54

标签: python sqlite

我收到此错误sqlite3.OperationalError: no such column: false。我尝试搜索,但是对于像我这样的新手,似乎没有明确的解释和解决此错误的方法。

请帮助。

def getViolationsFromCam(self, cam, cleared=False):
        cur = self.con.cursor()
        command = "SELECT camera.location, cars.id, cars.color, cars.first_sighted, cars.license_image, " \
                  " cars.license_number, cars.car_image, cars.num_rules_broken, cars.owner," \
                  " rules.name, rules.fine, violations.time, rules.id" \
                  " FROM violations, rules, cars, camera" \
                  " where rules.id = violations.rule" \
                  " and cars.id = violations.car" \
                  " and violations.camera = camera.id"
        if cam is not None:
            command = command + " and violations.camera = '" + str(cam) + "'"
        if cleared:
            command = command + " and violations.cleared = true"
        else:
            command = command + " and violations.cleared = false"

        cur.execute(command)

0 个答案:

没有答案