I am fairly new to SQL and I want to make sure I am using the connector as efficiently as possible Below is a function which I use to connect to a MySQL database using MySQL connector. It works well, however I have a lot of other functions which perform very similar tasks to different tables or by referencing different columns. Two key points I am trying to understand are:
1. If I were to write a class for all of these functions, how much of this could I put into the constructor, destructor? do I need to re-initialize everything, every time I make a call?
2. When researching how to get variables into SQL command lines, my current method as well as prepared_statement.h were the two methods I found. I had trouble getting the latter to work so I stuck with the current method. Is there any reason I should give prepared_statement.h another try?