author | Don Pellegrino <don@drexel.edu> | 2009-06-17 18:06:42 (GMT) |
---|---|---|
committer | Don Pellegrino <don@drexel.edu> | 2009-06-17 18:06:42 (GMT) |
commit | 83b9f438c4aeb1afe7bd9d62b42986518cd890d8 (patch) (unidiff) | |
tree | 5042953a73eaca32224736fb2ae78be29896ddc7 | |
parent | eefb241d402dbb40716e3f00eb66997774473741 (diff) | |
download | exp005-83b9f438c4aeb1afe7bd9d62b42986518cd890d8.zip exp005-83b9f438c4aeb1afe7bd9d62b42986518cd890d8.tar.gz exp005-83b9f438c4aeb1afe7bd9d62b42986518cd890d8.tar.bz2 |
Create an object to centralize the connection.
-rw-r--r-- | src/db/dbconnect.h | 11 | ||||
-rw-r--r-- | src/db/dbconnect.sqc | 11 |
2 files changed, 22 insertions, 0 deletions
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 @@ | |||
1 | #ifndef DBCONNECT_H | ||
2 | #define DBCONNECT_H | ||
3 | |||
4 | /* | ||
5 | * Connect to the database. Moved connection to its own file so that | ||
6 | * there will be exactly one EXEC SQL INCLUDE sqlca; call as per | ||
7 | * http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.apdv.embed.doc/doc/t0004664.html. | ||
8 | */ | ||
9 | void dbconnect (void); | ||
10 | |||
11 | #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 @@ | |||
1 | #include "dbconnect.h" | ||
2 | #include "../util/check_error.h" | ||
3 | |||
4 | EXEC SQL INCLUDE sqlca; | ||
5 | |||
6 | void | ||
7 | dbconnect (void) | ||
8 | { | ||
9 | EXEC SQL CONNECT TO exp004; | ||
10 | check_error (__FILE__, __LINE__); | ||
11 | } | ||