Who better?
#1

Hi, scripters. I need you advice again (If anyone remember me ), who better mysql_get_field or cache_get_row for RP server? I don't need dumbs answer. I need only advice.
- ScriptWriter
Reply
#2

cache_get_row is alot better and easier

thats a QUOTE from caching tutorial

Quote:
Originally Posted by AndreT
Посмотреть сообщение
Benefits of using the cache

* It is faster! Using cache functions instead of mysql_fetch_row is notably faster. For JernejL, loading 1300 vehicles from the database went from 6 seconds to 60 milliseconds (source) and from my personal experience, I can tell that loading 500 houses from a database is now at least 10-20 times faster (source). Here are some more results.
* It does not require the coder to store/free the query result! There's no need to call mysql_store_result() to store the result or mysql_free_result() to free the result after done processing it. Specifically the result freeing has proven itself to be a source of problems, specially for newer scripters.
* It is easier to read/write/modify! (depending on the programmer's own preference)
To continue with, parsing the query result has become simpler compared to several older methods like sscanf.


With mysql_fetch_row, no caching
1. mysql_fetch_row calls took 3065 milliseconds
2. sscanf (parsing) took 27ms in total (500 calls to function)
3. the rest of the house loading code took 129ms (irrelevant)
Total: 3221ms

With caching
1. cache functions (loading and parsing) took 166ms
2. the rest of the house loading code took 108ms (irrelevant)
Total: 274ms

From this, we can tell that using the caching functions is about 12 times faster in such example (with loops and huge rows of data being returned).
Reply
#3

Thanks for advice. But now i want ask you.
First: How get AUTO_INCREMENT type field value when use cache_get_row function?
Second: How save string type variable in mysql?
Reply
#4

Bump
Reply
#5

AUTO_INCREMENT is an attribute, not a field type. It is integer. String - varchar. Text for long texts
Reply
#6

use mysql_insert_id to get AUTO_INCREMENT value
pawn Код:
mysql_function_query(server,"INSERT INTO .......",true,"GetID","");

forward GetID();
public GetID()
{
      printf("%d",mysql_insert_id(server));
      return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)