Numos59 / darkrp

Automatically exported from code.google.com/p/darkrp
0 stars 2 forks source link

SQL inefficiencies #662

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What is the problem?
SQL is inefficient

What steps will reproduce the problem?
n/a

Do you have any errors? serverside or clientside? If you do, which ones?
n/a

Are you using the downloaded version or an SVN revision (if SVN, which
revision number)?
921

Please provide any additional information below.
things like

DB.QueryValue("SELECT name FROM darkrp_rpnames WHERE steam = " .. 
sql.SQLStr(ply:SteamID()) .. ";", function(r)
        if r then
            DB.Query("UPDATE darkrp_rpnames SET name = " .. sql.SQLStr(name) .. " WHERE steam = " .. sql.SQLStr(ply:SteamID()) .. ";")
        else
            DB.Query("INSERT INTO darkrp_rpnames VALUES(" .. sql.SQLStr(ply:SteamID()) .. ", " .. sql.SQLStr(name) .. ");")
        end
    end)
can use REPLACE INTO to make them more efficient, 1 query vs 2

Original issue reported on code.google.com by xFROzENFUSiONx on 21 Sep 2011 at 9:14

GoogleCodeExporter commented 8 years ago
It's these hidden clausules where some performance saving lies.

Original comment by fpeijnen...@gmail.com on 23 Sep 2011 at 6:37

GoogleCodeExporter commented 8 years ago

Original comment by fpeijnen...@gmail.com on 24 Sep 2011 at 9:55

GoogleCodeExporter commented 8 years ago
thanks =)

Original comment by xFROzENFUSiONx on 24 Sep 2011 at 11:43