Lines Matching refs:cdb
48 dba_cdb *cdb = (dba_cdb *) info->dbf
51 struct cdb c;
63 DBA_OPEN_FUNC(cdb) in DBA_OPEN_FUNC() argument
71 dba_cdb *cdb; in DBA_OPEN_FUNC() local
102 cdb = pemalloc(sizeof(dba_cdb), info->flags&DBA_PERSISTENT); in DBA_OPEN_FUNC()
103 memset(cdb, 0, sizeof(dba_cdb)); in DBA_OPEN_FUNC()
107 cdb_make_start(&cdb->m, file TSRMLS_CC); in DBA_OPEN_FUNC()
109 cdb_init(&cdb->c, file TSRMLS_CC); in DBA_OPEN_FUNC()
111 cdb->make = make; in DBA_OPEN_FUNC()
113 cdb_init(&cdb->c, file); in DBA_OPEN_FUNC()
115 cdb->file = file; in DBA_OPEN_FUNC()
117 pinfo->dbf = cdb; in DBA_OPEN_FUNC()
121 DBA_CLOSE_FUNC(cdb) in DBA_CLOSE_FUNC() argument
127 if (cdb->make) { in DBA_CLOSE_FUNC()
128 cdb_make_finish(&cdb->m TSRMLS_CC); in DBA_CLOSE_FUNC()
130 cdb_free(&cdb->c TSRMLS_CC); in DBA_CLOSE_FUNC()
133 cdb_free(&cdb->c); in DBA_CLOSE_FUNC()
134 close(cdb->file); in DBA_CLOSE_FUNC()
136 pefree(cdb, info->flags&DBA_PERSISTENT); in DBA_CLOSE_FUNC()
140 # define php_cdb_read(cdb, buf, len, pos) cdb_read(cdb, buf, len, pos TSRMLS_CC) argument
141 # define php_cdb_findnext(cdb, key, len) cdb_findnext(cdb, key, len TSRMLS_CC) argument
142 # define php_cdb_find(cdb, key, len) cdb_find(cdb, key, len TSRMLS_CC) argument
144 # define php_cdb_read(cdb, buf, len, pos) cdb_read(cdb, buf, len, pos) argument
145 # define php_cdb_findnext(cdb, key, len) cdb_findnext(cdb, key, len) argument
146 # define php_cdb_find(cdb, key, len) cdb_find(cdb, key, len) argument
149 DBA_FETCH_FUNC(cdb) in DBA_FETCH_FUNC() argument
156 if (cdb->make) in DBA_FETCH_FUNC()
159 if (php_cdb_find(&cdb->c, key, keylen) == 1) { in DBA_FETCH_FUNC()
161 if (php_cdb_findnext(&cdb->c, key, keylen) != 1) { in DBA_FETCH_FUNC()
165 len = cdb_datalen(&cdb->c); in DBA_FETCH_FUNC()
168 if (php_cdb_read(&cdb->c, new_entry, len, cdb_datapos(&cdb->c)) == -1) { in DBA_FETCH_FUNC()
180 DBA_UPDATE_FUNC(cdb) in DBA_UPDATE_FUNC() argument
185 if (!cdb->make) in DBA_UPDATE_FUNC()
189 if (cdb_make_add(&cdb->m, key, keylen, val, vallen TSRMLS_CC) != -1) in DBA_UPDATE_FUNC()
195 DBA_EXISTS_FUNC(cdb) in DBA_EXISTS_FUNC() argument
200 if (cdb->make) in DBA_EXISTS_FUNC()
203 if (php_cdb_find(&cdb->c, key, keylen) == 1) in DBA_EXISTS_FUNC()
208 DBA_DELETE_FUNC(cdb) in DBA_DELETE_FUNC() argument
222 if (cdb_file_read(cdb->file, buf, n) < n) return NULL; \
240 if (n >= cdb->eod) return NULL; \
241 if (cdb_file_lseek(cdb->file, (off_t)n, SEEK_SET TSRMLS_CC) != (off_t) n) return NULL; \
245 DBA_FIRSTKEY_FUNC(cdb) in DBA_FIRSTKEY_FUNC() argument
253 if (cdb->make) in DBA_FIRSTKEY_FUNC()
257 cdb->eod = -1; in DBA_FIRSTKEY_FUNC()
262 uint32_unpack(buf, &cdb->eod); in DBA_FIRSTKEY_FUNC()
272 if (cdb_file_read(cdb->file, key, klen) < klen) { in DBA_FIRSTKEY_FUNC()
281 cdb->pos = 2048 + 4 + 4 + klen + dlen; in DBA_FIRSTKEY_FUNC()
286 DBA_NEXTKEY_FUNC(cdb) in DBA_NEXTKEY_FUNC() argument
294 if (cdb->make) in DBA_NEXTKEY_FUNC()
298 CSEEK(cdb->pos); in DBA_NEXTKEY_FUNC()
304 if (cdb_file_read(cdb->file, key, klen) < klen) { in DBA_NEXTKEY_FUNC()
312 cdb->pos += 8 + klen + dlen; in DBA_NEXTKEY_FUNC()
317 DBA_OPTIMIZE_FUNC(cdb) in DBA_OPTIMIZE_FUNC() argument
322 DBA_SYNC_FUNC(cdb) in DBA_SYNC_FUNC() argument
328 DBA_INFO_FUNC(cdb) in DBA_INFO_FUNC() argument