2020-12-18, 10:58 AM
(This post was last modified: 2020-12-18, 11:01 AM by shane adevaratu.)
What is the most efficient way to load data from the database.
For example, how could I make the function below more efficient.
The 'ID'?starts at 1 and reaches over 100.
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.