101 |
if (dbop_get(dbop, path) != NULL) |
if (dbop_get(dbop, path) != NULL) |
102 |
return; |
return; |
103 |
snprintf(fid, sizeof(fid), "%d", _nextkey++); |
snprintf(fid, sizeof(fid), "%d", _nextkey++); |
104 |
#ifdef USE_POSTGRES |
dbop_put(dbop, path, fid); |
105 |
if (dbop->openflags & DBOP_POSTGRES) { |
dbop_put(dbop, fid, path); |
|
dbop_put(dbop, path, fid, fid); |
|
|
} else { |
|
|
#endif |
|
|
dbop_put(dbop, path, fid, "0"); |
|
|
dbop_put(dbop, fid, path, "0"); |
|
|
#ifdef USE_POSTGRES |
|
|
} |
|
|
#endif |
|
106 |
} |
} |
107 |
/* |
/* |
108 |
* gpath_path2fid: convert path into id |
* gpath_path2fid: convert path into id |
127 |
gpath_fid2path(fid) |
gpath_fid2path(fid) |
128 |
const char *fid; |
const char *fid; |
129 |
{ |
{ |
|
#ifdef USE_POSTGRES |
|
|
if (dbop->openflags & DBOP_POSTGRES) |
|
|
return dbop_getkey_by_fid(dbop, fid); |
|
|
#endif |
|
130 |
return dbop_get(dbop, fid); |
return dbop_get(dbop, fid); |
131 |
} |
} |
132 |
/* |
/* |
146 |
fid = dbop_get(dbop, path); |
fid = dbop_get(dbop, path); |
147 |
if (fid == NULL) |
if (fid == NULL) |
148 |
return; |
return; |
149 |
#ifdef USE_POSTGRES |
dbop_delete(dbop, fid); |
150 |
if (dbop->openflags & DBOP_POSTGRES) { |
dbop_delete(dbop, path); |
|
dbop_delete_by_fid(dbop, fid); |
|
|
} else { |
|
|
#endif |
|
|
dbop_delete(dbop, fid); |
|
|
dbop_delete(dbop, path); |
|
|
#ifdef USE_POSTGRES |
|
|
} |
|
|
#endif |
|
151 |
} |
} |
152 |
/* |
/* |
153 |
* gpath_nextkey: return next key |
* gpath_nextkey: return next key |
176 |
} |
} |
177 |
snprintf(fid, sizeof(fid), "%d", _nextkey); |
snprintf(fid, sizeof(fid), "%d", _nextkey); |
178 |
if (_mode == 1 || _mode == 2) |
if (_mode == 1 || _mode == 2) |
179 |
dbop_update(dbop, NEXTKEY, fid, "0"); |
dbop_update(dbop, NEXTKEY, fid); |
180 |
dbop_close(dbop); |
dbop_close(dbop); |
181 |
if (_mode == 1) |
if (_mode == 1) |
182 |
created = 1; |
created = 1; |