You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PreparedStatements1 = conn.prepareStatement("SELECT AttributeVariable FROM ATTRIBUTEVARIABLES WHERE VariableId = ? ORDER BY ATTRIBUTEVARIABLES.ID ASC;");
@@ -59,19 +59,20 @@ static public DataFrame getAttributes(int variableId) {
59
59
ResultSetr2;
60
60
intentityId;
61
61
introwCounter = 0;
62
-
intcolumnCounter = 0;
62
+
intcolumnCounter;
63
63
while(r1.next()) {
64
64
entityId = r1.getInt("ID");
65
65
data[rowCounter][0] = entityId; // entity ID
66
66
data[rowCounter][1] = r1.getString("Value"); // entity value
67
67
data[rowCounter][2] = String.format("#%02X%02X%02X", r1.getInt("Red"), r1.getInt("Green"), r1.getInt("Blue")); // entity color as hex RGB value with leading hashtag
PreparedStatements = conn.prepareStatement("SELECT ID FROM VARIABLES WHERE Variable = ? AND StatementTypeId = ?;")) {
116
+
s.setString(1, variable);
117
+
s.setInt(2, statementTypeId);
118
+
ResultSetr = s.executeQuery();
119
+
while (r.next()) {
120
+
variableId = r.getInt(1);
121
+
}
122
+
} catch (SQLExceptionex) {
123
+
LogEventl = newLogEvent(Logger.ERROR,
124
+
"Could not retrieve variable ID for variable \"" + variable + ".",
125
+
"Could not retrieve the variable ID for variable \"" + variable + " (statement type ID: " + statementTypeId + ") while trying to retrieve entities and attributes. Check if the statement type ID and variable are valid.",
126
+
ex);
127
+
Dna.logger.log(l);
128
+
}
129
+
returngetAttributes(variableId);
130
+
}
131
+
132
+
/**
133
+
* A wrapper for {@link #getAttributes(int)} that first retrieves the variable ID based on statement type and
134
+
* variable names.
135
+
*
136
+
* @param statementType The statement type in which the variable is defined.
137
+
* @param variable The name of the variable.
138
+
* @return A data frame as returned by {@link #getAttributes(int)}.
PreparedStatements = conn.prepareStatement("SELECT ID FROM VARIABLES WHERE Variable = ? AND StatementTypeId = (SELECT ID FROM STATEMENTTYPES WHERE Label = ?);")) {
144
+
s.setString(1, variable);
145
+
s.setString(2, statementType);
146
+
ResultSetr = s.executeQuery();
147
+
while (r.next()) {
148
+
variableId = r.getInt(1);
149
+
}
150
+
} catch (SQLExceptionex) {
151
+
LogEventl = newLogEvent(Logger.ERROR,
152
+
"Could not retrieve variable ID for variable \"" + variable + ".",
153
+
"Could not retrieve the variable ID for variable \"" + variable + " (statement type: \"" + statementType + "\") while trying to retrieve entities and attributes. Check if the statement type and variable are valid.",
154
+
ex);
155
+
Dna.logger.log(l);
156
+
}
157
+
returngetAttributes(variableId);
158
+
}
159
+
103
160
/**
104
161
* Set entities and attributes for a variable by comparing with a supplied data frame.
0 commit comments