summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/Makefile.am2
-rw-r--r--src/db/dbconnect.sqc12
-rw-r--r--src/util/check_error.c6
-rw-r--r--src/util/check_error_db.c13
-rw-r--r--src/util/check_error_db.h9
5 files changed, 36 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4938ed4..d6253b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,6 +35,7 @@ flumap_SOURCES = \
model/state/zoom_info_init.c \
util/ati_meminfo.c \
util/check_error.c \
+ util/check_error_db.c \
util/pick_convert.c \
util/sqlinfoprint.c \
view/geometry.c \
@@ -75,6 +76,7 @@ noinst_HEADERS = \
model/state/zoom_info_init.h \
util/ati_meminfo.h \
util/check_error.h \
+ util/check_error_db.h \
util/pick_convert.h \
util/sqlinfoprint.h \
view/geometry.h \
diff --git a/src/db/dbconnect.sqc b/src/db/dbconnect.sqc
index 1e41a12..aab7bcb 100644
--- a/src/db/dbconnect.sqc
+++ b/src/db/dbconnect.sqc
@@ -1,5 +1,5 @@
#include "dbconnect.h"
-#include "../util/check_error.h"
+#include "../util/check_error_db.h"
EXEC SQL INCLUDE sqlca;
@@ -7,5 +7,13 @@ void
dbconnect (void)
{
EXEC SQL CONNECT TO exp004;
- check_error (__FILE__, __LINE__);
+
+ /*
+ * Only check for a database error rather than using check_error to
+ * test for OpenGL and database errors. OpenGL may not yet be
+ * prepared and checking it prematurely could cause odd behavior.
+ */
+ check_error_db (__FILE__, __LINE__);
+
+ return;
}
diff --git a/src/util/check_error.c b/src/util/check_error.c
index c47ca43..7d116e9 100644
--- a/src/util/check_error.c
+++ b/src/util/check_error.c
@@ -2,8 +2,7 @@
#include <error.h>
#include <errno.h>
#include <stdlib.h>
-#include "sqlinfoprint.h"
-extern struct sqlca sqlca;
+#include "check_error_db.h"
void
check_error (const char *filename, const unsigned int linenum)
@@ -23,8 +22,7 @@ check_error (const char *filename, const unsigned int linenum)
/*
* Check for an error from the Database API.
*/
- if (sqlinfoprint ("DB Error", &sqlca, filename, linenum) == 1)
- exit (EXIT_FAILURE);
+ check_error_db (filename, linenum);
return;
}
diff --git a/src/util/check_error_db.c b/src/util/check_error_db.c
new file mode 100644
index 0000000..a6b7f51
--- a/dev/null
+++ b/src/util/check_error_db.c
@@ -0,0 +1,13 @@
+#include "check_error_db.h"
+#include "sqlinfoprint.h"
+#include <stdlib.h>
+extern struct sqlca sqlca;
+
+void
+check_error_db (const char *filename, const unsigned int linenum)
+{
+ if (sqlinfoprint ("DB Error", &sqlca, filename, linenum) == 1)
+ exit (EXIT_FAILURE);
+
+ return;
+}
diff --git a/src/util/check_error_db.h b/src/util/check_error_db.h
new file mode 100644
index 0000000..cc8467b
--- a/dev/null
+++ b/src/util/check_error_db.h
@@ -0,0 +1,9 @@
+#ifndef CHECK_ERROR_H
+#define CHECK_ERROR_H
+
+/*
+ * Check the database library to see if an error has occurred.
+ */
+void check_error_db (const char* filename, unsigned int linenum);
+
+#endif // CHECK_ERROR_H

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.