使用更新查询更新 sqlite table 中的值时出现问题
issue while updating value in sqlite table with update query
我正在我的 swift 项目 中实施 sqlite 并使用 update query
我正在 更新 来自 table
的一些 value
但我收到 语法错误 我不是确定为什么我收到 error.
更新代码
let updateStatementString = "UPDATE CreateInspDrawingDetail SET edit_file_name = \(self.imgbase64!) WHERE property_id = \(property_ID!) AND properties_drawings_id = \(self.drawingID!)"
var updateStatement: OpaquePointer? = nil
if sqlite3_prepare_v2(db, updateStatementString, -1, &updateStatement, nil) == SQLITE_OK {
if sqlite3_step(updateStatement) == SQLITE_DONE {
print("Successfully updated row.")
} else {
print("Could not update row.")
}
} else {
print("UPDATE statement could not be prepared")
}
sqlite3_finalize(updateStatement)
我收到 语法错误,如下所示
near "/": syntax error UPDATE statement could not be prepared
我的查询有什么问题请告诉我
试试这个
let updateStatementString = "UPDATE CreateInspDrawingDetail SET edit_file_name = '\(self.imgbase64!)' WHERE property_id = '\(property_ID!)' AND properties_drawings_id = '\(self.drawingID!)';"
var updateStatement: OpaquePointer? = nil
if sqlite3_prepare_v2(db, updateStatementString, -1, &updateStatement, nil) == SQLITE_OK {
if sqlite3_step(updateStatement) == SQLITE_DONE {
print("Successfully updated row.")
} else {
print("Could not update row.")
}
} else {
print("UPDATE statement could not be prepared")
}
sqlite3_finalize(updateStatement)
我正在我的 swift 项目 中实施 sqlite 并使用 update query
我正在 更新 来自 table
的一些 value
但我收到 语法错误 我不是确定为什么我收到 error.
更新代码
let updateStatementString = "UPDATE CreateInspDrawingDetail SET edit_file_name = \(self.imgbase64!) WHERE property_id = \(property_ID!) AND properties_drawings_id = \(self.drawingID!)"
var updateStatement: OpaquePointer? = nil
if sqlite3_prepare_v2(db, updateStatementString, -1, &updateStatement, nil) == SQLITE_OK {
if sqlite3_step(updateStatement) == SQLITE_DONE {
print("Successfully updated row.")
} else {
print("Could not update row.")
}
} else {
print("UPDATE statement could not be prepared")
}
sqlite3_finalize(updateStatement)
我收到 语法错误,如下所示
near "/": syntax error UPDATE statement could not be prepared
我的查询有什么问题请告诉我
试试这个
let updateStatementString = "UPDATE CreateInspDrawingDetail SET edit_file_name = '\(self.imgbase64!)' WHERE property_id = '\(property_ID!)' AND properties_drawings_id = '\(self.drawingID!)';"
var updateStatement: OpaquePointer? = nil
if sqlite3_prepare_v2(db, updateStatementString, -1, &updateStatement, nil) == SQLITE_OK {
if sqlite3_step(updateStatement) == SQLITE_DONE {
print("Successfully updated row.")
} else {
print("Could not update row.")
}
} else {
print("UPDATE statement could not be prepared")
}
sqlite3_finalize(updateStatement)