Jump to content

default race_toptimes - storage


Recommended Posts

Hello, i was wondering how does the default race_toptimes save the toptimes? i readed it over many times but i couldnt quite understand the "file" saving.

My issue comes to the point i did my own Mysql toptimes but i wanted to retrive the old toptimes and inject them in my SQL table.

So far i save them in tables under "["..md5(mapname).."]".

Greets

HyPeX

Link to comment

As seen at databasetable_server.lua,

  
function SDatabaseTable:tryLoad() 
    ( ... ) 
    local cmd 
    -- SELECT 
    -- Build command 
    cmd = 'SELECT * FROM ' .. qsafetablename( self.name ) 
    local sqlResults = executeSQLQuery( cmd ) 
    ( ... ) 
end 
  

in order to transfer and utilize sqlite-stored toptimes with your new system, you'll simply need to gather these's info and insert them into your mysql database.

  
function safestring( s ) 
    -- escape ' 
    return s:gsub( "(['])", "''" ) 
end 
function qsafestring( s ) 
    -- ensure is wrapped in ' 
    return "'" .. safestring(s) .. "'" 
end 
function qsafetablename( s ) 
    return qsafestring(s) 
end 
  

Link to comment

This was my SQL injection on map start:

  
 "CREATE TABLE IF NOT EXISTS `["..md5(name).."]` ( mapname varchar(255),serial varchar(255), name varchar(255), time int, country varchar(255), date int);" 

I dont have that much of an issue to just load the SQL data and take it out; but where is the SQL connection definition, to wich SQL it connects? I already had found those lines, but the SQL Query does not specify to where it connects..

Greetz.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...