4 int Video_frameLoc::ikey_Frame_weight::
7 ikey_Frame_weight *kp = (ikey_Frame_weight *)a;
9 if( kp->v_id == v ) return 0;
10 Video_frameLoc vloc(kp->loc.entity);
12 vloc.err_(Db::errCorrupt);
13 v = cmpr_double( kp->v_Frame_mean.addr(), kp->v_Frame_mean.size(),
14 vloc._Frame_mean(), vloc->v_Frame_mean.size());
15 if( v != 0 ) return v;
17 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
18 vloc._id(), vloc._id_size());
19 if( v != 0 ) return v;
24 int Video_frameLoc::rkey_Frame_weight::
25 cmpr(char *a, char *b)
27 rkey_Frame_weight *kp = (rkey_Frame_weight *)a;
28 Video_frameLoc &kloc = (Video_frameLoc&)kp->loc;
29 int v = kloc->id, b_id = *(int*)b;
30 if( v == b_id ) return 0;
31 Video_frameLoc vloc(kloc.entity);
32 if( vloc.FindId(b_id) )
33 kloc.err_(Db::errCorrupt);
34 v = cmpr_double( kloc._Frame_mean(), kloc->v_Frame_mean.size(),
35 vloc._Frame_mean(), vloc->v_Frame_mean.size());
36 if( v != 0 ) return v;
37 v = cmpr_int(kloc._id(), kloc._id_size(),
38 vloc._id(), vloc._id_size());
39 if( v != 0 ) return v;
43 int Video_frameLoc::ikey_Frame_center::
44 cmpr(char *a, char *b)
46 ikey_Frame_center *kp = (ikey_Frame_center *)a;
48 if( kp->v_id == v ) return 0;
49 Video_frameLoc vloc(kp->loc.entity);
51 vloc.err_(Db::errCorrupt);
52 v = cmpr_double( kp->v_Frame_moment.addr(), kp->v_Frame_moment.size(),
53 vloc._Frame_moment(), vloc->v_Frame_moment.size());
54 if( v != 0 ) return v;
56 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
57 vloc._id(), vloc._id_size());
58 if( v != 0 ) return v;
63 int Video_frameLoc::rkey_Frame_center::
64 cmpr(char *a, char *b)
66 rkey_Frame_center *kp = (rkey_Frame_center *)a;
67 Video_frameLoc &kloc = (Video_frameLoc&)kp->loc;
68 int v = kloc->id, b_id = *(int*)b;
69 if( v == b_id ) return 0;
70 Video_frameLoc vloc(kloc.entity);
71 if( vloc.FindId(b_id) )
72 kloc.err_(Db::errCorrupt);
73 v = cmpr_double( kloc._Frame_moment(), kloc->v_Frame_moment.size(),
74 vloc._Frame_moment(), vloc->v_Frame_moment.size());
75 if( v != 0 ) return v;
76 v = cmpr_int(kloc._id(), kloc._id_size(),
77 vloc._id(), vloc._id_size());
78 if( v != 0 ) return v;
82 int Video_frameLoc::Allocate()
85 if( !addr_wr() ) return err_(Db::errNoMemory);
90 int Video_frameLoc::Construct()
92 if_err( insertProhibit() );
93 if_err( construct() );
95 { rkey_Frame_weight rkey(*this);
96 if_err( entity->index("Frame_weight")->Insert(rkey,&id) ); }
97 { rkey_Frame_center rkey(*this);
98 if_err( entity->index("Frame_center")->Insert(rkey,&id) ); }
99 if_err( insertCascade() );
103 int Video_frameLoc::Destruct()
105 if_err( deleteProhibit() );
106 { rkey_Frame_weight rkey(*this);
107 if_err( entity->index("Frame_weight")->Delete(rkey) ); }
108 { rkey_Frame_center rkey(*this);
109 if_err( entity->index("Frame_center")->Delete(rkey) ); }
110 if_err( destruct() );
111 if_err( deleteCascade() );
115 void Video_frameLoc::Deallocate()
122 int TimelineLoc::ikey_Timelines::
123 cmpr(char *a, char *b)
125 ikey_Timelines *kp = (ikey_Timelines *)a;
127 if( kp->v_id == v ) return 0;
128 TimelineLoc vloc(kp->loc.entity);
130 vloc.err_(Db::errCorrupt);
131 v = cmpr_uint( kp->v_Frame_id.addr(), kp->v_Frame_id.size(),
132 vloc._Frame_id(), vloc->v_Frame_id.size());
133 if( v != 0 ) return v;
134 if( kp->v_id >= 0 ) {
135 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
136 vloc._id(), vloc._id_size());
137 if( v != 0 ) return v;
142 int TimelineLoc::rkey_Timelines::
143 cmpr(char *a, char *b)
145 rkey_Timelines *kp = (rkey_Timelines *)a;
146 TimelineLoc &kloc = (TimelineLoc&)kp->loc;
147 int v = kloc->id, b_id = *(int*)b;
148 if( v == b_id ) return 0;
149 TimelineLoc vloc(kloc.entity);
150 if( vloc.FindId(b_id) )
151 kloc.err_(Db::errCorrupt);
152 v = cmpr_uint( kloc._Frame_id(), kloc->v_Frame_id.size(),
153 vloc._Frame_id(), vloc->v_Frame_id.size());
154 if( v != 0 ) return v;
155 v = cmpr_int(kloc._id(), kloc._id_size(),
156 vloc._id(), vloc._id_size());
157 if( v != 0 ) return v;
161 int TimelineLoc::ikey_Sequences::
162 cmpr(char *a, char *b)
164 ikey_Sequences *kp = (ikey_Sequences *)a;
166 TimelineLoc vloc(kp->loc.entity);
168 vloc.err_(Db::errCorrupt);
169 v = cmpr_uint( kp->v_Clip_id.addr(), kp->v_Clip_id.size(),
170 vloc._Clip_id(), vloc->v_Clip_id.size());
171 if( v != 0 ) return v;
172 v = cmpr_uint( kp->v_Sequence_no.addr(), kp->v_Sequence_no.size(),
173 vloc._Sequence_no(), vloc->v_Sequence_no.size());
174 if( v != 0 ) return v;
178 int TimelineLoc::rkey_Sequences::
179 cmpr(char *a, char *b)
181 rkey_Sequences *kp = (rkey_Sequences *)a;
182 TimelineLoc &kloc = (TimelineLoc&)kp->loc;
183 int v = kloc->id, b_id = *(int*)b;
184 if( v == b_id ) return 0;
185 TimelineLoc vloc(kloc.entity);
186 if( vloc.FindId(b_id) )
187 kloc.err_(Db::errCorrupt);
188 v = cmpr_uint( kloc._Clip_id(), kloc->v_Clip_id.size(),
189 vloc._Clip_id(), vloc->v_Clip_id.size());
190 if( v != 0 ) return v;
191 v = cmpr_uint( kloc._Sequence_no(), kloc->v_Sequence_no.size(),
192 vloc._Sequence_no(), vloc->v_Sequence_no.size());
193 if( v != 0 ) return v;
197 int TimelineLoc::Allocate()
199 if_err( allocate() );
200 if( !addr_wr() ) return err_(Db::errNoMemory);
204 int TimelineLoc::Construct()
206 if_err( insertProhibit() );
207 if_err( construct() );
209 { rkey_Timelines rkey(*this);
210 if_err( entity->index("Timelines")->Insert(rkey,&id) ); }
211 { rkey_Sequences rkey(*this);
212 if_err( entity->index("Sequences")->Insert(rkey,&id) ); }
213 if_err( insertCascade() );
217 int TimelineLoc::Destruct()
219 if_err( deleteProhibit() );
220 { rkey_Timelines rkey(*this);
221 if_err( entity->index("Timelines")->Delete(rkey) ); }
222 { rkey_Sequences rkey(*this);
223 if_err( entity->index("Sequences")->Delete(rkey) ); }
224 if_err( destruct() );
225 if_err( deleteCascade() );
229 void TimelineLoc::Deallocate()
235 int Clip_setLoc::ikey_Clip_title::
236 cmpr(char *a, char *b)
238 ikey_Clip_title *kp = (ikey_Clip_title *)a;
240 if( kp->v_id == v ) return 0;
241 Clip_setLoc vloc(kp->loc.entity);
243 vloc.err_(Db::errCorrupt);
244 v = cmpr_char( kp->v_Title.addr(), kp->v_Title.size(),
245 vloc._Title(), vloc->v_Title.size());
246 if( v != 0 ) return v;
247 if( kp->v_id >= 0 ) {
248 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
249 vloc._id(), vloc._id_size());
250 if( v != 0 ) return v;
255 int Clip_setLoc::rkey_Clip_title::
256 cmpr(char *a, char *b)
258 rkey_Clip_title *kp = (rkey_Clip_title *)a;
259 Clip_setLoc &kloc = (Clip_setLoc&)kp->loc;
260 int v = kloc->id, b_id = *(int*)b;
261 if( v == b_id ) return 0;
262 Clip_setLoc vloc(kloc.entity);
263 if( vloc.FindId(b_id) )
264 kloc.err_(Db::errCorrupt);
265 v = cmpr_char( kloc._Title(), kloc->v_Title.size(),
266 vloc._Title(), vloc->v_Title.size());
267 if( v != 0 ) return v;
268 v = cmpr_int(kloc._id(), kloc._id_size(),
269 vloc._id(), vloc._id_size());
270 if( v != 0 ) return v;
274 int Clip_setLoc::ikey_Clip_system_time::
275 cmpr(char *a, char *b)
277 ikey_Clip_system_time *kp = (ikey_Clip_system_time *)a;
279 if( kp->v_id == v ) return 0;
280 Clip_setLoc vloc(kp->loc.entity);
282 vloc.err_(Db::errCorrupt);
283 v = cmpr_long( kp->v_System_time.addr(), kp->v_System_time.size(),
284 vloc._System_time(), vloc->v_System_time.size());
285 if( v != 0 ) return v;
286 if( kp->v_id >= 0 ) {
287 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
288 vloc._id(), vloc._id_size());
289 if( v != 0 ) return v;
294 int Clip_setLoc::rkey_Clip_system_time::
295 cmpr(char *a, char *b)
297 rkey_Clip_system_time *kp = (rkey_Clip_system_time *)a;
298 Clip_setLoc &kloc = (Clip_setLoc&)kp->loc;
299 int v = kloc->id, b_id = *(int*)b;
300 if( v == b_id ) return 0;
301 Clip_setLoc vloc(kloc.entity);
302 if( vloc.FindId(b_id) )
303 kloc.err_(Db::errCorrupt);
304 v = cmpr_long( kloc._System_time(), kloc->v_System_time.size(),
305 vloc._System_time(), vloc->v_System_time.size());
306 if( v != 0 ) return v;
307 v = cmpr_int(kloc._id(), kloc._id_size(),
308 vloc._id(), vloc._id_size());
309 if( v != 0 ) return v;
313 int Clip_setLoc::ikey_Clip_creation_time::
314 cmpr(char *a, char *b)
316 ikey_Clip_creation_time *kp = (ikey_Clip_creation_time *)a;
318 if( kp->v_id == v ) return 0;
319 Clip_setLoc vloc(kp->loc.entity);
321 vloc.err_(Db::errCorrupt);
322 v = cmpr_long( kp->v_Creation_time.addr(), kp->v_Creation_time.size(),
323 vloc._Creation_time(), vloc->v_Creation_time.size());
324 if( v != 0 ) return v;
325 if( kp->v_id >= 0 ) {
326 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
327 vloc._id(), vloc._id_size());
328 if( v != 0 ) return v;
333 int Clip_setLoc::rkey_Clip_creation_time::
334 cmpr(char *a, char *b)
336 rkey_Clip_creation_time *kp = (rkey_Clip_creation_time *)a;
337 Clip_setLoc &kloc = (Clip_setLoc&)kp->loc;
338 int v = kloc->id, b_id = *(int*)b;
339 if( v == b_id ) return 0;
340 Clip_setLoc vloc(kloc.entity);
341 if( vloc.FindId(b_id) )
342 kloc.err_(Db::errCorrupt);
343 v = cmpr_long( kloc._Creation_time(), kloc->v_Creation_time.size(),
344 vloc._Creation_time(), vloc->v_Creation_time.size());
345 if( v != 0 ) return v;
346 v = cmpr_int(kloc._id(), kloc._id_size(),
347 vloc._id(), vloc._id_size());
348 if( v != 0 ) return v;
352 int Clip_setLoc::ikey_Clip_path_pos::
353 cmpr(char *a, char *b)
355 ikey_Clip_path_pos *kp = (ikey_Clip_path_pos *)a;
357 if( kp->v_id == v ) return 0;
358 Clip_setLoc vloc(kp->loc.entity);
360 vloc.err_(Db::errCorrupt);
361 v = cmpr_char( kp->v_Asset_path.addr(), kp->v_Asset_path.size(),
362 vloc._Asset_path(), vloc->v_Asset_path.size());
363 if( v != 0 ) return v;
364 v = cmpr_double( kp->v_Position.addr(), kp->v_Position.size(),
365 vloc._Position(), vloc->v_Position.size());
366 if( v != 0 ) return v;
367 if( kp->v_id >= 0 ) {
368 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
369 vloc._id(), vloc._id_size());
370 if( v != 0 ) return v;
375 int Clip_setLoc::rkey_Clip_path_pos::
376 cmpr(char *a, char *b)
378 rkey_Clip_path_pos *kp = (rkey_Clip_path_pos *)a;
379 Clip_setLoc &kloc = (Clip_setLoc&)kp->loc;
380 int v = kloc->id, b_id = *(int*)b;
381 if( v == b_id ) return 0;
382 Clip_setLoc vloc(kloc.entity);
383 if( vloc.FindId(b_id) )
384 kloc.err_(Db::errCorrupt);
385 v = cmpr_char( kloc._Asset_path(), kloc->v_Asset_path.size(),
386 vloc._Asset_path(), vloc->v_Asset_path.size());
387 if( v != 0 ) return v;
388 v = cmpr_double( kloc._Position(), kloc->v_Position.size(),
389 vloc._Position(), vloc->v_Position.size());
390 if( v != 0 ) return v;
391 v = cmpr_int(kloc._id(), kloc._id_size(),
392 vloc._id(), vloc._id_size());
393 if( v != 0 ) return v;
397 int Clip_setLoc::Allocate()
399 if_err( allocate() );
400 if( !addr_wr() ) return err_(Db::errNoMemory);
403 Asset_path((char *)"",0);
407 int Clip_setLoc::Construct()
409 if_err( insertProhibit() );
410 if_err( construct() );
412 { rkey_Clip_title rkey(*this);
413 if_err( entity->index("Clip_title")->Insert(rkey,&id) ); }
414 { rkey_Clip_system_time rkey(*this);
415 if_err( entity->index("Clip_system_time")->Insert(rkey,&id) ); }
416 { rkey_Clip_creation_time rkey(*this);
417 if_err( entity->index("Clip_creation_time")->Insert(rkey,&id) ); }
418 { rkey_Clip_path_pos rkey(*this);
419 if_err( entity->index("Clip_path_pos")->Insert(rkey,&id) ); }
420 if_err( insertCascade() );
424 int Clip_setLoc::Destruct()
426 if_err( deleteProhibit() );
427 { rkey_Clip_title rkey(*this);
428 if_err( entity->index("Clip_title")->Delete(rkey) ); }
429 { rkey_Clip_system_time rkey(*this);
430 if_err( entity->index("Clip_system_time")->Delete(rkey) ); }
431 { rkey_Clip_creation_time rkey(*this);
432 if_err( entity->index("Clip_creation_time")->Delete(rkey) ); }
433 { rkey_Clip_path_pos rkey(*this);
434 if_err( entity->index("Clip_path_pos")->Delete(rkey) ); }
435 if_err( destruct() );
436 if_err( deleteCascade() );
440 void Clip_setLoc::Deallocate()
447 int Clip_viewsLoc::ikey_Clip_access::
448 cmpr(char *a, char *b)
450 ikey_Clip_access *kp = (ikey_Clip_access *)a;
452 Clip_viewsLoc vloc(kp->loc.entity);
454 vloc.err_(Db::errCorrupt);
455 v = cmpr_uint( kp->v_Access_clip_id.addr(), kp->v_Access_clip_id.size(),
456 vloc._Access_clip_id(), vloc->v_Access_clip_id.size());
457 if( v != 0 ) return v;
461 int Clip_viewsLoc::rkey_Clip_access::
462 cmpr(char *a, char *b)
464 rkey_Clip_access *kp = (rkey_Clip_access *)a;
465 Clip_viewsLoc &kloc = (Clip_viewsLoc&)kp->loc;
466 int v = kloc->id, b_id = *(int*)b;
467 if( v == b_id ) return 0;
468 Clip_viewsLoc vloc(kloc.entity);
469 if( vloc.FindId(b_id) )
470 kloc.err_(Db::errCorrupt);
471 v = cmpr_uint( kloc._Access_clip_id(), kloc->v_Access_clip_id.size(),
472 vloc._Access_clip_id(), vloc->v_Access_clip_id.size());
473 if( v != 0 ) return v;
477 int Clip_viewsLoc::ikey_Last_view::
478 cmpr(char *a, char *b)
480 ikey_Last_view *kp = (ikey_Last_view *)a;
482 if( kp->v_id == v ) return 0;
483 Clip_viewsLoc vloc(kp->loc.entity);
485 vloc.err_(Db::errCorrupt);
486 v = cmpr_long( kp->v_Access_time.addr(), kp->v_Access_time.size(),
487 vloc._Access_time(), vloc->v_Access_time.size());
488 if( v != 0 ) return v;
489 if( kp->v_id >= 0 ) {
490 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
491 vloc._id(), vloc._id_size());
492 if( v != 0 ) return v;
497 int Clip_viewsLoc::rkey_Last_view::
498 cmpr(char *a, char *b)
500 rkey_Last_view *kp = (rkey_Last_view *)a;
501 Clip_viewsLoc &kloc = (Clip_viewsLoc&)kp->loc;
502 int v = kloc->id, b_id = *(int*)b;
503 if( v == b_id ) return 0;
504 Clip_viewsLoc vloc(kloc.entity);
505 if( vloc.FindId(b_id) )
506 kloc.err_(Db::errCorrupt);
507 v = cmpr_long( kloc._Access_time(), kloc->v_Access_time.size(),
508 vloc._Access_time(), vloc->v_Access_time.size());
509 if( v != 0 ) return v;
510 v = cmpr_int(kloc._id(), kloc._id_size(),
511 vloc._id(), vloc._id_size());
512 if( v != 0 ) return v;
516 int Clip_viewsLoc::ikey_Total_views::
517 cmpr(char *a, char *b)
519 ikey_Total_views *kp = (ikey_Total_views *)a;
521 if( kp->v_id == v ) return 0;
522 Clip_viewsLoc vloc(kp->loc.entity);
524 vloc.err_(Db::errCorrupt);
525 v = cmpr_uint( kp->v_Access_count.addr(), kp->v_Access_count.size(),
526 vloc._Access_count(), vloc->v_Access_count.size());
527 if( v != 0 ) return v;
528 v = cmpr_uint( kp->v_Access_clip_id.addr(), kp->v_Access_clip_id.size(),
529 vloc._Access_clip_id(), vloc->v_Access_clip_id.size());
530 if( v != 0 ) return v;
531 if( kp->v_id >= 0 ) {
532 v = cmpr_int(&kp->v_id, sizeof(kp->v_id),
533 vloc._id(), vloc._id_size());
534 if( v != 0 ) return v;
539 int Clip_viewsLoc::rkey_Total_views::
540 cmpr(char *a, char *b)
542 rkey_Total_views *kp = (rkey_Total_views *)a;
543 Clip_viewsLoc &kloc = (Clip_viewsLoc&)kp->loc;
544 int v = kloc->id, b_id = *(int*)b;
545 if( v == b_id ) return 0;
546 Clip_viewsLoc vloc(kloc.entity);
547 if( vloc.FindId(b_id) )
548 kloc.err_(Db::errCorrupt);
549 v = cmpr_uint( kloc._Access_count(), kloc->v_Access_count.size(),
550 vloc._Access_count(), vloc->v_Access_count.size());
551 if( v != 0 ) return v;
552 v = cmpr_uint( kloc._Access_clip_id(), kloc->v_Access_clip_id.size(),
553 vloc._Access_clip_id(), vloc->v_Access_clip_id.size());
554 if( v != 0 ) return v;
555 v = cmpr_int(kloc._id(), kloc._id_size(),
556 vloc._id(), vloc._id_size());
557 if( v != 0 ) return v;
561 int Clip_viewsLoc::Allocate()
563 if_err( allocate() );
564 if( !addr_wr() ) return err_(Db::errNoMemory);
568 int Clip_viewsLoc::Construct()
570 if_err( insertProhibit() );
571 if_err( construct() );
573 { rkey_Clip_access rkey(*this);
574 if_err( entity->index("Clip_access")->Insert(rkey,&id) ); }
575 { rkey_Last_view rkey(*this);
576 if_err( entity->index("Last_view")->Insert(rkey,&id) ); }
577 { rkey_Total_views rkey(*this);
578 if_err( entity->index("Total_views")->Insert(rkey,&id) ); }
579 if_err( insertCascade() );
583 int Clip_viewsLoc::Destruct()
585 if_err( deleteProhibit() );
586 { rkey_Clip_access rkey(*this);
587 if_err( entity->index("Clip_access")->Delete(rkey) ); }
588 { rkey_Last_view rkey(*this);
589 if_err( entity->index("Last_view")->Delete(rkey) ); }
590 { rkey_Total_views rkey(*this);
591 if_err( entity->index("Total_views")->Delete(rkey) ); }
592 if_err( destruct() );
593 if_err( deleteCascade() );
597 void Clip_viewsLoc::Deallocate()
604 create(const char *dfn)
606 dfd = ::open(dfn,O_RDWR+O_CREAT+O_TRUNC+no_atime,0666);
607 if( dfd < 0 ) { perror(dfn); return -1; }
608 int ret = db_create();
616 if_ret( Db::make(dfd) );
617 if_ret( Video_frame.new_entity("Video_frame", sizeof(Video_frameObj)) );
618 if_ret( Video_frame.add_kindex("Frame_weight") );
619 if_ret( Video_frame.add_kindex("Frame_center") );
621 if_ret( Timeline.new_entity("Timeline", sizeof(TimelineObj)) );
622 if_ret( Timeline.add_kindex("Timelines") );
623 if_ret( Timeline.add_kindex("Sequences") );
625 if_ret( Clip_set.new_entity("Clip_set", sizeof(Clip_setObj)) );
626 if_ret( Clip_set.add_kindex("Clip_title") );
627 if_ret( Clip_set.add_kindex("Clip_system_time") );
628 if_ret( Clip_set.add_kindex("Clip_creation_time") );
629 if_ret( Clip_set.add_kindex("Clip_path_pos") );
631 if_ret( Clip_views.new_entity("Clip_views", sizeof(Clip_viewsObj)) );
632 if_ret( Clip_views.add_kindex("Clip_access") );
633 if_ret( Clip_views.add_kindex("Last_view") );
634 if_ret( Clip_views.add_kindex("Total_views") );
636 if_ret( Db::commit(1) );
642 : dfd(-1), dkey(-1), no_atime(getuid()?0:O_NOATIME), objects(0),
643 Video_frame(this), video_frame(Video_frame),
644 Timeline(this), timeline(Timeline),
645 Clip_set(this), clip_set(Clip_set),
646 Clip_views(this), clip_views(Clip_views)
648 objects = new ObjectList(objects, video_frame);
649 objects = new ObjectList(objects, timeline);
650 objects = new ObjectList(objects, clip_set);
651 objects = new ObjectList(objects, clip_views);
652 Video_frame.add_vref((vRef)&Video_frameObj::v_Frame_data);
653 Clip_set.add_vref((vRef)&Clip_setObj::v_Title);
654 Clip_set.add_vref((vRef)&Clip_setObj::v_Asset_path);
655 Clip_set.add_vref((vRef)&Clip_setObj::v_Weights);
659 open(const char *dfn, int key)
661 dfd = ::open(dfn,O_RDWR+no_atime);
662 if( dfd < 0 ) { perror(dfn); return errNotFound; }
663 if( (dkey=key) >= 0 ) Db::use_shm(1);
664 int ret = Db::open(dfd, dkey);
665 if( !ret ) ret = db_open();
673 if_ret( Video_frame.get_entity("Video_frame") );
674 if_ret( Video_frame.key_index("Frame_weight") );
675 if_ret( Video_frame.key_index("Frame_center") );
677 if_ret( Timeline.get_entity("Timeline") );
678 if_ret( Timeline.key_index("Timelines") );
679 if_ret( Timeline.key_index("Sequences") );
681 if_ret( Clip_set.get_entity("Clip_set") );
682 if_ret( Clip_set.key_index("Clip_title") );
683 if_ret( Clip_set.key_index("Clip_system_time") );
684 if_ret( Clip_set.key_index("Clip_creation_time") );
685 if_ret( Clip_set.key_index("Clip_path_pos") );
687 if_ret( Clip_views.get_entity("Clip_views") );
688 if_ret( Clip_views.key_index("Clip_access") );
689 if_ret( Clip_views.key_index("Last_view") );
690 if_ret( Clip_views.key_index("Total_views") );
692 if_ret( Db::start_transaction() );
700 if( dfd >= 0 ) { ::close(dfd); dfd = -1; }
704 access(const char *dfn, int key, int rw)
706 if( key < 0 ) return Db::errInvalid;
707 dfd = ::open(dfn,O_RDWR+no_atime);
708 if( dfd < 0 ) { perror(dfn); return Db::errNotFound; }
709 dkey = key; Db::use_shm(1);
710 int ret = Db::attach(dfd, dkey, rw);
711 if( !ret ) ret = db_access();
712 else if( ret == errNotFound ) {
713 ret = Db::open(dfd, dkey);
714 if( !ret ) ret = db_open();
715 if( !ret ) ret = Db::attach(rw);
724 if_ret( Video_frame.get_entity("Video_frame") );
725 if_ret( Timeline.get_entity("Timeline") );
726 if_ret( Clip_set.get_entity("Clip_set") );
727 if_ret( Clip_views.get_entity("Clip_views") );