• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Best way to load data from database (MySQL r41)
#1
Rainbow 
What is the most efficient way to load data from the database.
For example, how could I make the function below more efficient.

Code:
function loadDealerShip( ) {
    new DS_Models = cache_num_rows( ), x, result;
    if( DS_Models == 0 ) return print( "Loaded models: no rows detected" );
    for( new i, j = DS_Models; i != j;  ) {
        cache_get_value_name_int( i, "ID", result ), x = result, dsVariable[ x ][ dsID ] = x;
        cache_get_value_name_int( i, "Model", dsVariable[ x ][ dsModel ] );
        cache_get_value_name_int( i, "Stock", dsVariable[ x ][ dsStock ] );
        cache_get_value_name_int( i, "Speed", dsVariable[ x ][ dsSpeed ] );
        cache_get_value_name_int( i, "Price", dsVariable[ x ][ dsPrice ] );
        cache_get_value_name_int( i, "Type", dsVariable[ x ][ dsType ] );
        cache_get_value_name( i, "Car", dsVariable[ x ][ dsName ] );
    } printf( "Loaded models: %d", DS_Models );
return true; }


The 'ID'?starts at 1 and reaches over 100.
  Reply


Messages In This Thread
Best way to load data from database (MySQL r41) - by shane adevaratu - 2020-12-18, 10:58 AM

Forum Jump: