10-31-2015, 08:22 AM
Three seconds sounds like a serious issue. Does it happen every time, or is it only occasional? We're doing much harder work with SQLite in other plugins and it has no such performance problems. What platform are you using? Debug or release build?
Also please note that your code is kinda vulnerable to SQL injection. You should never put external strings into the query, but rather use prepared statements and placeholders:
Also please note that your code is kinda vulnerable to SQL injection. You should never put external strings into the query, but rather use prepared statements and placeholders:
local stmt = DB:prepare("UPDATE money SET money = ? WHERE uuid = ?") stmt:bind_values({Money, PlayerUUID}) -- Binds the question-marks in the previous query to actual values stmt:step() -- Execute the DB query stmt:finalize() -- Free up the resourcesThis is so common that most plugins wrap it in a helper function. In the Gallery plugin that SphinxC0re linked, it's here: https://github.com/cuberite/gallery/blob...a#L79-L107