[pysqlite] [APSW 3.6.5-r1] Why does this INSERT fail?
Fred <[email protected]> Fri, 26 Dec 2008 22:25:00 +0100
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I can't figure out why this INSERT fails. Maybe some fresh eyes can
pick the cause of the error:
==========
connection=apsw.Connection("mydb.sqlite")
cursor=connection.cursor()
cursor.execute("BEGIN")
#Extracting one record at at time
matches = record.finditer(response)
for m in matches:
item = m.group(1)
#All records have those
itemmatch = core.search(item)
if itemmatch:
name = itemmatch.group(1).strip()
address = itemmatch.group(2).strip()
tel = itemmatch.group(3).strip()
#Some records have a web address
itemmatch = www.search(item)
if itemmatch:
web = itemmatch.group(1).strip()
#Some records have an e-mail address
itemmatch = mail.search(item)
if itemmatch:
email = itemmatch.group(1).strip()
sql = "INSERT INTO person (name,address,tel,web,email) VALUES (?,?,?,?,?)"
try:
cursor.execute(sql,(name,address,tel,web,email))
except:
#Here : why does it fail?
print "Failed %s" % sql
cursor.execute("COMMIT")
connection.close(True)
==========
Thank you.