Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Other functions of MySQL function
Other functions of MySQL function
A) function default value (column name)

Function Description: Returns the default values of table columns. If the column has no default value, an error will be generated.

B) function format (x, d)

Function Description: Write the format of the number X as' #, # #, # # #. # #', D digits after the decimal point are reserved by rounding, and the result is returned as a string. If d is 0, the returned result has no decimal point or fractional part.

C) function GET_LOCK (string, timeout)

Function description: Try to get a lock with the name given by the string str, and the timeout is timeout seconds. If the lock is successfully acquired, it returns 1, if the operation times out, it returns 0 (for example, because another client has blocked this name in advance), and if there is an error, it returns NULL (for example, there is not enough memory or the thread mysqladmin kill is disconnected). If you have a lock obtained with GET_LOCK (), the lock will be released when you execute RELEASE_LOCK () or your connection is disconnected (normal or abnormal).

D) function INET_ATON(expr)

Function description: gives the point address representation of the network address in the form of a string, and returns an integer representing the address value. This address can be a 4-or 8-bit address.

Function INET_NTOA (expression)

Function Description: Given a digital network address (4 or 8 bits), the electronic address representation of the address is returned as a string.

F) function IS_FREE_LOCK(str)

Function description: Check whether the lock named str can be used (in other words, it is not blocked). If the lock can be used, it returns 1 (no one is using the lock), 0 if the lock is in use, and NULL if there is an error (such as incorrect parameters).

G) function IS_USED_LOCK(str)

Function description: Check whether the lock named str is being used (in other words, blocked). If it is blocked, the connection identifier of the client using the lock is returned. Otherwise, NULL is returned.

H) function master _ pos _ wait (log name, log location [,timeout])

Function description: This function is very useful for controlling master-slave synchronization. It will continue to be blocked until all supplementary information in the host record has been read and applied from the device to the specified location. The return value is the number of recorded events that it must wait to reach the specified location. If the slave SQL thread is not started, the slave host information is not initialized, the parameters are incorrect or there are any errors, the function returns NULL. If it times out, it returns-1. This function returns NULL if the slave SQL thread is aborted while waiting for MASTER_POS_WAIT (). If the slave device passes through the specified location, the function will return the result immediately.

I) Function name constant (name, value)

Function Description: Returns the given value. When used to generate a result set column, NAME_CONST () causes the column to use the given name.

Function RELEASE_LOCK(str)

Function Description: Unlock the lock obtained by GET_LOCK () and named after the string str. Returns 1 if the lock has been unlocked, 0 if the thread has not created the lock (the lock has not been unlocked at this time), and NULL if the named lock does not exist. If the lock has never been acquired by calling GET_LOCK (), or the lock has been unlocked in advance, the lock does not exist.

K) Functional sleep (duration)

Function Description: The sleep (pause) time is the number of seconds given by the duration parameter, and then returns 0. If SLEEP () is interrupted, 1 will be returned. The duration may or may include a given fraction in microseconds.

L) function UUID ()

Function Description: Returns a universal unique identifier (UUID), which is designed as a unique number in time and space. Two calls to UUID () should produce two different values, even if they are executed on two computers that are not connected to each other.

M) Function value (column name)

Function description: In the INSERT … ON DUPLICATE KEY UPDATE … statement, you can use the VALUES(col_name) function in the UPDATE clause to access the column values from the INSERT part of the statement. In other words, VALUES(col_name) in the UPDATE clause accesses the value of col_name to be inserted, and there will be no duplicate key conflict. This function is particularly useful when inserting multiple lines. The VALUES () function is meaningful only in the INSERT ... UPDATE statement, and only returns NULL in other cases.