开发者

SQLite vague syntax error

开发者 https://www.devze.com 2023-01-22 15:09 出处:网络
Ok, so I\'m putting a list of 25 tuples, with each tuple containing 5 items, into an sqlite database. Each time I try the main code to write, I get \"apsw.SQLError: SQLError: near \"?\": syntax error\

Ok, so I'm putting a list of 25 tuples, with each tuple containing 5 items, into an sqlite database. Each time I try the main code to write, I get "apsw.SQLError: SQLError: near "?": syntax error" Here's the code I'm running. Be aware that this is part of a much, much larger server project for a game, so some of the functions 开发者_运维百科will be unknown to you.

def writetable(self,blockoffset,matbefore,matafter,name,date):
    self.blocklist.append((blockoffset,matbefore,matafter,name,date))
    if len(self.blocklist) > 25:
        self.memcursor.executemany("INSERT OR REPLACE INTO main (?,?,?,?,?)",self.blocklist)
        blocklist.clear()
        print("Memory Database updated")


I believe it should be:

self.memcursor.executemany("INSERT OR REPLACE INTO main VALUES (?,?,?,?,?)",self.blocklist)


You probably forgot the VALUES keyword:

  self.memcursor.executemany("INSERT OR REPLACE INTO main VALUES (?,?,?,?,?)",self.blocklist)

Have a look here for the correct syntax.

0

精彩评论

暂无评论...
验证码 换一张
取 消