Line data Source code
1 : /* File: data_database_classifier_reader.c; Copyright and License: see below */
2 :
3 : #include "storage/data_database_classifier_reader.h"
4 : #include "u8/u8_trace.h"
5 : #include "u8/u8_log.h"
6 : #include "utf8stringbuf/utf8stringbuf.h"
7 : #include <sqlite3.h>
8 : #include <assert.h>
9 :
10 99 : u8_error_t data_database_classifier_reader_init ( data_database_classifier_reader_t *this_, data_database_t *database )
11 : {
12 99 : U8_TRACE_BEGIN();
13 99 : assert( NULL != database );
14 99 : u8_error_t result = U8_ERROR_NONE;
15 :
16 99 : (*this_).database = database;
17 :
18 99 : (*this_).statement_classifier_by_id = NULL;
19 99 : (*this_).statement_classifier_by_name = NULL;
20 99 : (*this_).statement_classifier_by_uuid = NULL;
21 99 : (*this_).statement_classifiers_by_diagram_id = NULL;
22 99 : (*this_).statement_feature_by_id = NULL;
23 99 : (*this_).statement_feature_by_uuid = NULL;
24 99 : (*this_).statement_features_by_classifier_id = NULL;
25 99 : (*this_).statement_features_by_diagram_id = NULL;
26 99 : (*this_).statement_relationship_by_id = NULL;
27 99 : (*this_).statement_relationship_by_uuid = NULL;
28 99 : (*this_).statement_relationships_by_classifier_id = NULL;
29 99 : (*this_).statement_relationships_by_feature_id = NULL;
30 99 : (*this_).statement_relationships_by_diagram_id = NULL;
31 :
32 99 : result |= data_database_classifier_reader_private_open( this_ );
33 :
34 99 : U8_TRACE_END_ERR(result);
35 99 : return result;
36 : }
37 :
38 99 : u8_error_t data_database_classifier_reader_destroy ( data_database_classifier_reader_t *this_ )
39 : {
40 99 : U8_TRACE_BEGIN();
41 99 : u8_error_t result = U8_ERROR_NONE;
42 :
43 99 : result |= data_database_classifier_reader_private_close( this_ );
44 :
45 99 : (*this_).database = NULL;
46 :
47 99 : U8_TRACE_END_ERR(result);
48 99 : return result;
49 : }
50 :
51 : /* ================================ CLASSIFIER ================================ */
52 :
53 : /*!
54 : * \brief predefined search statement to find a classifier by id
55 : */
56 : static const char DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_ID[] =
57 : "SELECT id,main_type,stereotype,name,description,x_order,y_order,list_order,uuid "
58 : "FROM classifiers WHERE id=?;";
59 :
60 : /*!
61 : * \brief predefined search statement to find a classifier by uuid
62 : */
63 : static const char DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_UUID[] =
64 : "SELECT id,main_type,stereotype,name,description,x_order,y_order,list_order,uuid "
65 : "FROM classifiers WHERE uuid=?;";
66 :
67 : /*!
68 : * \brief predefined search statement to find a classifier by name
69 : */
70 : static const char DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_NAME[] =
71 : "SELECT id,main_type,stereotype,name,description,x_order,y_order,list_order,uuid "
72 : "FROM classifiers WHERE name=?;";
73 :
74 : /*!
75 : * \brief predefined search statement to find classifier by diagram-id
76 : */
77 : static const char DATA_DATABASE_READER_SELECT_CLASSIFIERS_BY_DIAGRAM_ID[] =
78 : "SELECT classifiers.id,classifiers.main_type,classifiers.stereotype,"
79 : "classifiers.name,classifiers.description,classifiers.x_order,classifiers.y_order,classifiers.list_order,"
80 : "classifiers.uuid,"
81 : "diagramelements.id,diagramelements.display_flags,diagramelements.focused_feature_id,diagramelements.uuid "
82 : "FROM classifiers "
83 : "INNER JOIN diagramelements ON diagramelements.classifier_id=classifiers.id "
84 : "WHERE diagramelements.diagram_id=? "
85 : "ORDER BY diagramelements.id ASC;";
86 : /* To ensure reporducible results of json esports, ordering by a unique key is required here. */
87 : /* Ordering by 2 keys did not produce the expected results with sqlite3 3.34.1 */
88 : /* "ORDER BY classifiers.list_order ASC,diagramelements.id ASC;"; */
89 : /* see also https://sqlite.org/forum/forumpost/e1033dab18c262ac4b36cdf7c65bf87a5aaaecab3b3ba100e4588fc30e50f9fb */
90 :
91 : /*!
92 : * \brief the column id of the result where this parameter is stored: id
93 : */
94 : static const int RESULT_CLASSIFIER_ID_COLUMN = 0;
95 :
96 : /*!
97 : * \brief the column id of the result where this parameter is stored: main_type
98 : */
99 : static const int RESULT_CLASSIFIER_MAIN_TYPE_COLUMN = 1;
100 :
101 : /*!
102 : * \brief the column id of the result where this parameter is stored: stereotype
103 : */
104 : static const int RESULT_CLASSIFIER_STEREOTYPE_COLUMN = 2;
105 :
106 : /*!
107 : * \brief the column id of the result where this parameter is stored: name
108 : */
109 : static const int RESULT_CLASSIFIER_NAME_COLUMN = 3;
110 :
111 : /*!
112 : * \brief the column id of the result where this parameter is stored: description
113 : */
114 : static const int RESULT_CLASSIFIER_DESCRIPTION_COLUMN = 4;
115 :
116 : /*!
117 : * \brief the column id of the result where this parameter is stored: x_order
118 : */
119 : static const int RESULT_CLASSIFIER_X_ORDER_COLUMN = 5;
120 :
121 : /*!
122 : * \brief the column id of the result where this parameter is stored: y_order
123 : */
124 : static const int RESULT_CLASSIFIER_Y_ORDER_COLUMN = 6;
125 :
126 : /*!
127 : * \brief the column id of the result where this parameter is stored: list_order
128 : */
129 : static const int RESULT_CLASSIFIER_LIST_ORDER_COLUMN = 7;
130 :
131 : /*!
132 : * \brief the column id of the result where this parameter is stored: uuid
133 : */
134 : static const int RESULT_CLASSIFIER_UUID_COLUMN = 8;
135 :
136 : /*!
137 : * \brief the column id of the result where this parameter is stored: diagramelements.id
138 : */
139 : static const int RESULT_CLASSIFIER_DIAGRAMELEMENT_ID_COLUMN = 9;
140 :
141 : /*!
142 : * \brief the column id of the result where this parameter is stored: diagramelements.display_flags
143 : */
144 : static const int RESULT_CLASSIFIER_DISPLAY_FLAGS_COLUMN = 10;
145 :
146 : /*!
147 : * \brief the column id of the result where this parameter is stored: diagramelements.focused_feature_id
148 : */
149 : static const int RESULT_CLASSIFIER_FOCUSED_FEATURE_ID_COLUMN = 11;
150 :
151 : /*!
152 : * \brief the column id of the result where this parameter is stored: diagramelements.uuid
153 : */
154 : static const int RESULT_CLASSIFIER_DIAGELE_UUID_COLUMN = 12;
155 :
156 15 : u8_error_t data_database_classifier_reader_get_classifier_by_id( data_database_classifier_reader_t *this_,
157 : data_row_id_t id,
158 : data_classifier_t *out_classifier )
159 : {
160 15 : U8_TRACE_BEGIN();
161 15 : assert( NULL != out_classifier );
162 15 : u8_error_t result = U8_ERROR_NONE;
163 : int sqlite_err;
164 : sqlite3_stmt *prepared_statement;
165 :
166 : {
167 15 : prepared_statement = (*this_).statement_classifier_by_id;
168 :
169 15 : result |= data_database_classifier_reader_private_bind_id_to_statement( this_, prepared_statement, id );
170 :
171 15 : U8_TRACE_INFO( "sqlite3_step()" );
172 15 : sqlite_err = sqlite3_step( prepared_statement );
173 15 : if ( SQLITE_ROW != sqlite_err )
174 : {
175 : /* this situation may happen if a classifier is deleted that is shown in the attributes editor */
176 1 : U8_TRACE_INFO_INT( "sqlite3_step did not find a row for id", id );
177 1 : result |= U8_ERROR_DB_STRUCTURE; /* non-existing ids are worse than U8_ERROR_NOT_FOUND */
178 : }
179 :
180 15 : if ( SQLITE_ROW == sqlite_err )
181 : {
182 28 : result |= data_classifier_init( out_classifier,
183 14 : sqlite3_column_int64( prepared_statement, RESULT_CLASSIFIER_ID_COLUMN ),
184 14 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_MAIN_TYPE_COLUMN ),
185 14 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_STEREOTYPE_COLUMN ),
186 14 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_NAME_COLUMN ),
187 14 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_DESCRIPTION_COLUMN ),
188 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_X_ORDER_COLUMN ),
189 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_Y_ORDER_COLUMN ),
190 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_LIST_ORDER_COLUMN ),
191 14 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_UUID_COLUMN )
192 : );
193 :
194 14 : data_classifier_trace( out_classifier );
195 :
196 14 : sqlite_err = sqlite3_step( prepared_statement );
197 14 : if ( SQLITE_DONE != sqlite_err )
198 : {
199 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
200 0 : result |= U8_ERROR_DB_STRUCTURE;
201 : }
202 : }
203 : }
204 :
205 15 : U8_TRACE_END_ERR( result );
206 15 : return result;
207 : }
208 :
209 33 : u8_error_t data_database_classifier_reader_get_classifier_by_name( data_database_classifier_reader_t *this_,
210 : const char *name,
211 : data_classifier_t *out_classifier )
212 : {
213 33 : U8_TRACE_BEGIN();
214 33 : assert( NULL != out_classifier );
215 33 : assert( NULL != name );
216 33 : u8_error_t result = U8_ERROR_NONE;
217 : int sqlite_err;
218 : sqlite3_stmt *prepared_statement;
219 :
220 : {
221 33 : prepared_statement = (*this_).statement_classifier_by_name;
222 :
223 33 : result |= data_database_classifier_reader_private_bind_text_to_statement( this_, prepared_statement, name );
224 :
225 33 : U8_TRACE_INFO( "sqlite3_step()" );
226 33 : sqlite_err = sqlite3_step( prepared_statement );
227 33 : if ( SQLITE_ROW != sqlite_err )
228 : {
229 6 : U8_TRACE_INFO_STR( "sqlite3_step did not find a row for name", name );
230 6 : result |= U8_ERROR_NOT_FOUND;
231 : }
232 :
233 33 : if ( SQLITE_ROW == sqlite_err )
234 : {
235 54 : result |= data_classifier_init( out_classifier,
236 27 : sqlite3_column_int64( prepared_statement, RESULT_CLASSIFIER_ID_COLUMN ),
237 27 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_MAIN_TYPE_COLUMN ),
238 27 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_STEREOTYPE_COLUMN ),
239 27 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_NAME_COLUMN ),
240 27 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_DESCRIPTION_COLUMN ),
241 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_X_ORDER_COLUMN ),
242 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_Y_ORDER_COLUMN ),
243 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_LIST_ORDER_COLUMN ),
244 27 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_UUID_COLUMN )
245 : );
246 :
247 27 : data_classifier_trace( out_classifier );
248 :
249 27 : sqlite_err = sqlite3_step( prepared_statement );
250 27 : if ( SQLITE_DONE != sqlite_err )
251 : {
252 0 : U8_LOG_ERROR_INT( "sqlite3_step not done yet:", sqlite_err );
253 0 : result |= U8_ERROR_DB_STRUCTURE;
254 : }
255 : }
256 : }
257 :
258 33 : U8_TRACE_END_ERR( result );
259 33 : return result;
260 : }
261 :
262 72 : u8_error_t data_database_classifier_reader_get_classifier_by_uuid ( data_database_classifier_reader_t *this_,
263 : const char *uuid,
264 : data_classifier_t *out_classifier )
265 : {
266 72 : U8_TRACE_BEGIN();
267 72 : assert( NULL != out_classifier );
268 72 : assert( NULL != uuid );
269 72 : u8_error_t result = U8_ERROR_NONE;
270 : int sqlite_err;
271 : sqlite3_stmt *prepared_statement;
272 :
273 : {
274 72 : prepared_statement = (*this_).statement_classifier_by_uuid;
275 :
276 72 : result |= data_database_classifier_reader_private_bind_text_to_statement( this_, prepared_statement, uuid );
277 :
278 72 : U8_TRACE_INFO( "sqlite3_step()" );
279 72 : sqlite_err = sqlite3_step( prepared_statement );
280 72 : if ( SQLITE_ROW != sqlite_err )
281 : {
282 : /* Do not log this incident, the caller may not expect to find a row. */
283 31 : U8_TRACE_INFO_STR( "sqlite3_step did not find a row for uuid", uuid );
284 31 : result |= U8_ERROR_NOT_FOUND;
285 : }
286 :
287 72 : if ( SQLITE_ROW == sqlite_err )
288 : {
289 82 : result |= data_classifier_init( out_classifier,
290 41 : sqlite3_column_int64( prepared_statement, RESULT_CLASSIFIER_ID_COLUMN ),
291 41 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_MAIN_TYPE_COLUMN ),
292 41 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_STEREOTYPE_COLUMN ),
293 41 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_NAME_COLUMN ),
294 41 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_DESCRIPTION_COLUMN ),
295 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_X_ORDER_COLUMN ),
296 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_Y_ORDER_COLUMN ),
297 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_LIST_ORDER_COLUMN ),
298 41 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_UUID_COLUMN )
299 : );
300 :
301 41 : data_classifier_trace( out_classifier );
302 :
303 41 : sqlite_err = sqlite3_step( prepared_statement );
304 41 : if ( SQLITE_DONE != sqlite_err )
305 : {
306 0 : U8_LOG_ERROR_INT( "sqlite3_step not done yet:", sqlite_err );
307 0 : result |= U8_ERROR_DB_STRUCTURE;
308 : }
309 : }
310 : }
311 :
312 72 : U8_TRACE_END_ERR( result );
313 72 : return result;
314 : }
315 :
316 145 : u8_error_t data_database_classifier_reader_get_classifiers_by_diagram_id( data_database_classifier_reader_t *this_,
317 : data_row_id_t diagram_id,
318 : uint32_t max_out_array_size,
319 : data_visible_classifier_t (*out_visible_classifier)[],
320 : uint32_t *out_visible_classifier_count )
321 : {
322 145 : U8_TRACE_BEGIN();
323 145 : assert( NULL != out_visible_classifier_count );
324 145 : assert( NULL != out_visible_classifier );
325 145 : u8_error_t result = U8_ERROR_NONE;
326 : int sqlite_err;
327 : sqlite3_stmt *prepared_statement;
328 :
329 : {
330 145 : prepared_statement = (*this_).statement_classifiers_by_diagram_id;
331 :
332 145 : result |= data_database_classifier_reader_private_bind_id_to_statement( this_, prepared_statement, diagram_id );
333 :
334 145 : *out_visible_classifier_count = 0;
335 145 : sqlite_err = SQLITE_ROW;
336 455 : for ( uint32_t row_index = 0; (SQLITE_ROW == sqlite_err) && (row_index <= max_out_array_size); row_index ++ )
337 : {
338 310 : U8_TRACE_INFO( "sqlite3_step()" );
339 310 : sqlite_err = sqlite3_step( prepared_statement );
340 310 : if (( SQLITE_ROW != sqlite_err )&&( SQLITE_DONE != sqlite_err ))
341 : {
342 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
343 0 : result |= U8_ERROR_AT_DB;
344 : }
345 310 : if (( SQLITE_ROW == sqlite_err )&&(row_index < max_out_array_size))
346 : {
347 165 : *out_visible_classifier_count = row_index+1;
348 : data_visible_classifier_t *current_vis_classifier;
349 165 : current_vis_classifier = &((*out_visible_classifier)[row_index]);
350 165 : data_visible_classifier_init_empty( current_vis_classifier );
351 :
352 : data_classifier_t *current_classifier;
353 165 : current_classifier = data_visible_classifier_get_classifier_ptr( current_vis_classifier );
354 165 : data_row_id_t classifier_id = sqlite3_column_int64( prepared_statement, RESULT_CLASSIFIER_ID_COLUMN );
355 330 : result |= data_classifier_reinit( current_classifier,
356 : classifier_id,
357 165 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_MAIN_TYPE_COLUMN ),
358 165 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_STEREOTYPE_COLUMN ),
359 165 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_NAME_COLUMN ),
360 165 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_DESCRIPTION_COLUMN ),
361 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_X_ORDER_COLUMN ),
362 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_Y_ORDER_COLUMN ),
363 : sqlite3_column_int( prepared_statement, RESULT_CLASSIFIER_LIST_ORDER_COLUMN ),
364 165 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_UUID_COLUMN )
365 : );
366 :
367 : data_diagramelement_t *current_diag_element;
368 165 : current_diag_element = data_visible_classifier_get_diagramelement_ptr( current_vis_classifier );
369 165 : result |= data_diagramelement_reinit( current_diag_element,
370 165 : sqlite3_column_int64( prepared_statement, RESULT_CLASSIFIER_DIAGRAMELEMENT_ID_COLUMN ),
371 : diagram_id,
372 : classifier_id,
373 165 : sqlite3_column_int64( prepared_statement, RESULT_CLASSIFIER_DISPLAY_FLAGS_COLUMN ),
374 165 : sqlite3_column_int64( prepared_statement, RESULT_CLASSIFIER_FOCUSED_FEATURE_ID_COLUMN ),
375 165 : (const char*) sqlite3_column_text( prepared_statement, RESULT_CLASSIFIER_DIAGELE_UUID_COLUMN )
376 : );
377 165 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_CLASSIFIER_FOCUSED_FEATURE_ID_COLUMN ) )
378 : {
379 164 : data_diagramelement_set_focused_feature_row_id ( current_diag_element, DATA_ROW_ID_VOID );
380 : }
381 :
382 165 : data_classifier_trace( current_classifier );
383 165 : data_diagramelement_trace( current_diag_element );
384 : }
385 310 : if (( SQLITE_ROW == sqlite_err )&&(row_index >= max_out_array_size))
386 : {
387 2 : U8_LOG_ANOMALY_INT( "out_visible_classifier[] full:", (row_index+1) );
388 2 : result |= U8_ERROR_ARRAY_BUFFER_EXCEEDED;
389 : }
390 310 : if ( SQLITE_DONE == sqlite_err )
391 : {
392 143 : U8_TRACE_INFO( "sqlite3_step finished: SQLITE_DONE" );
393 : }
394 : }
395 : }
396 :
397 145 : U8_TRACE_END_ERR( result );
398 145 : return result;
399 : }
400 :
401 1 : u8_error_t data_database_classifier_reader_get_all_classifiers_iterator( data_database_classifier_reader_t *this_,
402 : bool hierarchical,
403 : data_database_iterator_classifiers_t *io_classifier_iterator
404 : )
405 : {
406 1 : U8_TRACE_BEGIN();
407 1 : assert( NULL != io_classifier_iterator );
408 1 : u8_error_t result = U8_ERROR_NONE;
409 :
410 1 : result |= data_database_iterator_classifiers_reinit( io_classifier_iterator, (*this_).database, hierarchical );
411 :
412 1 : U8_TRACE_END_ERR( result );
413 1 : return result;
414 : }
415 :
416 : /* ================================ FEATURE ================================ */
417 :
418 : /*!
419 : * \brief predefined search statement to find a feature by id
420 : */
421 : static const char DATA_DATABASE_READER_SELECT_FEATURE_BY_ID[] =
422 : "SELECT id,main_type,classifier_id,key,value,description,list_order,uuid "
423 : "FROM features WHERE id=?;";
424 :
425 : /*!
426 : * \brief predefined search statement to find a feature by uuid
427 : */
428 : static const char DATA_DATABASE_READER_SELECT_FEATURE_BY_UUID[] =
429 : "SELECT id,main_type,classifier_id,key,value,description,list_order,uuid "
430 : "FROM features WHERE uuid=?;";
431 :
432 : /*!
433 : * \brief predefined search statement to find features by diagram-id
434 : */
435 : static const char DATA_DATABASE_READER_SELECT_FEATURES_BY_DIAGRAM_ID[] =
436 : "SELECT features.id,features.main_type,features.classifier_id,"
437 : "features.key,features.value,features.description,features.list_order,features.uuid,"
438 : "diagramelements.id " /* diagramelements.id needed only for debugging */
439 : "FROM features INNER JOIN diagramelements ON diagramelements.classifier_id=features.classifier_id "
440 : "WHERE diagramelements.diagram_id=? GROUP BY features.id ORDER BY features.list_order ASC;";
441 :
442 : /*!
443 : * \brief predefined search statement to find features by classifier-id
444 : *
445 : * Order by id to ensure a defined, non-changeing order of relationships in json export
446 : */
447 : static const char DATA_DATABASE_READER_SELECT_FEATURES_BY_CLASSIFIER_ID[] =
448 : "SELECT id,main_type,classifier_id,key,value,description,list_order,uuid "
449 : "FROM features "
450 : "WHERE classifier_id=? ORDER BY id ASC;";
451 :
452 : /*!
453 : * \brief the column id of the result where this parameter is stored: id
454 : */
455 : static const int RESULT_FEATURE_ID_COLUMN = 0;
456 :
457 : /*!
458 : * \brief the column id of the result where this parameter is stored: main_type
459 : */
460 : static const int RESULT_FEATURE_MAIN_TYPE_COLUMN = 1;
461 :
462 : /*!
463 : * \brief the column id of the result where this parameter is stored: classifier_id
464 : */
465 : static const int RESULT_FEATURE_CLASSIFIER_ID_COLUMN = 2;
466 :
467 : /*!
468 : * \brief the column id of the result where this parameter is stored: key
469 : */
470 : static const int RESULT_FEATURE_KEY_COLUMN = 3;
471 :
472 : /*!
473 : * \brief the column id of the result where this parameter is stored: value
474 : */
475 : static const int RESULT_FEATURE_VALUE_COLUMN = 4;
476 :
477 : /*!
478 : * \brief the column id of the result where this parameter is stored: description
479 : */
480 : static const int RESULT_FEATURE_DESCRIPTION_COLUMN = 5;
481 :
482 : /*!
483 : * \brief the column id of the result where this parameter is stored: list_order
484 : */
485 : static const int RESULT_FEATURE_LIST_ORDER_COLUMN = 6;
486 :
487 : /*!
488 : * \brief the column id of the result where this parameter is stored: uuid
489 : */
490 : static const int RESULT_FEATURE_LIST_UUID_COLUMN = 7;
491 :
492 : /*!
493 : * \brief the column id of the result where this parameter is stored: diagramelements.id
494 : */
495 : static const int RESULT_FEATURE_DIAGRAMELEMENTS_ID_COLUMN = 8;
496 :
497 31 : u8_error_t data_database_classifier_reader_get_feature_by_id ( data_database_classifier_reader_t *this_,
498 : data_row_id_t id,
499 : data_feature_t *out_feature )
500 : {
501 31 : U8_TRACE_BEGIN();
502 31 : assert( NULL != out_feature );
503 31 : u8_error_t result = U8_ERROR_NONE;
504 : int sqlite_err;
505 : sqlite3_stmt *prepared_statement;
506 :
507 : {
508 31 : prepared_statement = (*this_).statement_feature_by_id;
509 :
510 31 : result |= data_database_classifier_reader_private_bind_id_to_statement( this_, prepared_statement, id );
511 :
512 31 : U8_TRACE_INFO( "sqlite3_step()" );
513 31 : sqlite_err = sqlite3_step( prepared_statement );
514 31 : if ( SQLITE_ROW != sqlite_err )
515 : {
516 5 : U8_TRACE_INFO_INT( "sqlite3_step did not find a row for id", id );
517 5 : result |= U8_ERROR_DB_STRUCTURE; /* non-existing ids are worse than U8_ERROR_NOT_FOUND */
518 : }
519 :
520 31 : if ( SQLITE_ROW == sqlite_err )
521 : {
522 52 : result |= data_feature_init( out_feature,
523 26 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_ID_COLUMN ),
524 26 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_MAIN_TYPE_COLUMN ),
525 26 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_CLASSIFIER_ID_COLUMN ),
526 26 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_KEY_COLUMN ),
527 26 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_VALUE_COLUMN ),
528 26 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_DESCRIPTION_COLUMN ),
529 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_LIST_ORDER_COLUMN ),
530 26 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_LIST_UUID_COLUMN )
531 : );
532 :
533 26 : data_feature_trace( out_feature );
534 :
535 26 : sqlite_err = sqlite3_step( prepared_statement );
536 26 : if ( SQLITE_DONE != sqlite_err )
537 : {
538 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
539 0 : result |= U8_ERROR_DB_STRUCTURE;
540 : }
541 : }
542 : }
543 :
544 31 : U8_TRACE_END_ERR( result );
545 31 : return result;
546 : }
547 :
548 35 : u8_error_t data_database_classifier_reader_get_feature_by_uuid ( data_database_classifier_reader_t *this_,
549 : const char *uuid,
550 : data_feature_t *out_feature )
551 : {
552 35 : U8_TRACE_BEGIN();
553 35 : assert( NULL != uuid );
554 35 : assert( NULL != out_feature );
555 35 : u8_error_t result = U8_ERROR_NONE;
556 : int sqlite_err;
557 : sqlite3_stmt *prepared_statement;
558 :
559 : {
560 35 : prepared_statement = (*this_).statement_feature_by_uuid;
561 :
562 35 : result |= data_database_classifier_reader_private_bind_text_to_statement( this_, prepared_statement, uuid );
563 :
564 35 : U8_TRACE_INFO( "sqlite3_step()" );
565 35 : sqlite_err = sqlite3_step( prepared_statement );
566 35 : if ( SQLITE_ROW != sqlite_err )
567 : {
568 : /* Do not log this incident, the caller may not expect to find a row. */
569 27 : U8_TRACE_INFO_STR( "sqlite3_step did not find a row for uuid", uuid );
570 27 : result |= U8_ERROR_NOT_FOUND;
571 : }
572 :
573 35 : if ( SQLITE_ROW == sqlite_err )
574 : {
575 16 : result |= data_feature_init( out_feature,
576 8 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_ID_COLUMN ),
577 8 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_MAIN_TYPE_COLUMN ),
578 8 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_CLASSIFIER_ID_COLUMN ),
579 8 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_KEY_COLUMN ),
580 8 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_VALUE_COLUMN ),
581 8 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_DESCRIPTION_COLUMN ),
582 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_LIST_ORDER_COLUMN ),
583 8 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_LIST_UUID_COLUMN )
584 : );
585 :
586 8 : data_feature_trace( out_feature );
587 :
588 8 : sqlite_err = sqlite3_step( prepared_statement );
589 8 : if ( SQLITE_DONE != sqlite_err )
590 : {
591 0 : U8_LOG_ERROR_INT( "sqlite3_step not done yet:", sqlite_err );
592 0 : result |= U8_ERROR_DB_STRUCTURE;
593 : }
594 : }
595 : }
596 :
597 35 : U8_TRACE_END_ERR( result );
598 35 : return result;
599 : }
600 :
601 16 : u8_error_t data_database_classifier_reader_get_features_by_classifier_id ( data_database_classifier_reader_t *this_,
602 : data_row_id_t classifier_id,
603 : uint32_t max_out_array_size,
604 : data_feature_t (*out_feature)[],
605 : uint32_t *out_feature_count )
606 : {
607 16 : U8_TRACE_BEGIN();
608 16 : assert( NULL != out_feature_count );
609 16 : assert( NULL != out_feature );
610 16 : u8_error_t result = U8_ERROR_NONE;
611 : int sqlite_err;
612 : sqlite3_stmt *prepared_statement;
613 :
614 : {
615 16 : prepared_statement = (*this_).statement_features_by_classifier_id;
616 :
617 16 : result |= data_database_classifier_reader_private_bind_id_to_statement( this_, prepared_statement, classifier_id );
618 :
619 16 : *out_feature_count = 0;
620 16 : sqlite_err = SQLITE_ROW;
621 104 : for ( uint32_t row_index = 0; (SQLITE_ROW == sqlite_err) && (row_index <= max_out_array_size); row_index ++ )
622 : {
623 88 : U8_TRACE_INFO( "sqlite3_step()" );
624 88 : sqlite_err = sqlite3_step( prepared_statement );
625 88 : if (( SQLITE_ROW != sqlite_err )&&( SQLITE_DONE != sqlite_err ))
626 : {
627 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
628 0 : result |= U8_ERROR_AT_DB;
629 : }
630 88 : if (( SQLITE_ROW == sqlite_err )&&(row_index < max_out_array_size))
631 : {
632 72 : *out_feature_count = row_index+1;
633 : data_feature_t *current_feature;
634 72 : current_feature = &((*out_feature)[row_index]);
635 :
636 144 : result |= data_feature_init( current_feature,
637 72 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_ID_COLUMN ),
638 72 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_MAIN_TYPE_COLUMN ),
639 72 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_CLASSIFIER_ID_COLUMN ),
640 72 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_KEY_COLUMN ),
641 72 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_VALUE_COLUMN ),
642 72 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_DESCRIPTION_COLUMN ),
643 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_LIST_ORDER_COLUMN ),
644 72 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_LIST_UUID_COLUMN )
645 : );
646 :
647 72 : data_feature_trace( current_feature );
648 : }
649 88 : if (( SQLITE_ROW == sqlite_err )&&(row_index >= max_out_array_size))
650 : {
651 1 : U8_LOG_ANOMALY_INT( "out_feature[] full:", (row_index+1) );
652 1 : result |= U8_ERROR_ARRAY_BUFFER_EXCEEDED;
653 : }
654 88 : if ( SQLITE_DONE == sqlite_err )
655 : {
656 15 : U8_TRACE_INFO( "sqlite3_step finished: SQLITE_DONE" );
657 : }
658 : }
659 : }
660 :
661 16 : U8_TRACE_END_ERR( result );
662 16 : return result;
663 : }
664 :
665 7 : u8_error_t data_database_classifier_reader_get_features_by_diagram_id ( data_database_classifier_reader_t *this_,
666 : data_row_id_t diagram_id,
667 : uint32_t max_out_array_size,
668 : data_feature_t (*out_feature)[],
669 : uint32_t *out_feature_count )
670 : {
671 7 : U8_TRACE_BEGIN();
672 7 : assert( NULL != out_feature_count );
673 7 : assert( NULL != out_feature );
674 7 : u8_error_t result = U8_ERROR_NONE;
675 : int sqlite_err;
676 : sqlite3_stmt *prepared_statement;
677 :
678 : {
679 7 : prepared_statement = (*this_).statement_features_by_diagram_id;
680 :
681 7 : result |= data_database_classifier_reader_private_bind_id_to_statement( this_, prepared_statement, diagram_id );
682 :
683 7 : *out_feature_count = 0;
684 7 : sqlite_err = SQLITE_ROW;
685 276 : for ( uint32_t row_index = 0; (SQLITE_ROW == sqlite_err) && (row_index <= max_out_array_size); row_index ++ )
686 : {
687 269 : U8_TRACE_INFO( "sqlite3_step()" );
688 269 : sqlite_err = sqlite3_step( prepared_statement );
689 269 : if (( SQLITE_ROW != sqlite_err )&&( SQLITE_DONE != sqlite_err ))
690 : {
691 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
692 0 : result |= U8_ERROR_AT_DB;
693 : }
694 269 : if (( SQLITE_ROW == sqlite_err )&&(row_index < max_out_array_size))
695 : {
696 262 : *out_feature_count = row_index+1;
697 : data_feature_t *current_feature;
698 262 : current_feature = &((*out_feature)[row_index]);
699 :
700 524 : result |= data_feature_init( current_feature,
701 262 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_ID_COLUMN ),
702 262 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_MAIN_TYPE_COLUMN ),
703 262 : sqlite3_column_int64( prepared_statement, RESULT_FEATURE_CLASSIFIER_ID_COLUMN ),
704 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_KEY_COLUMN ),
705 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_VALUE_COLUMN ),
706 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_DESCRIPTION_COLUMN ),
707 : sqlite3_column_int( prepared_statement, RESULT_FEATURE_LIST_ORDER_COLUMN ),
708 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_FEATURE_LIST_UUID_COLUMN )
709 : );
710 :
711 262 : U8_TRACE_INFO_INT( "diagramelements.id:", sqlite3_column_int64( prepared_statement, RESULT_FEATURE_DIAGRAMELEMENTS_ID_COLUMN ) );
712 262 : data_feature_trace( current_feature );
713 : }
714 269 : if (( SQLITE_ROW == sqlite_err )&&(row_index >= max_out_array_size))
715 : {
716 1 : U8_LOG_ANOMALY_INT( "out_feature[] full:", (row_index+1) );
717 1 : result |= U8_ERROR_ARRAY_BUFFER_EXCEEDED;
718 : }
719 269 : if ( SQLITE_DONE == sqlite_err )
720 : {
721 6 : U8_TRACE_INFO( "sqlite3_step finished: SQLITE_DONE" );
722 : }
723 : }
724 : }
725 :
726 7 : U8_TRACE_END_ERR( result );
727 7 : return result;
728 : }
729 :
730 : /* ================================ RELATIONSHIP ================================ */
731 :
732 : /*!
733 : * \brief predefined search statement to find a relationship by id
734 : */
735 : static const char DATA_DATABASE_READER_SELECT_RELATIONSHIP_BY_ID[] =
736 : "SELECT id,main_type,from_classifier_id,to_classifier_id,stereotype,name,description,list_order,"
737 : "from_feature_id,to_feature_id,uuid "
738 : "FROM relationships WHERE id=?;";
739 :
740 : /*!
741 : * \brief predefined search statement to find a relationship by uuid
742 : */
743 : static const char DATA_DATABASE_READER_SELECT_RELATIONSHIP_BY_UUID[] =
744 : "SELECT id,main_type,from_classifier_id,to_classifier_id,stereotype,name,description,list_order,"
745 : "from_feature_id,to_feature_id,uuid "
746 : "FROM relationships WHERE uuid=?;";
747 :
748 : /*!
749 : * \brief predefined search statement to find relationships by diagram-id
750 : */
751 : static const char DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_DIAGRAM_ID[] =
752 : "SELECT relationships.id,relationships.main_type,relationships.from_classifier_id,relationships.to_classifier_id,"
753 : "relationships.stereotype,relationships.name,relationships.description,relationships.list_order,"
754 : "relationships.from_feature_id,relationships.to_feature_id,relationships.uuid,"
755 : "source.id, dest.id " /* source.id, dest.id needed only for debugging */
756 : "FROM relationships "
757 : "INNER JOIN diagramelements AS source "
758 : "ON source.classifier_id=relationships.from_classifier_id "
759 : "INNER JOIN diagramelements AS dest "
760 : "ON (dest.classifier_id=relationships.to_classifier_id)AND(dest.diagram_id=source.diagram_id) "
761 : "WHERE source.diagram_id=? "
762 : "GROUP BY relationships.id "
763 : "ORDER BY relationships.list_order ASC;";
764 :
765 : /*!
766 : * \brief predefined search statement to find relationships by classifier-id
767 : *
768 : * Order by id to ensure a defined, non-changeing order of relationships in json export
769 : */
770 : static const char DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_CLASSIFIER_ID[] =
771 : "SELECT id,main_type,from_classifier_id,to_classifier_id,stereotype,name,description,list_order,"
772 : "from_feature_id,to_feature_id,uuid "
773 : "FROM relationships "
774 : "WHERE from_classifier_id=? OR to_classifier_id=? "
775 : "ORDER BY id ASC;";
776 :
777 : /*!
778 : * \brief predefined search statement to find relationships by feature-id
779 : */
780 : static const char DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_FEATURE_ID[] =
781 : "SELECT id,main_type,from_classifier_id,to_classifier_id,stereotype,name,description,list_order,"
782 : "from_feature_id,to_feature_id,uuid "
783 : "FROM relationships "
784 : "WHERE from_feature_id=? OR to_feature_id=?;";
785 :
786 : /*!
787 : * \brief the column id of the result where this parameter is stored: id
788 : */
789 : static const int RESULT_RELATIONSHIP_ID_COLUMN = 0;
790 :
791 : /*!
792 : * \brief the column id of the result where this parameter is stored: main_type
793 : */
794 : static const int RESULT_RELATIONSHIP_MAIN_TYPE_COLUMN = 1;
795 :
796 : /*!
797 : * \brief the column id of the result where this parameter is stored: from_classifier_id
798 : */
799 : static const int RESULT_RELATIONSHIP_FROM_CLASSIFIER_ID_COLUMN = 2;
800 :
801 : /*!
802 : * \brief the column id of the result where this parameter is stored: to_classifier_id
803 : */
804 : static const int RESULT_RELATIONSHIP_TO_CLASSIFIER_ID_COLUMN = 3;
805 :
806 : /*!
807 : * \brief the column id of the result where this parameter is stored: name
808 : */
809 : static const int RESULT_RELATIONSHIP_STEREOTYPE_COLUMN = 4;
810 :
811 : /*!
812 : * \brief the column id of the result where this parameter is stored: name
813 : */
814 : static const int RESULT_RELATIONSHIP_NAME_COLUMN = 5;
815 :
816 : /*!
817 : * \brief the column id of the result where this parameter is stored: description
818 : */
819 : static const int RESULT_RELATIONSHIP_DESCRIPTION_COLUMN = 6;
820 :
821 : /*!
822 : * \brief the column id of the result where this parameter is stored: list_order
823 : */
824 : static const int RESULT_RELATIONSHIP_LIST_ORDER_COLUMN = 7;
825 :
826 : /*!
827 : * \brief the column id of the result where this parameter is stored: from_feature_id
828 : */
829 : static const int RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN = 8;
830 :
831 : /*!
832 : * \brief the column id of the result where this parameter is stored: to_feature_id
833 : */
834 : static const int RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN = 9;
835 :
836 : /*!
837 : * \brief the column id of the result where this parameter is stored: uuid
838 : */
839 : static const int RESULT_RELATIONSHIP_UUID_COLUMN = 10;
840 :
841 : /*!
842 : * \brief the column id of the result where this parameter is stored: source diagramelements.id
843 : */
844 : static const int RESULT_RELATIONSHIP_SOURCE_DIAGRAMELEMENTS_ID_COLUMN = 11;
845 :
846 : /*!
847 : * \brief the column id of the result where this parameter is stored: dest diagramelements.id
848 : */
849 : static const int RESULT_RELATIONSHIP_DEST_DIAGRAMELEMENTS_ID_COLUMN = 12;
850 :
851 25 : u8_error_t data_database_classifier_reader_get_relationship_by_id ( data_database_classifier_reader_t *this_,
852 : data_row_id_t id,
853 : data_relationship_t *out_relationship )
854 : {
855 25 : U8_TRACE_BEGIN();
856 25 : assert( NULL != out_relationship );
857 25 : u8_error_t result = U8_ERROR_NONE;
858 : int sqlite_err;
859 : sqlite3_stmt *prepared_statement;
860 :
861 : {
862 25 : prepared_statement = (*this_).statement_relationship_by_id;
863 :
864 25 : result |= data_database_classifier_reader_private_bind_id_to_statement( this_, prepared_statement, id );
865 :
866 25 : U8_TRACE_INFO( "sqlite3_step()" );
867 25 : sqlite_err = sqlite3_step( prepared_statement );
868 25 : if ( SQLITE_ROW != sqlite_err )
869 : {
870 7 : U8_TRACE_INFO_INT( "sqlite3_step did not find a row for id", id );
871 7 : result |= U8_ERROR_DB_STRUCTURE; /* non-existing ids are worse than U8_ERROR_NOT_FOUND */
872 : }
873 :
874 25 : if ( SQLITE_ROW == sqlite_err )
875 : {
876 36 : result |= data_relationship_init( out_relationship,
877 18 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_ID_COLUMN ),
878 18 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_CLASSIFIER_ID_COLUMN ),
879 18 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ),
880 18 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_CLASSIFIER_ID_COLUMN ),
881 18 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ),
882 18 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_MAIN_TYPE_COLUMN ),
883 18 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_STEREOTYPE_COLUMN ),
884 18 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_NAME_COLUMN ),
885 18 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_DESCRIPTION_COLUMN ),
886 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_LIST_ORDER_COLUMN ),
887 18 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_UUID_COLUMN )
888 : );
889 18 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ) )
890 : {
891 15 : data_relationship_set_from_feature_row_id ( out_relationship, DATA_ROW_ID_VOID );
892 : }
893 18 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ) )
894 : {
895 2 : data_relationship_set_to_feature_row_id ( out_relationship, DATA_ROW_ID_VOID );
896 : }
897 :
898 18 : data_relationship_trace( out_relationship );
899 :
900 18 : sqlite_err = sqlite3_step( prepared_statement );
901 18 : if ( SQLITE_DONE != sqlite_err )
902 : {
903 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
904 0 : result |= U8_ERROR_DB_STRUCTURE;
905 : }
906 : }
907 : }
908 :
909 25 : U8_TRACE_END_ERR( result );
910 25 : return result;
911 : }
912 :
913 9 : u8_error_t data_database_classifier_reader_get_relationship_by_uuid ( data_database_classifier_reader_t *this_,
914 : const char *uuid,
915 : data_relationship_t *out_relationship )
916 : {
917 9 : U8_TRACE_BEGIN();
918 9 : assert( NULL != uuid );
919 9 : assert( NULL != out_relationship );
920 9 : u8_error_t result = U8_ERROR_NONE;
921 : int sqlite_err;
922 : sqlite3_stmt *prepared_statement;
923 :
924 : {
925 9 : prepared_statement = (*this_).statement_relationship_by_uuid;
926 :
927 9 : result |= data_database_classifier_reader_private_bind_text_to_statement( this_, prepared_statement, uuid );
928 :
929 9 : U8_TRACE_INFO( "sqlite3_step()" );
930 9 : sqlite_err = sqlite3_step( prepared_statement );
931 9 : if ( SQLITE_ROW != sqlite_err )
932 : {
933 : /* Do not log this incident, the caller may not expect to find a row. */
934 7 : U8_TRACE_INFO_STR( "sqlite3_step did not find a row for uuid", uuid );
935 7 : result |= U8_ERROR_NOT_FOUND;
936 : }
937 :
938 9 : if ( SQLITE_ROW == sqlite_err )
939 : {
940 4 : result |= data_relationship_init( out_relationship,
941 2 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_ID_COLUMN ),
942 2 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_CLASSIFIER_ID_COLUMN ),
943 2 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ),
944 2 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_CLASSIFIER_ID_COLUMN ),
945 2 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ),
946 2 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_MAIN_TYPE_COLUMN ),
947 2 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_STEREOTYPE_COLUMN ),
948 2 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_NAME_COLUMN ),
949 2 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_DESCRIPTION_COLUMN ),
950 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_LIST_ORDER_COLUMN ),
951 2 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_UUID_COLUMN )
952 : );
953 2 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ) )
954 : {
955 1 : data_relationship_set_from_feature_row_id ( out_relationship, DATA_ROW_ID_VOID );
956 : }
957 2 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ) )
958 : {
959 1 : data_relationship_set_to_feature_row_id ( out_relationship, DATA_ROW_ID_VOID );
960 : }
961 :
962 2 : data_relationship_trace( out_relationship );
963 :
964 2 : sqlite_err = sqlite3_step( prepared_statement );
965 2 : if ( SQLITE_DONE != sqlite_err )
966 : {
967 0 : U8_LOG_ERROR_INT( "sqlite3_step not done yet:", sqlite_err );
968 0 : result |= U8_ERROR_DB_STRUCTURE;
969 : }
970 : }
971 : }
972 :
973 9 : U8_TRACE_END_ERR( result );
974 9 : return result;
975 : }
976 :
977 16 : u8_error_t data_database_classifier_reader_get_relationships_by_classifier_id ( data_database_classifier_reader_t *this_,
978 : data_row_id_t classifier_id,
979 : uint32_t max_out_array_size,
980 : data_relationship_t (*out_relationship)[],
981 : uint32_t *out_relationship_count )
982 : {
983 16 : U8_TRACE_BEGIN();
984 16 : assert( NULL != out_relationship_count );
985 16 : assert( NULL != out_relationship );
986 16 : u8_error_t result = U8_ERROR_NONE;
987 : int sqlite_err;
988 : sqlite3_stmt *prepared_statement;
989 :
990 : {
991 16 : prepared_statement = (*this_).statement_relationships_by_classifier_id;
992 :
993 16 : result |= data_database_classifier_reader_private_bind_two_ids_to_statement( this_, prepared_statement, classifier_id, classifier_id );
994 :
995 16 : *out_relationship_count = 0;
996 16 : sqlite_err = SQLITE_ROW;
997 294 : for ( uint32_t row_index = 0; (SQLITE_ROW == sqlite_err) && (row_index <= max_out_array_size); row_index ++ )
998 : {
999 278 : U8_TRACE_INFO( "sqlite3_step()" );
1000 278 : sqlite_err = sqlite3_step( prepared_statement );
1001 278 : if (( SQLITE_ROW != sqlite_err )&&( SQLITE_DONE != sqlite_err ))
1002 : {
1003 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
1004 0 : result |= U8_ERROR_AT_DB;
1005 : }
1006 278 : if (( SQLITE_ROW == sqlite_err )&&(row_index < max_out_array_size))
1007 : {
1008 262 : *out_relationship_count = row_index+1;
1009 : data_relationship_t *current_relation;
1010 262 : current_relation = &((*out_relationship)[row_index]);
1011 :
1012 524 : result |= data_relationship_init( current_relation,
1013 262 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_ID_COLUMN ),
1014 262 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_CLASSIFIER_ID_COLUMN ),
1015 262 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ),
1016 262 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_CLASSIFIER_ID_COLUMN ),
1017 262 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ),
1018 262 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_MAIN_TYPE_COLUMN ),
1019 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_STEREOTYPE_COLUMN ),
1020 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_NAME_COLUMN ),
1021 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_DESCRIPTION_COLUMN ),
1022 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_LIST_ORDER_COLUMN ),
1023 262 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_UUID_COLUMN )
1024 : );
1025 262 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ) )
1026 : {
1027 258 : data_relationship_set_from_feature_row_id ( current_relation, DATA_ROW_ID_VOID );
1028 : }
1029 262 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ) )
1030 : {
1031 260 : data_relationship_set_to_feature_row_id ( current_relation, DATA_ROW_ID_VOID );
1032 : }
1033 :
1034 262 : data_relationship_trace( current_relation );
1035 : }
1036 278 : if (( SQLITE_ROW == sqlite_err )&&(row_index >= max_out_array_size))
1037 : {
1038 1 : U8_LOG_ANOMALY_INT( "out_relationship[] full:", (row_index+1) );
1039 1 : result |= U8_ERROR_ARRAY_BUFFER_EXCEEDED;
1040 : }
1041 278 : if ( SQLITE_DONE == sqlite_err )
1042 : {
1043 15 : U8_TRACE_INFO( "sqlite3_step finished: SQLITE_DONE" );
1044 : }
1045 : }
1046 : }
1047 :
1048 16 : U8_TRACE_END_ERR( result );
1049 16 : return result;
1050 : }
1051 :
1052 11 : u8_error_t data_database_classifier_reader_get_relationships_by_feature_id ( data_database_classifier_reader_t *this_,
1053 : data_row_id_t feature_id,
1054 : uint32_t max_out_array_size,
1055 : data_relationship_t (*out_relationship)[],
1056 : uint32_t *out_relationship_count )
1057 : {
1058 11 : U8_TRACE_BEGIN();
1059 11 : assert( NULL != out_relationship_count );
1060 11 : assert( NULL != out_relationship );
1061 11 : u8_error_t result = U8_ERROR_NONE;
1062 : int sqlite_err;
1063 : sqlite3_stmt *prepared_statement;
1064 :
1065 : {
1066 11 : prepared_statement = (*this_).statement_relationships_by_feature_id;
1067 :
1068 11 : result |= data_database_classifier_reader_private_bind_two_ids_to_statement( this_, prepared_statement, feature_id, feature_id );
1069 :
1070 11 : *out_relationship_count = 0;
1071 11 : sqlite_err = SQLITE_ROW;
1072 23 : for ( uint32_t row_index = 0; (SQLITE_ROW == sqlite_err) && (row_index <= max_out_array_size); row_index ++ )
1073 : {
1074 12 : U8_TRACE_INFO( "sqlite3_step()" );
1075 12 : sqlite_err = sqlite3_step( prepared_statement );
1076 12 : if (( SQLITE_ROW != sqlite_err )&&( SQLITE_DONE != sqlite_err ))
1077 : {
1078 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
1079 0 : result |= U8_ERROR_AT_DB;
1080 : }
1081 12 : if (( SQLITE_ROW == sqlite_err )&&(row_index < max_out_array_size))
1082 : {
1083 1 : *out_relationship_count = row_index+1;
1084 : data_relationship_t *current_relation;
1085 1 : current_relation = &((*out_relationship)[row_index]);
1086 :
1087 2 : result |= data_relationship_init( current_relation,
1088 1 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_ID_COLUMN ),
1089 1 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_CLASSIFIER_ID_COLUMN ),
1090 1 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ),
1091 1 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_CLASSIFIER_ID_COLUMN ),
1092 1 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ),
1093 1 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_MAIN_TYPE_COLUMN ),
1094 1 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_STEREOTYPE_COLUMN ),
1095 1 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_NAME_COLUMN ),
1096 1 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_DESCRIPTION_COLUMN ),
1097 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_LIST_ORDER_COLUMN ),
1098 1 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_UUID_COLUMN )
1099 : );
1100 1 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ) )
1101 : {
1102 0 : data_relationship_set_from_feature_row_id ( current_relation, DATA_ROW_ID_VOID );
1103 : }
1104 1 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ) )
1105 : {
1106 1 : data_relationship_set_to_feature_row_id ( current_relation, DATA_ROW_ID_VOID );
1107 : }
1108 :
1109 1 : data_relationship_trace( current_relation );
1110 : }
1111 12 : if (( SQLITE_ROW == sqlite_err )&&(row_index >= max_out_array_size))
1112 : {
1113 0 : U8_LOG_ANOMALY_INT( "out_relationship[] full:", (row_index+1) );
1114 0 : result |= U8_ERROR_ARRAY_BUFFER_EXCEEDED;
1115 : }
1116 12 : if ( SQLITE_DONE == sqlite_err )
1117 : {
1118 11 : U8_TRACE_INFO( "sqlite3_step finished: SQLITE_DONE" );
1119 : }
1120 : }
1121 : }
1122 :
1123 11 : U8_TRACE_END_ERR( result );
1124 11 : return result;
1125 : }
1126 :
1127 7 : u8_error_t data_database_classifier_reader_get_relationships_by_diagram_id ( data_database_classifier_reader_t *this_,
1128 : data_row_id_t diagram_id,
1129 : uint32_t max_out_array_size,
1130 : data_relationship_t (*out_relationship)[],
1131 : uint32_t *out_relationship_count )
1132 : {
1133 7 : U8_TRACE_BEGIN();
1134 7 : assert( NULL != out_relationship_count );
1135 7 : assert( NULL != out_relationship );
1136 7 : u8_error_t result = U8_ERROR_NONE;
1137 : int sqlite_err;
1138 : sqlite3_stmt *prepared_statement;
1139 :
1140 : {
1141 7 : prepared_statement = (*this_).statement_relationships_by_diagram_id;
1142 :
1143 7 : result |= data_database_classifier_reader_private_bind_id_to_statement( this_, prepared_statement, diagram_id );
1144 :
1145 7 : *out_relationship_count = 0;
1146 7 : sqlite_err = SQLITE_ROW;
1147 1043 : for ( uint32_t row_index = 0; (SQLITE_ROW == sqlite_err) && (row_index <= max_out_array_size); row_index ++ )
1148 : {
1149 1036 : U8_TRACE_INFO( "sqlite3_step()" );
1150 1036 : sqlite_err = sqlite3_step( prepared_statement );
1151 1036 : if (( SQLITE_ROW != sqlite_err )&&( SQLITE_DONE != sqlite_err ))
1152 : {
1153 0 : U8_LOG_ERROR_INT( "sqlite3_step failed:", sqlite_err );
1154 0 : result |= U8_ERROR_AT_DB;
1155 : }
1156 1036 : if (( SQLITE_ROW == sqlite_err )&&(row_index < max_out_array_size))
1157 : {
1158 1029 : *out_relationship_count = row_index+1;
1159 : data_relationship_t *current_relation;
1160 1029 : current_relation = &((*out_relationship)[row_index]);
1161 :
1162 2058 : result |= data_relationship_init( current_relation,
1163 1029 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_ID_COLUMN ),
1164 1029 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_CLASSIFIER_ID_COLUMN ),
1165 1029 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ),
1166 1029 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_CLASSIFIER_ID_COLUMN ),
1167 1029 : sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ),
1168 1029 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_MAIN_TYPE_COLUMN ),
1169 1029 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_STEREOTYPE_COLUMN ),
1170 1029 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_NAME_COLUMN ),
1171 1029 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_DESCRIPTION_COLUMN ),
1172 : sqlite3_column_int( prepared_statement, RESULT_RELATIONSHIP_LIST_ORDER_COLUMN ),
1173 1029 : (const char*) sqlite3_column_text( prepared_statement, RESULT_RELATIONSHIP_UUID_COLUMN )
1174 : );
1175 1029 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_FROM_FEATURE_ID_COLUMN ) )
1176 : {
1177 1026 : data_relationship_set_from_feature_row_id ( current_relation, DATA_ROW_ID_VOID );
1178 : }
1179 1029 : if ( SQLITE_NULL == sqlite3_column_type( prepared_statement, RESULT_RELATIONSHIP_TO_FEATURE_ID_COLUMN ) )
1180 : {
1181 1027 : data_relationship_set_to_feature_row_id ( current_relation, DATA_ROW_ID_VOID );
1182 : }
1183 :
1184 1029 : U8_TRACE_INFO_INT( "(source)diagramelements.id:", sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_SOURCE_DIAGRAMELEMENTS_ID_COLUMN ) );
1185 1029 : U8_TRACE_INFO_INT( "(dest)diagramelements.id:", sqlite3_column_int64( prepared_statement, RESULT_RELATIONSHIP_DEST_DIAGRAMELEMENTS_ID_COLUMN ) );
1186 1029 : data_relationship_trace( current_relation );
1187 : }
1188 1036 : if (( SQLITE_ROW == sqlite_err )&&(row_index >= max_out_array_size))
1189 : {
1190 1 : U8_LOG_ANOMALY_INT( "out_relationship[] full:", (row_index+1) );
1191 1 : result |= U8_ERROR_ARRAY_BUFFER_EXCEEDED;
1192 : }
1193 1036 : if ( SQLITE_DONE == sqlite_err )
1194 : {
1195 6 : U8_TRACE_INFO( "sqlite3_step finished: SQLITE_DONE" );
1196 : }
1197 : }
1198 : }
1199 :
1200 7 : U8_TRACE_END_ERR( result );
1201 7 : return result;
1202 : }
1203 :
1204 : /* ================================ private ================================ */
1205 :
1206 99 : u8_error_t data_database_classifier_reader_private_open ( data_database_classifier_reader_t *this_ )
1207 : {
1208 99 : U8_TRACE_BEGIN();
1209 99 : u8_error_t result = U8_ERROR_NONE;
1210 :
1211 : {
1212 99 : result |= data_database_prepare_statement( (*this_).database,
1213 : DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_ID,
1214 : sizeof( DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_ID ),
1215 : &((*this_).statement_classifier_by_id)
1216 : );
1217 :
1218 99 : result |= data_database_prepare_statement( (*this_).database,
1219 : DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_UUID,
1220 : sizeof( DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_UUID ),
1221 : &((*this_).statement_classifier_by_uuid)
1222 : );
1223 :
1224 99 : result |= data_database_prepare_statement( (*this_).database,
1225 : DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_NAME,
1226 : sizeof( DATA_DATABASE_READER_SELECT_CLASSIFIER_BY_NAME ),
1227 : &((*this_).statement_classifier_by_name)
1228 : );
1229 :
1230 99 : result |= data_database_prepare_statement( (*this_).database,
1231 : DATA_DATABASE_READER_SELECT_CLASSIFIERS_BY_DIAGRAM_ID,
1232 : sizeof( DATA_DATABASE_READER_SELECT_CLASSIFIERS_BY_DIAGRAM_ID ),
1233 : &((*this_).statement_classifiers_by_diagram_id)
1234 : );
1235 :
1236 99 : result |= data_database_prepare_statement( (*this_).database,
1237 : DATA_DATABASE_READER_SELECT_FEATURE_BY_ID,
1238 : sizeof( DATA_DATABASE_READER_SELECT_FEATURE_BY_ID ),
1239 : &((*this_).statement_feature_by_id)
1240 : );
1241 :
1242 99 : result |= data_database_prepare_statement( (*this_).database,
1243 : DATA_DATABASE_READER_SELECT_FEATURE_BY_UUID,
1244 : sizeof( DATA_DATABASE_READER_SELECT_FEATURE_BY_UUID ),
1245 : &((*this_).statement_feature_by_uuid)
1246 : );
1247 :
1248 99 : result |= data_database_prepare_statement( (*this_).database,
1249 : DATA_DATABASE_READER_SELECT_FEATURES_BY_CLASSIFIER_ID,
1250 : sizeof( DATA_DATABASE_READER_SELECT_FEATURES_BY_CLASSIFIER_ID ),
1251 : &((*this_).statement_features_by_classifier_id)
1252 : );
1253 :
1254 99 : result |= data_database_prepare_statement( (*this_).database,
1255 : DATA_DATABASE_READER_SELECT_FEATURES_BY_DIAGRAM_ID,
1256 : sizeof( DATA_DATABASE_READER_SELECT_FEATURES_BY_DIAGRAM_ID ),
1257 : &((*this_).statement_features_by_diagram_id)
1258 : );
1259 :
1260 99 : result |= data_database_prepare_statement( (*this_).database,
1261 : DATA_DATABASE_READER_SELECT_RELATIONSHIP_BY_ID,
1262 : sizeof( DATA_DATABASE_READER_SELECT_RELATIONSHIP_BY_ID ),
1263 : &((*this_).statement_relationship_by_id)
1264 : );
1265 :
1266 99 : result |= data_database_prepare_statement( (*this_).database,
1267 : DATA_DATABASE_READER_SELECT_RELATIONSHIP_BY_UUID,
1268 : sizeof( DATA_DATABASE_READER_SELECT_RELATIONSHIP_BY_UUID ),
1269 : &((*this_).statement_relationship_by_uuid)
1270 : );
1271 :
1272 99 : result |= data_database_prepare_statement( (*this_).database,
1273 : DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_CLASSIFIER_ID,
1274 : sizeof( DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_CLASSIFIER_ID ),
1275 : &((*this_).statement_relationships_by_classifier_id)
1276 : );
1277 :
1278 99 : result |= data_database_prepare_statement( (*this_).database,
1279 : DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_FEATURE_ID,
1280 : sizeof( DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_FEATURE_ID ),
1281 : &((*this_).statement_relationships_by_feature_id)
1282 : );
1283 :
1284 99 : result |= data_database_prepare_statement( (*this_).database,
1285 : DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_DIAGRAM_ID,
1286 : sizeof( DATA_DATABASE_READER_SELECT_RELATIONSHIPS_BY_DIAGRAM_ID ),
1287 : &((*this_).statement_relationships_by_diagram_id)
1288 : );
1289 :
1290 99 : if ( result != U8_ERROR_NONE )
1291 : {
1292 0 : U8_LOG_ERROR( "A prepared statement could not be prepared." );
1293 : }
1294 : }
1295 :
1296 99 : U8_TRACE_END_ERR(result);
1297 99 : return result;
1298 : }
1299 :
1300 99 : u8_error_t data_database_classifier_reader_private_close ( data_database_classifier_reader_t *this_ )
1301 : {
1302 99 : U8_TRACE_BEGIN();
1303 99 : u8_error_t result = U8_ERROR_NONE;
1304 :
1305 : {
1306 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_classifier_by_id );
1307 99 : (*this_).statement_classifier_by_id = NULL;
1308 :
1309 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_classifier_by_name );
1310 99 : (*this_).statement_classifier_by_name = NULL;
1311 :
1312 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_classifier_by_uuid );
1313 99 : (*this_).statement_classifier_by_uuid = NULL;
1314 :
1315 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_classifiers_by_diagram_id );
1316 99 : (*this_).statement_classifiers_by_diagram_id = NULL;
1317 :
1318 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_feature_by_id );
1319 99 : (*this_).statement_feature_by_id = NULL;
1320 :
1321 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_feature_by_uuid );
1322 99 : (*this_).statement_feature_by_uuid = NULL;
1323 :
1324 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_features_by_classifier_id );
1325 99 : (*this_).statement_features_by_classifier_id = NULL;
1326 :
1327 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_features_by_diagram_id );
1328 99 : (*this_).statement_features_by_diagram_id = NULL;
1329 :
1330 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_relationship_by_id );
1331 99 : (*this_).statement_relationship_by_id = NULL;
1332 :
1333 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_relationship_by_uuid );
1334 99 : (*this_).statement_relationship_by_uuid = NULL;
1335 :
1336 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_relationships_by_classifier_id );
1337 99 : (*this_).statement_relationships_by_classifier_id = NULL;
1338 :
1339 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_relationships_by_feature_id );
1340 99 : (*this_).statement_relationships_by_feature_id = NULL;
1341 :
1342 99 : result |= data_database_finalize_statement( (*this_).database, (*this_).statement_relationships_by_diagram_id );
1343 99 : (*this_).statement_relationships_by_diagram_id = NULL;
1344 : }
1345 :
1346 99 : U8_TRACE_END_ERR(result);
1347 99 : return result;
1348 : }
1349 :
1350 :
1351 : /*
1352 : Copyright 2016-2024 Andreas Warnke
1353 :
1354 : Licensed under the Apache License, Version 2.0 (the "License");
1355 : you may not use this file except in compliance with the License.
1356 : You may obtain a copy of the License at
1357 :
1358 : http://www.apache.org/licenses/LICENSE-2.0
1359 :
1360 : Unless required by applicable law or agreed to in writing, software
1361 : distributed under the License is distributed on an "AS IS" BASIS,
1362 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1363 : See the License for the specific language governing permissions and
1364 : limitations under the License.
1365 : */
|