Build Your Own DatabaseDriven Website Using PHP amp;amp; MySQL [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Build Your Own DatabaseDriven Website Using PHP amp;amp; MySQL [Electronic resources] - نسخه متنی

Kevin Yank

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








Miscellaneous Functions



















































DATABASE()


This function returns the currently selected database name or an empty
string if no database is currently selected.


USER(),SYSTEM_USER(),SESSION_USER()


This function returns the current MySQL user name, including the client
host name (e.g. 'kevin@localhost'). The SUBSTRING_INDEX function
may be used to obtain the user name alone:

SUBSTRING_INDEX(USER(),"@",1) = 'kevin'


PASSWORD(str)


A one-way password encryption function, which converts any string (typically
a plaintext password) into an encrypted format precisely 16 characters in
length. A particular plaintext string will always yield the same encrypted
string of 16 characters; thus, values encoded in this way can be used to verify
the correctness of a password without actually storing the password in the
database.

This function does not use the same encryption mechanism as UNIX passwords;
use ENCRYPT for that type of encryption.


ENCRYPT(str[,salt])


This function uses standard UNIX encryption (via the crypt() system
call) to encrypt str. The salt argument
is optional, and lets you control the seed that is used for the generation
of the password. If you want the encryption to match a UNIX password file
entry, the salt should be the two first characters of the encrypted value
you are trying to match. Depending on the implementation of crypt() on
your system, the encrypted value may only depend on the first 8 characters
of the plaintext value.

On systems where crypt() is not available, this function
returns NULL.


ENCODE(str,pass_str)


This function encrypts str using a two-way password-based
encryption algorithm, with password pass_str. To subsequently
decrypt the value, use DECODE.


DECODE(crypt_str,pass_str)


This function decrypts the encrypted crypt_str using
two-way password-based encryption, with password pass_str.
If the same password is given that was provided to ENCODE the
value originally, the original string will be restored.


MD5(string)


This function calculates an MD5 hash based on string. The resulting
value is a 32 digit hexadecimal number. A particular string will always produce
the same MD5 hash; however, MD5(NOW()) may be used, for
instance, to obtain a semi-random string when one is needed (as a default
password, for instance).


LAST_INSERT_ID()


This function returns the last number that was automatically generated
for an AUTO_INSERT column in the current connection.


FORMAT(expr,num)


This function formats a number expr with commas as
"thousands separators" and num decimal places (rounded
to the nearest value, and padded with zeroes).


VERSION()


This function returns the MySQL server version (e.g. '3.23.54-nt').


CONNECTION_ID()


This function returns the thread ID for the current connection.


GET_LOCK(str,timeout)


If two or more clients must synchronize tasks beyond what table locking
can offer, named locks may be used instead. GET_LOCK attempts
to obtain a lock with a given name (str). If the named
lock is already in use by another client, this client will wait up to timeout seconds
before giving up waiting for the lock to become free.

Once a client has obtained a lock, it can be released either using RELEASE_LOCK or
by using GET_LOCK again to obtain a new lock.

GET_LOCK returns 1 if the lock was successfully retrieved,
0 if the time specified by timeout elapsed, or NULL if
some error occurred.

GET_LOCK is not a MySQL command in and of itself—it
must appear as part of another query.

E.g.:

SELECT GET_LOCK("mylock",10)


RELEASE_LOCK(str)


This function releases the named lock that was obtained by GET_LOCK.
Returns 1 if the lock was released, 0 if the lock wasn't locked by this thread,
or NULL if the lock doesn’t exist.


BENCHMARK(count,expr)


This function repeatedly evaluates expr count times,
for the purposes of speed testing. The MySQL command line client allows the
operation to be timed.


INET_NTOA(expr)


This function returns the IP address represented by the integer expr.
See INET_ATON to create such integers.


INET_ATON(expr)


This function converts an IP address expr to a single
integer representation.

E.g.:

INET_ATON('64.39.28.1') = 64 * 2553 + 39 * 2552 + 28 * 255 + 1
= 1063751116


/ 190