MySQL Global User Variables UDF 1.0
Sponsored Links
MySQL Global User Variables UDF 1.0 Ranking & Summary
File size:
0.004 MB
Platform:
Any Platform
License:
GPL (GNU General Public License)
Price:
Downloads:
952
Date added:
2007-03-19
Publisher:
Frank DENIS
MySQL Global User Variables UDF 1.0 description
MySQL Global User Variables UDF is a MySQL extension to store persistent variables.
This shared library adds simple user functions to MySQL in order to keep persistent shared variables in memory. These variables and their values are available to all clients. Any data can be stored into these persistent variables, including BLOBs. Since updates are atomic and way faster than MEMORY tables, this is an easy and efficient way to handle counters and sequences.
Usage:
Storing a value
An unlimited number of user variables can be created, as long as memory is available.
The GLOBAL_STORE(, ) stores a new shared global variable.
Examples:
mysql> DO GLOBAL_STORE("online_users", 42);
mysql> DO GLOBAL_STORE("secret_key", "pajfUyfnd");
The GLOBAL_STORE() function always returns 1 unless an error occurred.
Fetching a value
Reading the value of a variable is the job of the GLOBAL_GET() function.
The value is returned, or NULL is the variable is undefined.
Example:
mysql> SELECT GLOBAL_GET("online_users;);
42
mysql> SELECT id FROM pxs WHERE secret_key = GLOBAL_GET("secret_key");
1
Atomic increments
A single function call can read the previous value, add an integer (that can be negative), and store the new value into the variable.
The function is GLOBAL_ADD(, ) and the return value is the new value of the variable.
Updates are always atomic, if the old value is 18 and you add 1, you will always get back 19.
Example:
mysql> DO GLOBAL_ADD("online_users", 1);
mysql> SELECT GLOBAL_ADD("online_users", -4);
39
If the value of a variable was a string, the new value is the increment:
mysql> SELECT GLOBAL_ADD("secret_key", 12);
12
Adding a value to an undefined variable returns NULL.
A handy variant is GLOBAL_ADDP(, ). GLOBAL_ADDP() is similar to GLOBAL_ADD() but returns the PREVIOUS value of the variable instead of the new one.
Example:
mysql> DO GLOBAL_SET("xxx", 10);
mysql> SELECT GLOBAL_ADDP("xxx", 1);
10
mysql> SELECT GLOBAL_ADDP("xxx", 1);
11
Installation:
On most systems, compiling and installing the library should be as simple as typing (as root):
make install
The shared library is installed as /usr/local/lib/udf_global_user_variables.so
If the base directory of your MySQL installation is not in /usr/local, just type:
make
and then copy udf_global_user_variables.so to the right location for UDFs on your system (maybe /usr/lib/).
The name of a variable is limited to 256 bytes. If that limit is too low for your specific application, just edit the MAX_NAME_LENGTH variable on top of the .c file and reinstall. Variable names can contain binary characters.
Values are limited to 65536 bytes. If that limit is too low for you, edit the MAX_VALUE_LENGTH variable and reinstall.
This shared library adds simple user functions to MySQL in order to keep persistent shared variables in memory. These variables and their values are available to all clients. Any data can be stored into these persistent variables, including BLOBs. Since updates are atomic and way faster than MEMORY tables, this is an easy and efficient way to handle counters and sequences.
Usage:
Storing a value
An unlimited number of user variables can be created, as long as memory is available.
The GLOBAL_STORE(, ) stores a new shared global variable.
Examples:
mysql> DO GLOBAL_STORE("online_users", 42);
mysql> DO GLOBAL_STORE("secret_key", "pajfUyfnd");
The GLOBAL_STORE() function always returns 1 unless an error occurred.
Fetching a value
Reading the value of a variable is the job of the GLOBAL_GET() function.
The value is returned, or NULL is the variable is undefined.
Example:
mysql> SELECT GLOBAL_GET("online_users;);
42
mysql> SELECT id FROM pxs WHERE secret_key = GLOBAL_GET("secret_key");
1
Atomic increments
A single function call can read the previous value, add an integer (that can be negative), and store the new value into the variable.
The function is GLOBAL_ADD(, ) and the return value is the new value of the variable.
Updates are always atomic, if the old value is 18 and you add 1, you will always get back 19.
Example:
mysql> DO GLOBAL_ADD("online_users", 1);
mysql> SELECT GLOBAL_ADD("online_users", -4);
39
If the value of a variable was a string, the new value is the increment:
mysql> SELECT GLOBAL_ADD("secret_key", 12);
12
Adding a value to an undefined variable returns NULL.
A handy variant is GLOBAL_ADDP(, ). GLOBAL_ADDP() is similar to GLOBAL_ADD() but returns the PREVIOUS value of the variable instead of the new one.
Example:
mysql> DO GLOBAL_SET("xxx", 10);
mysql> SELECT GLOBAL_ADDP("xxx", 1);
10
mysql> SELECT GLOBAL_ADDP("xxx", 1);
11
Installation:
On most systems, compiling and installing the library should be as simple as typing (as root):
make install
The shared library is installed as /usr/local/lib/udf_global_user_variables.so
If the base directory of your MySQL installation is not in /usr/local, just type:
make
and then copy udf_global_user_variables.so to the right location for UDFs on your system (maybe /usr/lib/).
The name of a variable is limited to 256 bytes. If that limit is too low for your specific application, just edit the MAX_NAME_LENGTH variable on top of the .c file and reinstall. Variable names can contain binary characters.
Values are limited to 65536 bytes. If that limit is too low for you, edit the MAX_VALUE_LENGTH variable and reinstall.
MySQL Global User Variables UDF 1.0 Screenshot
Advertisements
MySQL Global User Variables UDF 1.0 Keywords
MySQL
GLOBAL
UDF
MySQL Global User Variables UDF
ADDP
MySQL Global User Variables UDF 1.0
Global User Variables
persistent variables
SELECT GLOBAL
UDF 1.0
to store
variables
user
value
variable
select
Bookmark MySQL Global User Variables UDF 1.0
MySQL Global User Variables UDF 1.0 Copyright
WareSeeker periodically updates pricing and software information of MySQL Global User Variables UDF 1.0 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of MySQL Global User Variables UDF 1.0 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
what are variables
variables in science
independent variable
what are math variables
variable comic
value city department store
variables in algebra
variable frequency drives
global dimming
simplifying square roots with variables
fortune select global
php mysql
global tv
blue book value
independent variables
complex variable
value city furniture store
globalrph
Related Software
MySQL wrapped is a very small collection of classes that hides the MySQL C API. Free Download
MySQL - Multi-user and robust SQL database server Free Download
Mysql Data Manager is multifunctional and multiplatform web based mysql administration tool and data editor. Free Download
libstrvar is a simple variable library intended mostly to ease handling of strings and certain types of data exchange. Free Download
Mysql Assistant is a MySQL viewer. Free Download
A powerful visual administration console that enables you to easily administer your MySQL environment Free Download
Libeval provides simple means of evaluating simple arithmetic expressions. Free Download
Steel Bank Common Lisp is a common Lisp native compiler. Free Download
Latest Software
Popular Software
Favourite Software