mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-23 03:40:05 +00:00
Fix Database::sendEmail()
* Do not define an sqlite_stmt* named stmt in a loop such that it shadows an outer variable of the same name. * Do not re-prepare a statement that has been reset.
This commit is contained in:
parent
f8a359dfe9
commit
26d0623d07
@ -1836,17 +1836,17 @@ bool Database::sendEmail(EmailData* data, std::vector<sItemBase> attachments) {
|
||||
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
sql = R"(
|
||||
INSERT INTO EmailItems
|
||||
(PlayerID, MsgIndex, Slot, ID, Type, Opt, TimeLimit)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?);
|
||||
)";
|
||||
|
||||
sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
|
||||
|
||||
// send attachments
|
||||
int slot = 1;
|
||||
for (sItemBase item : attachments) {
|
||||
sql = R"(
|
||||
INSERT INTO EmailItems
|
||||
(PlayerID, MsgIndex, Slot, ID, Type, Opt, TimeLimit)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?);
|
||||
)";
|
||||
sqlite3_stmt* stmt;
|
||||
|
||||
sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
|
||||
sqlite3_bind_int(stmt, 1, data->PlayerId);
|
||||
sqlite3_bind_int(stmt, 2, data->MsgIndex);
|
||||
sqlite3_bind_int(stmt, 3, slot++);
|
||||
|
2
tdata
2
tdata
@ -1 +1 @@
|
||||
Subproject commit a6a3841ff219ed57bbfda008782220ac4c111664
|
||||
Subproject commit 75d82f3155687d73ad72cfc479d2c2c7c3ecd20f
|
Loading…
Reference in New Issue
Block a user