MySql loading
#1

PHP код:
funktsioon LoadProperty()
{
    new
        
result[128], idxsql[256];
    for(new 
1<= kokkuMajui++)
    {
        
format(sqlsizeof(sql), "SELECT * FROM `majad` WHERE `id` = '%d'"i);
        
mysql_query(sql);
        
mysql_store_result();
        if(
mysql_fetch_row_format(sql,"|"))
        {
            
mysql_fetch_field_row(result,"Owned"); KasutajaMajaInfo[i][hOwned] = strval(result);
            
mysql_fetch_field_row(result,"Owner"); KasutajaMajaInfo[i][hOwner] = strval(result);
            
mysql_fetch_field_row(result,"Description"); strmid(KasutajaMajaInfo[i][hDescription], result0strlen(result), 255);//
            
mysql_fetch_field_row(result,"Value"); KasutajaMajaInfo[i][hValue] = strval(result);
            
mysql_fetch_field_row(result,"Level"); KasutajaMajaInfo[i][hLevel] = strval(result);
            
mysql_fetch_field_row(result,"Locked"); KasutajaMajaInfo[i][hLocked] = strval(result);
            
mysql_fetch_field_row(result,"LeaseDate"); KasutajaMajaInfo[i][hLeaseDate] = strval(result);
            
mysql_fetch_field_row(result,"EntranceX"); KasutajaMajaInfo[i][hEntranceX] = floatstr(result);
            
mysql_fetch_field_row(result,"EntranceY"); KasutajaMajaInfo[i][hEntranceY] = floatstr(result);
            
mysql_fetch_field_row(result,"EntranceZ"); KasutajaMajaInfo[i][hEntranceZ] = floatstr(result);
            
mysql_fetch_field_row(result,"InteriorX"); KasutajaMajaInfo[i][hInteriorX] = floatstr(result);
            
mysql_fetch_field_row(result,"InteriorY"); KasutajaMajaInfo[i][hInteriorY] = floatstr(result);
            
mysql_fetch_field_row(result,"InteriorZ"); KasutajaMajaInfo[i][hInteriorZ] = floatstr(result);
            
mysql_fetch_field_row(result,"InteriorId"); KasutajaMajaInfo[i][hInterior] = strval(result);
            
mysql_fetch_field_row(result,"HealthUpgrade"); KasutajaMajaInfo[i][hHealthUpgrade] = strval(result);
            
mysql_fetch_field_row(result,"ArmourUpgrade"); KasutajaMajaInfo[i][hKappUpgrade] = strval(result);
            
mysql_fetch_field_row(result,"RentAble"); KasutajaMajaInfo[i][hRentable] = strval(result);
            
mysql_fetch_field_row(result,"Rent"); KasutajaMajaInfo[i][hRent] = strval(result);
            
mysql_fetch_field_row(result,"Bank"); KasutajaMajaInfo[i][hBank] = strval(result);
            
mysql_fetch_field_row(result,"Narko"); KasutajaMajaInfo[i][hProds] = strval(result);
            
mysql_fetch_field_row(result,"Mats1"); KasutajaMajaInfo[i][hMats][0] = strval(result);
            
mysql_fetch_field_row(result,"Mats2"); KasutajaMajaInfo[i][hMats][1] = strval(result);
            
mysql_fetch_field_row(result,"Mats3"); KasutajaMajaInfo[i][hMats][2] = strval(result);
            
mysql_fetch_field_row(result,"Address"); strmid(KasutajaMajaInfo[i][hAddress], result0strlen(result), 64);
            
idx++;
        }
        
mysql_free_result();
    }
    
printf("[MySQL] Loaded %d houses."idx);

Help me to make it load faster
Reply
#2

Please say what is the proplem.
Reply
#3

Execute only 1 query ("SELECT * FROM majad") and use mysql_retrieve_row.

That will improve your current code. You can make it loading much faster by updating the mysql plugin to R38 and using threaded queries.
Reply
#4

Quote:
Originally Posted by Porgand
Посмотреть сообщение
Help me to make it load faster
You can't make it load fast. You're using the unthreaded queries which sucks hard, and they're freaking slow as compared to threaded queries. Search for cache tutorials for BlueG's MySQL plugin R7+ (the latest release is R38 now).
Reply
#5

Yeah, I thought about the renewal but it is quite difficult and also specific skill is not.
iZN, you mean this tutorial: https://sampforum.blast.hk/showthread.php?tid=337810 ?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)