Salve a tutti...
stavo cercando di scrivere una function in mysql che mi tirasse fuori n righe di hash (possibilmente tutti diversi dagli altri... forse occorrerebbe una temporary table per questo):
Ho scritto questa ma non sembra funzionare... qualcuno sa darmi qualche indicazione?
Codice PHP:
CREATE FUNCTION HASH(len INTEGER)
RETURNS INTEGER(255)
NOT DETERMINISTIC
BEGIN
DECLARE len INT;
DECLARE i INT;
DECLARE h STRING;
SET i = 0;
WHILE( i < len ) DO
select substring(MD5(RAND()), -24) as h;
SET i = i + 1;
END WHILE;
return h;
END;
chiamando ad esempio hash(5) dovrebbe tirare fuori 5 righe di hash.
(naturalmente select substring(MD5(RAND()), -24) as h; fa quello che deve fare correttamente)
grazie in anticipo