模块化 SQL WHERE 语句
Modular SQL WHERE statement
我正在尝试在具有模块化输入的 python 脚本中创建准备好的 SQL 语句。我有语句的 "INSERT" 部分,但无法使 WHERE 子句模块化更新。有没有办法做到这一点?
query = "INSERT INTO MachineInfo ( Description, Location, IP, License )
WHERE id = ID
VALUES (?,?,?,?,?)"
#The arguments are all predefined variables
args = [ deviceName, deviceLocation, ipAddress, license, ID ]
system.db.runPrepUpdate( query, args )
你似乎想要一个 UPDATE
:
UPDATE MachineInfo
SET Description = ?,
Location = ?,
IP = ?,
License = ?
WHERE id = ?;
我正在尝试在具有模块化输入的 python 脚本中创建准备好的 SQL 语句。我有语句的 "INSERT" 部分,但无法使 WHERE 子句模块化更新。有没有办法做到这一点?
query = "INSERT INTO MachineInfo ( Description, Location, IP, License )
WHERE id = ID
VALUES (?,?,?,?,?)"
#The arguments are all predefined variables
args = [ deviceName, deviceLocation, ipAddress, license, ID ]
system.db.runPrepUpdate( query, args )
你似乎想要一个 UPDATE
:
UPDATE MachineInfo
SET Description = ?,
Location = ?,
IP = ?,
License = ?
WHERE id = ?;