I am writing unit tests against an ODBC driver on MAC. Hence, every time I am trying to build a test, I need to declare the following variables to allocate resources.
SQLRETURN rc;
SQLHENV h_env;
SQLHDBC h_conn;
SQLHSTMT h_stmt;
char full_dsn[500];
I am thinking to put them in a structure, or class so that every time I need the above, I just call to initialize it. But I do not know how to specifically do it code-wise, and what would be the smartest elegant method.
Besides, at the end of the fucntions, I need to call a few free function to clean up. How could I wrap those in an function that's accessible by all files under this project?
Could someone help with example code please? Thank you.
Aucun commentaire:
Enregistrer un commentaire