Permalink: http://bit.ly/QuBLVB
Read part 1 for the rationale behind the
code.
As discussed in the first part of this blog entry, we'll be
utilizing a statement that uses base 36 to generate the
random name. We will be adding the $ and _
characters using the ELT function. Here is a true random database
and table name generator:
DELIMITER $$[Read more]
DROP FUNCTION IF EXISTS `randomNameGenerator` $$
CREATE DEFINER=`root`@`localhost` FUNCTION `randomNameGenerator`(
) RETURNS varchar(64) CHARSET utf8
BEGIN
DECLARE numberOfChars, charDiceRoll TINYINT(2);
DECLARE charCount TINYINT DEFAULT 0;
DECLARE randomChar CHAR(1);
DECLARE randomName VARCHAR(64) DEFAULT '';
…