Mysql defines a Mysql::Time subclass. Unfortunately, this creates a namespace collision when application extensions
to the Mysql class invoke system Time class methods. The following code generates this error message:
undefined method `now' for Mysql::Time:Class
class Mysql
def timed_query(qs)
t0 = Time.now
qq = self.query(qs)
t1 = Time.now()
printf("\nLong query (%.1f): %s",(t1-t0),qs) if (t1-t0)>1.0
qq
end
end
It would be nice if the Mysql::Time class could be renamed Mysql::MysqlTime. And if there's an elegant solution to
this problem I'd be grateful to be taught. I've resorted to a hack of wrapping Time inside a new class with new method
names.
Thank you. |