What is the difference between these two cases. Firstly, if I open the connection and pass it into my method as a parameter, compared to opening the connection directly in the method?
cnn.open()
func(cnn,param1,param2);
vs
func(cnn, param1,param2)
{
cnn.open();
//open connection here
}
There’s no difference from the code you’ve posted other than in one case, your calling function needs to take care of opening/closing the connection, in the other, you’d expect the function to do it.