No, you dont need to create a new instance everytime.
The problem with your code is that you are using the same global var m
for two different objects.
Inside your mysql func definition you are defining the global var m
as the mysql module and then you are redifining the global m
as new mysql
.
Try this:
var m = new mysql();