Using the google graph API with MySQL stored functions
After reading Alex’s blog post on generating graphs using google’s graph API I decided to do something similar for MySQL. I created a stored function that takes a height, width and a graph type from the list of available graph types in the graph API. The function returns a url to a google graph that you can then use as you like. The possibilities are endless.
Besides the nice google graph API, the function shows how to use a cursor in combination with a handler to loop through it and retrieve values from it.
In the example I use a query that determines the relative size of each database on a MySQL server, but you can change that to whatever you like.
Follow the jump for the code.