Repository navigation
The Cache
Inside the public of a query, its result is the active cache. The cache_ natives read it.
forward OnPlayersRead();
public OnPlayersRead() {
new
name[MAX_PLAYER_NAME + 1],
score
;
for (new row, rows = cache_num_rows(); row != rows; ++row) {
cache_get_value_name(row, "name", name);
cache_get_value_name_int(row, "score", score);
printf("%s has %i", name, score);
}
return 1;
}-
cache_get_value_name and cache_get_value_index read a cell as text. A NULL cell reads as
NULL. - The
_int,_floatand_boolnatives read numbers into a variable and returnfalse, leaving it as it was, when the cell is NULL or missing. - cache_is_value_name_null and cache_is_value_index_null tell whether a cell is NULL.
-
cache_get_value,cache_get_value_int,cache_get_value_float,cache_get_value_boolandcache_is_value_nullread by name when the field is written between quotes, and by index otherwise. -
cache_get_row reads the fields of a row in order into variables, with a format such as
"s[37]is[64]f".
cache_get_row_count, cache_get_field_count and cache_get_result_count write counts into a variable, and cache_num_rows, cache_num_fields and cache_num_results return them. A query with several statements gives a result for each, chosen with cache_set_result. cache_get_field_name, cache_get_field_type and cache_get_field_index describe the fields.
The cache of a public is freed when the public returns. cache_save keeps it, as a new cache each time it is called. cache_set_active makes a saved cache the active one again, cache_unset_active leaves none active, and cache_delete frees it.
cache_affected_rows, cache_insert_id, cache_warning_count, cache_get_query_exec_time and cache_get_query_string tell what the query did. cache_get_errno gives its error inside the public of a failed query on a handle with ERROR_CALLBACK.
mysql 0.6.0 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Queries
- The cache
- JSON cells
- Prepared statements
- Transactions
- The ORM
- Passwords
- Errors
- TLS
- Coming from another plugin
- Performance
Reference
Functions
Connections
Queries
Cache
- cache_get_row_count
- cache_get_field_count
- cache_get_result_count
- cache_get_field_name
- cache_get_field_type
- cache_get_field_index
- cache_set_result
- cache_get_value_index
- cache_get_value_index_int
- cache_get_value_index_float
- cache_get_value_index_bool
- cache_is_value_index_null
- cache_get_value_name
- cache_get_value_name_int
- cache_get_value_name_float
- cache_get_value_name_bool
- cache_is_value_name_null
- cache_get_row
- cache_save
- cache_delete
- cache_set_active
- cache_unset_active
- cache_is_any_active
- cache_is_valid
- cache_affected_rows
- cache_insert_id
- cache_warning_count
- cache_get_query_exec_time
- cache_get_query_string
- cache_get_errno