データベース エントリのタイムスタンプを使用時に更新しようとしていますが、Update ステートメントが機能していないようです。
import apsw
from datetime import datetime
def updateTimestamp(primary, timestamp):
tableName = 'Images'
connection = apsw.Connection('Images')
cursor = connection.cursor()
sql = "UPDATE %s SET timestamp = %s WHERE id = %s" %(tableName, timestamp, primary)
print "ok so far"
cursor.execute(sql)
if connection:
connection.close()
currentTime = datetime.now()
#remove spaces from timestamp
currentTime = str(currentTime).replace(' ', '')
updateTimestamp(1, currentTime)
apsw を使用してフィールドを更新しようとしていますが、機能していません。エラーが発生します
"apsw.SQLError: SQLError: near ":05": syntax error"
私のテーブルは次のようになります。
sql = 'CREATE TABLE IF NOT EXISTS ' + tableName + '(id INTEGER PRIMARY KEY
AUTOINCREMENT, Name TEXT, Metadata TEXT, Mods TEXT, Certification TEXT,
Product TEXT, Email TEXT, notes TEXT, timestamp TEXT, ftpLink TEXT)'