@@ -34,13 +34,13 @@ Registry::Registry(const Path &path)
34
34
35
35
// entry queries
36
36
m_insertEntry = m_db.prepare (
37
- " INSERT INTO entries(remote, category, package, desc, type, version, author)"
38
- " VALUES(?, ?, ?, ?, ?, ?, ?);"
37
+ " INSERT INTO entries(remote, category, package, desc, type, version, author, flags )"
38
+ " VALUES(?, ?, ?, ?, ?, ?, ?, ? );"
39
39
);
40
40
41
41
m_updateEntry = m_db.prepare (
42
42
" UPDATE entries "
43
- " SET desc = ?, type = ?, version = ?, author = ? WHERE id = ?"
43
+ " SET desc = ?, type = ?, version = ?, author = ?, flags = ? WHERE id = ?"
44
44
);
45
45
46
46
m_setFlags = m_db.prepare (" UPDATE entries SET flags = ? WHERE id = ?" );
@@ -146,7 +146,8 @@ void Registry::migrate()
146
146
}
147
147
}
148
148
149
- auto Registry::push (const Version *ver, std::vector<Path> *conflicts) -> Entry
149
+ auto Registry::push (const Version *ver, const int flags,
150
+ std::vector<Path> *conflicts) -> Entry
150
151
{
151
152
m_db.savepoint ();
152
153
@@ -165,21 +166,25 @@ auto Registry::push(const Version *ver, std::vector<Path> *conflicts) -> Entry
165
166
166
167
// register or update package and version
167
168
if (entryId) {
168
- m_updateEntry->bind (1 , pkg->description ());
169
- m_updateEntry->bind (2 , pkg->type ());
170
- m_updateEntry->bind (3 , ver->name ().toString ());
171
- m_updateEntry->bind (4 , ver->author ());
172
- m_updateEntry->bind (5 , entryId);
169
+ int col = 1 ;
170
+ m_updateEntry->bind (col++, pkg->description ());
171
+ m_updateEntry->bind (col++, pkg->type ());
172
+ m_updateEntry->bind (col++, ver->name ().toString ());
173
+ m_updateEntry->bind (col++, ver->author ());
174
+ m_updateEntry->bind (col++, flags);
175
+ m_updateEntry->bind (col++, entryId);
173
176
m_updateEntry->exec ();
174
177
}
175
178
else {
176
- m_insertEntry->bind (1 , ri->name ());
177
- m_insertEntry->bind (2 , cat->name ());
178
- m_insertEntry->bind (3 , pkg->name ());
179
- m_insertEntry->bind (4 , pkg->description ());
180
- m_insertEntry->bind (5 , pkg->type ());
181
- m_insertEntry->bind (6 , ver->name ().toString ());
182
- m_insertEntry->bind (7 , ver->author ());
179
+ int col = 1 ;
180
+ m_insertEntry->bind (col++, ri->name ());
181
+ m_insertEntry->bind (col++, cat->name ());
182
+ m_insertEntry->bind (col++, pkg->name ());
183
+ m_insertEntry->bind (col++, pkg->description ());
184
+ m_insertEntry->bind (col++, pkg->type ());
185
+ m_insertEntry->bind (col++, ver->name ().toString ());
186
+ m_insertEntry->bind (col++, ver->author ());
187
+ m_insertEntry->bind (col++, flags);
183
188
m_insertEntry->exec ();
184
189
185
190
entryId = m_db.lastInsertId ();
@@ -189,10 +194,11 @@ auto Registry::push(const Version *ver, std::vector<Path> *conflicts) -> Entry
189
194
for (const Source *src : ver->sources ()) {
190
195
const Path &path = src->targetPath ();
191
196
192
- m_insertFile->bind (1 , entryId);
193
- m_insertFile->bind (2 , path.join (false ));
194
- m_insertFile->bind (3 , src->sections ());
195
- m_insertFile->bind (4 , src->typeOverride ());
197
+ int col = 1 ;
198
+ m_insertFile->bind (col++, entryId);
199
+ m_insertFile->bind (col++, path.join (false ));
200
+ m_insertFile->bind (col++, src->sections ());
201
+ m_insertFile->bind (col++, src->typeOverride ());
196
202
197
203
try {
198
204
m_insertFile->exec ();
@@ -215,8 +221,10 @@ auto Registry::push(const Version *ver, std::vector<Path> *conflicts) -> Entry
215
221
}
216
222
else {
217
223
m_db.release ();
218
- return {entryId, ri->name (), cat->name (),
219
- pkg->name (), pkg->description (), pkg->type (), ver->name (), ver->author ()};
224
+ return {
225
+ entryId, ri->name (), cat->name (), pkg->name (), pkg->description (),
226
+ pkg->type (), ver->name (), ver->author (), flags
227
+ };
220
228
}
221
229
}
222
230
0 commit comments