Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#76 closed defect (wontfix)

mythgame makes two Calls to the Database when only one will do the job.

Reported by: Korey <k.m.fort@…> Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythgame Version: head
Severity: low Keywords: Database, query, query.exec
Cc: Ticket locked: no

Description

By replacing these:

query.exec("DELETE FROM settings WHERE value='GameDBSchemaVer';"); query.exec(QString("INSERT INTO settings (value, data, hostname) " "VALUES ('GameDBSchemaVer', %1, NULL);").arg(newnumber));

with a sigle update.

query.exec(QString("UPDATE settings SET value='GameDBSchemaVer', data=%1, hostname=NULL WHERE value='GameDBSchemaVer';").arg(newnumber));

One call to the database can be avoided. If the settings table does not have value=GameDBSchemaVer it will be created.

Attachments (1)

single_db_exec.diff (826 bytes) - added by Korey <k.m.fort@…> 15 years ago.
Trades a DELETE and INSERT for a UPDATE call to the database.

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by Korey <k.m.fort@…>

Attachment: single_db_exec.diff added

Trades a DELETE and INSERT for a UPDATE call to the database.

comment:1 Changed 15 years ago by Isaac Richards

Resolution: wontfix
Status: newclosed

Might be more worthwhile to spend time on things that actually matter.

comment:2 Changed 15 years ago by anonymous

mythconverg.settings.value has no unique constraint. All matching rows must be deleted if there is more than one present.

comment:3 Changed 15 years ago by (none)

It still wouldn't need a unique constraint if instead of deleting the GameDBSchemaVer row everytime it just updated it. But if it won't be fixed it won't be fixed,oh well, no since in crying over spilled milk (this tickets closed)!

Note: See TracTickets for help on using tickets.