@@ -33,6 +33,7 @@ bool MySQLStorage::addAnnotation(shared_ptr<Annotation> annotation,
33
33
struct Annotation {
34
34
std::string id;
35
35
std::string next;
36
+ std::string previous;
36
37
std::string object;
37
38
std::string frame;
38
39
float x;
@@ -44,23 +45,25 @@ bool MySQLStorage::addAnnotation(shared_ptr<Annotation> annotation,
44
45
Annotation a_ = {
45
46
std::to_string (annotation->getId ()),
46
47
" 0" ,
48
+ " 0" ,
47
49
std::to_string (annotation->getObject ()->getId ()),
48
50
" 0" ,
49
51
annotation->getX (),
50
52
annotation->getY (),
51
53
annotation->getWidth (),
52
54
annotation->getHeight (),
53
55
AnnotatorLib::AnnotationTypeToString (annotation->getType ())};
54
- if (annotation->getNext ()) a_.next = std::to_string (annotation->getId ());
56
+ if (annotation->getNext ()) a_.next = std::to_string (annotation->getNext ()->getId ());
57
+ if (annotation->getPrevious ()) a_.previous = std::to_string (annotation->getPrevious ()->getId ());
55
58
if (annotation->getFrame ())
56
59
a_.frame = std::to_string (annotation->getFrame ()->getId ());
57
60
58
61
Poco::Data::Statement statement = getStatement ();
59
62
60
63
try {
61
- statement << " INSERT IGNORE INTO `annotations` VALUES(?, ?, ?, ?, ?, ?, "
64
+ statement << " INSERT IGNORE INTO `annotations` VALUES(?, ?, ?, ?, ?, ?, ?, "
62
65
" ?, ?, ?);" ,
63
- use (a_.id ), use (a_.next ), use (a_.object ), use (a_.frame ), use (a_.x ),
66
+ use (a_.id ), use (a_.next ), use (a_.previous ), use (a_. object ), use (a_.frame ), use (a_.x ),
64
67
use (a_.y ), use (a_.width ), use (a_.height ), use (a_.type );
65
68
statement.execute ();
66
69
} catch (Poco::Exception &e) {
@@ -91,6 +94,7 @@ void MySQLStorage::updateAnnotation(shared_ptr<Annotation> annotation) {
91
94
struct Annotation {
92
95
std::string id;
93
96
std::string next;
97
+ std::string previous;
94
98
std::string object;
95
99
std::string frame;
96
100
float x;
@@ -102,24 +106,26 @@ void MySQLStorage::updateAnnotation(shared_ptr<Annotation> annotation) {
102
106
Annotation a_ = {
103
107
std::to_string (annotation->getId ()),
104
108
" 0" ,
109
+ " 0" ,
105
110
std::to_string (annotation->getObject ()->getId ()),
106
111
" 0" ,
107
112
annotation->getX (),
108
113
annotation->getY (),
109
114
annotation->getWidth (),
110
115
annotation->getHeight (),
111
116
AnnotatorLib::AnnotationTypeToString (annotation->getType ())};
112
- if (annotation->getNext ()) a_.next = std::to_string (annotation->getId ());
117
+ if (annotation->getNext ()) a_.next = std::to_string (annotation->getNext ()->getId ());
118
+ if (annotation->getPrevious ()) a_.previous = std::to_string (annotation->getPrevious ()->getId ());
113
119
if (annotation->getFrame ())
114
120
a_.frame = std::to_string (annotation->getFrame ()->getId ());
115
121
116
122
Poco::Data::Statement statement = getStatement ();
117
123
118
124
try {
119
125
statement
120
- << " UPDATE `annotations` SET `id`=?, `next`=?, `object`=?, `frame`=?,"
126
+ << " UPDATE `annotations` SET `id`=?, `next`=?, `previous`=?, ` object`=?, `frame`=?,"
121
127
" `x`=?, `y`=?, `width`=?, `height`=?, `type`=? WHERE `id`=?;" ,
122
- use (a_.id ), use (a_.next ), use (a_.object ), use (a_.frame ), use (a_.x ),
128
+ use (a_.id ), use (a_.next ), use (a_.previous ), use (a_. object ), use (a_.frame ), use (a_.x ),
123
129
use (a_.y ), use (a_.width ), use (a_.height ), use (a_.type ), use (a_.id );
124
130
statement.execute ();
125
131
} catch (Poco::Exception &e) {
@@ -285,6 +291,7 @@ void MySQLStorage::createTables() {
285
291
statement << " CREATE TABLE IF NOT EXISTS `annotations` ( \
286
292
`id` char(16) NOT NULL, \
287
293
`next` char(16) NOT NULL, \
294
+ `previous` char(16) NOT NULL, \
288
295
`object` char(16) NOT NULL, \
289
296
`frame` char(16) NOT NULL, \
290
297
`x` float NOT NULL default 0, \
0 commit comments