Hello Evgenij, 

Thank you for your reply.

Evgenij Ryazanov schrieb am Montag, 26. April 2021 um 15:08:44 UTC+2:

> Hello
>  
>
>> According to the documentation of alias (
>> https://www.h2database.com/html/commands.html#create_alias): 
>> *Creates a new function alias. If this is a ResultSet returning function, 
>> by default the return value is cached in a local temporary file.*
>>
> This line of documentation seems to be outdated, the related setting for 
> *table 
> value functions* was removed from H2.
>
> And your function should be a *regular function*, I don't see any reasons 
> to return a table from MD5 function. It should simply return a result as a 
> string or array of bytes.
>

The function does return a string, not a table. 

CREATE ALIAS MD5 AS $$
import java.security.MessageDigest;
@CODE
  
String md5(String baseString)
{
    try
    {
        MessageDigest md    = MessageDigest.getInstance("MD5");
        byte[]        array = md.digest(baseString.getBytes());
        StringBuffer  sb    = new StringBuffer();
  
        for (int i = 0; i < array.length; ++i)
        {
            sb.append(Integer.toHexString((array[i] & 0xFF) | 
0x100).substring(1, 3));
        }
        return sb.toString();
    }
    catch (java.security.NoSuchAlgorithmException e)
    {
    }
  
    return "00000000000000000000000000000000";
}
$$;

 
>
but I'd assume they would "share" the same local temporary file
>>
> No, they wouldn't.
>

That's interesting. Why's that, how are the local temporary files handled?  

It brings me back to my question: Is it possible to prevent local temporary 
files? 

Thanks, Tho

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/f180fe99-689b-44a0-85c6-88c4a21f35e5n%40googlegroups.com.

Reply via email to