UDF library for handling trees in MySQL