cache_get_value...
#1

Hi, what's the difference between cache_get_value and cache_get_value_name, cache_get_value_int and cache_get_value_name_int and so on in MySQL?
Reply
#2

Its the function which fetches the data stored by your query..... name means string, obiously, int means integer amd so on.... just check some example code's usage somewhere and u'll know the purpose of usage then..

you can check wiki here https://sampwiki.blast.hk/wiki/MySQL/R40
Reply
#3

I know what they are for, but I'm asking the difference between them.
Код:
cache_get_value
cache_get_value_name
cache_get_value_int
cache_get_value_name_int
cache_get_value_float
cache_get_value_name_float
Reply
#4

One gets the results by column index (0, 1, 2, ...) the other gets them by name ("id", "name", "level", ...).
Reply
#5

cache_get_value_index gets the results by column index whereas cache_get_value (macro) accepts both column index or column name.
Reply
#6

Right, but there are 3 of them like cache_get_value_index, cache_get_value_name, cache_get_value. What's the difference between cache_get_value_name and cache_get_value?
Reply
#7

There is no cache_get_value. Atleast no in the mysql wiki: (click the fnames for the wiki page)

cache_get_value_name:
cache_get_value_name(0, "name", dest);
Selects a row by a column name and loads it into the destination array(in this case).

cache_get_value_index:
Selects a row by a column number and loads it into the destination array(in this case).
cache_get_value_index(0, 0, dest);


Performance wise the index one is faster hence it doesn't need to check the column name and compare it to what did you type in. But the index is way messy.
Reply
#8

Quote:
Originally Posted by Runn3R
Посмотреть сообщение
There is no cache_get_value.
https://github.com/pBlueG/SA-MP-MySQ...stem-cache.pwn - that's MySQL R40.
Reply
#9

It's probably a macro or a redefinition.

Try adding cache_get_value_int and it will work just as cache_get_value_name_int
Reply
#10

Quote:
Originally Posted by maddinat0r
cache_get_value is just a comfort function (macro actually). Based on the input parameters you provide, it automatically resolves to cache_get_value_name or cache_get_value_index, e.g.:
Код:
cache_get_value(0, 0, data); // translates to cache_get_value_index
cache_get_value(0, "field", data); // translates to cache_get_value_name

new idx;
cache_get_value(0, idx, data); // translates to cache_get_value_index

new field[32] = "field2";
cache_get_value(0, string:field, data); // translates to cache_get_value_name
Just a macro.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)