-rw-r--r-- | src/controller/selection_from_db.sqc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/controller/selection_from_db.sqc b/src/controller/selection_from_db.sqc index 9467ab3..8a49510 100644 --- a/src/controller/selection_from_db.sqc +++ b/src/controller/selection_from_db.sqc @@ -1,9 +1,10 @@ #define GL_GLEXT_PROTOTYPES #include "selection_from_db.h" #include "../view/exp004state0.h" +#include "../util/check_error.h" #include <GL/glut.h> - -EXEC SQL INCLUDE sqlca; +#include "sqlca.h" +extern struct sqlca sqlca; /* * A simple alias to make the code more readable. @@ -25,6 +26,7 @@ selection_from_db (void) ORDER BY title, id DESC; EXEC SQL OPEN c3; + check_error (__FILE__, __LINE__); /* * This loop currently assumes only one set in the table and does @@ -34,18 +36,22 @@ selection_from_db (void) EXEC SQL FETCH c3 INTO :vis_sel_set; while (sqlca.sqlcode != 100) { - S.selection[vis_sel_set.id] = true; - S.base_colors_data[vis_sel_set.id][0] = vis_sel_set.r; - S.base_colors_data[vis_sel_set.id][1] = vis_sel_set.g; - S.base_colors_data[vis_sel_set.id][2] = vis_sel_set.b; - S.base_colors_data[vis_sel_set.id][3] = 0.6; + int i = vis_sel_set.id - 1; + + S.selection.set[i] = true; + S.base_colors_data[i][0] = vis_sel_set.r; + S.base_colors_data[i][1] = vis_sel_set.g; + S.base_colors_data[i][2] = vis_sel_set.b; + S.base_colors_data[i][3] = 0.6; EXEC SQL FETCH c3 INTO :vis_sel_set; } EXEC SQL CLOSE c3; + check_error (__FILE__, __LINE__); EXEC SQL COMMIT; + check_error (__FILE__, __LINE__); /* * Update the graphics memory. |