-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 @@ | |||
1 | #define GL_GLEXT_PROTOTYPES | 1 | #define GL_GLEXT_PROTOTYPES |
2 | #include "selection_from_db.h" | 2 | #include "selection_from_db.h" |
3 | #include "../view/exp004state0.h" | 3 | #include "../view/exp004state0.h" |
4 | #include "../util/check_error.h" | ||
4 | #include <GL/glut.h> | 5 | #include <GL/glut.h> |
5 | 6 | #include "sqlca.h" | |
6 | EXEC SQL INCLUDE sqlca; | 7 | extern struct sqlca sqlca; |
7 | 8 | ||
8 | /* | 9 | /* |
9 | * A simple alias to make the code more readable. | 10 | * A simple alias to make the code more readable. |
@@ -25,6 +26,7 @@ selection_from_db (void) | |||
25 | ORDER BY title, id DESC; | 26 | ORDER BY title, id DESC; |
26 | 27 | ||
27 | EXEC SQL OPEN c3; | 28 | EXEC SQL OPEN c3; |
29 | check_error (__FILE__, __LINE__); | ||
28 | 30 | ||
29 | /* | 31 | /* |
30 | * This loop currently assumes only one set in the table and does | 32 | * This loop currently assumes only one set in the table and does |
@@ -34,18 +36,22 @@ selection_from_db (void) | |||
34 | EXEC SQL FETCH c3 INTO :vis_sel_set; | 36 | EXEC SQL FETCH c3 INTO :vis_sel_set; |
35 | while (sqlca.sqlcode != 100) | 37 | while (sqlca.sqlcode != 100) |
36 | { | 38 | { |
37 | S.selection[vis_sel_set.id] = true; | 39 | int i = vis_sel_set.id - 1; |
38 | S.base_colors_data[vis_sel_set.id][0] = vis_sel_set.r; | 40 | |
39 | S.base_colors_data[vis_sel_set.id][1] = vis_sel_set.g; | 41 | S.selection.set[i] = true; |
40 | S.base_colors_data[vis_sel_set.id][2] = vis_sel_set.b; | 42 | S.base_colors_data[i][0] = vis_sel_set.r; |
41 | S.base_colors_data[vis_sel_set.id][3] = 0.6; | 43 | S.base_colors_data[i][1] = vis_sel_set.g; |
44 | S.base_colors_data[i][2] = vis_sel_set.b; | ||
45 | S.base_colors_data[i][3] = 0.6; | ||
42 | 46 | ||
43 | EXEC SQL FETCH c3 INTO :vis_sel_set; | 47 | EXEC SQL FETCH c3 INTO :vis_sel_set; |
44 | } | 48 | } |
45 | 49 | ||
46 | EXEC SQL CLOSE c3; | 50 | EXEC SQL CLOSE c3; |
51 | check_error (__FILE__, __LINE__); | ||
47 | 52 | ||
48 | EXEC SQL COMMIT; | 53 | EXEC SQL COMMIT; |
54 | check_error (__FILE__, __LINE__); | ||
49 | 55 | ||
50 | /* | 56 | /* |
51 | * Update the graphics memory. | 57 | * Update the graphics memory. |