From 83b9f438c4aeb1afe7bd9d62b42986518cd890d8 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Wed, 17 Jun 2009 18:06:42 +0000 Subject: Create an object to centralize the connection. --- diff --git a/src/db/dbconnect.h b/src/db/dbconnect.h new file mode 100644 index 0000000..c485a79 --- a/dev/null +++ b/src/db/dbconnect.h @@ -0,0 +1,11 @@ +#ifndef DBCONNECT_H +#define DBCONNECT_H + +/* + * Connect to the database. Moved connection to its own file so that + * there will be exactly one EXEC SQL INCLUDE sqlca; call as per + * http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.apdv.embed.doc/doc/t0004664.html. + */ +void dbconnect (void); + +#endif // DBCONNECT_H diff --git a/src/db/dbconnect.sqc b/src/db/dbconnect.sqc new file mode 100644 index 0000000..1e41a12 --- a/dev/null +++ b/src/db/dbconnect.sqc @@ -0,0 +1,11 @@ +#include "dbconnect.h" +#include "../util/check_error.h" + +EXEC SQL INCLUDE sqlca; + +void +dbconnect (void) +{ + EXEC SQL CONNECT TO exp004; + check_error (__FILE__, __LINE__); +} -- cgit v0.8.3.1-22-g547a