initial commit
[goodguy/history.git] / cinelerra-5.0 / db / utils / add_path_pos.C
1 #include<stdio.h>
2 #include<stdlib.h>
3 #include<unistd.h>
4 #include<fcntl.h>
5 #include<stdarg.h>
6 #include<time.h>
7
8 #include "tdb.h"
9 namespace old {
10 #include "../x.C"
11 };
12 #include "s.C"
13
14 int main(int ac, char **av)
15 {
16   int ret;  setbuf(stdout,0);
17   old::theDb db;
18   db.open(av[1]);
19   //db.access(av[1], 34543, 0);
20   if( !db.opened() || db.error() ) exit(1);
21
22   if( (ret=db.Clip_set.add_kindex("Clip_path_pos")) ) {
23     printf("add kindex failed %d\n",ret);
24     exit(1);
25   }
26  
27   Db::pgRef clip; 
28   if( !(ret=db.clip_set.FirstId(clip)) ) do {
29     int id = db.clip_set.id();
30     Clip_setLoc::rkey_Clip_path_pos rkey(db.clip_set);
31     if( (ret=db.Clip_set.index("Clip_path_pos")->Insert(rkey,&id)) ) {
32       printf("insert clip_path_pos failed %d, id = %d\n",ret,id);
33       exit(1);
34     }
35   } while( !(ret=db.clip_set.NextId(clip)) );
36
37   db.commit();
38   db.close();
39   return 0;
40 }
41