Lines Matching refs:cdb

44 	dba_cdb *cdb = (dba_cdb *) info->dbf
47 struct cdb c;
59 DBA_OPEN_FUNC(cdb) in DBA_OPEN_FUNC() argument
67 dba_cdb *cdb; in DBA_OPEN_FUNC() local
98 cdb = pemalloc(sizeof(dba_cdb), info->flags&DBA_PERSISTENT); in DBA_OPEN_FUNC()
99 memset(cdb, 0, sizeof(dba_cdb)); in DBA_OPEN_FUNC()
103 cdb_make_start(&cdb->m, file); in DBA_OPEN_FUNC()
105 cdb_init(&cdb->c, file); in DBA_OPEN_FUNC()
107 cdb->make = make; in DBA_OPEN_FUNC()
109 cdb_init(&cdb->c, file); in DBA_OPEN_FUNC()
111 cdb->file = file; in DBA_OPEN_FUNC()
113 pinfo->dbf = cdb; in DBA_OPEN_FUNC()
117 DBA_CLOSE_FUNC(cdb) in DBA_CLOSE_FUNC() argument
123 if (cdb->make) { in DBA_CLOSE_FUNC()
124 cdb_make_finish(&cdb->m); in DBA_CLOSE_FUNC()
126 cdb_free(&cdb->c); in DBA_CLOSE_FUNC()
129 cdb_free(&cdb->c); in DBA_CLOSE_FUNC()
130 close(cdb->file); in DBA_CLOSE_FUNC()
132 pefree(cdb, info->flags&DBA_PERSISTENT); in DBA_CLOSE_FUNC()
136 # define php_cdb_read(cdb, buf, len, pos) cdb_read(cdb, buf, len, pos) argument
137 # define php_cdb_findnext(cdb, key, len) cdb_findnext(cdb, key, len) argument
138 # define php_cdb_find(cdb, key, len) cdb_find(cdb, key, len) argument
140 # define php_cdb_read(cdb, buf, len, pos) cdb_read(cdb, buf, len, pos) argument
141 # define php_cdb_findnext(cdb, key, len) cdb_findnext(cdb, key, len) argument
142 # define php_cdb_find(cdb, key, len) cdb_find(cdb, key, len) argument
145 DBA_FETCH_FUNC(cdb) in DBA_FETCH_FUNC() argument
152 if (cdb->make) in DBA_FETCH_FUNC()
155 if (php_cdb_find(&cdb->c, ZSTR_VAL(key), ZSTR_LEN(key)) == 1) { in DBA_FETCH_FUNC()
157 if (php_cdb_findnext(&cdb->c, ZSTR_VAL(key), ZSTR_LEN(key)) != 1) { in DBA_FETCH_FUNC()
161 len = cdb_datalen(&cdb->c); in DBA_FETCH_FUNC()
164 if (php_cdb_read(&cdb->c, ZSTR_VAL(fetched_val), len, cdb_datapos(&cdb->c)) == -1) { in DBA_FETCH_FUNC()
174 DBA_UPDATE_FUNC(cdb) in DBA_UPDATE_FUNC() argument
179 if (!cdb->make) in DBA_UPDATE_FUNC()
183 if (cdb_make_add(&cdb->m, ZSTR_VAL(key), ZSTR_LEN(key), ZSTR_VAL(val), ZSTR_LEN(val)) != -1) in DBA_UPDATE_FUNC()
189 DBA_EXISTS_FUNC(cdb) in DBA_EXISTS_FUNC() argument
194 if (cdb->make) in DBA_EXISTS_FUNC()
197 if (php_cdb_find(&cdb->c, ZSTR_VAL(key), ZSTR_LEN(key)) == 1) in DBA_EXISTS_FUNC()
202 DBA_DELETE_FUNC(cdb) in DBA_DELETE_FUNC() argument
216 if (cdb_file_read(cdb->file, buf, n) < n) return NULL; \
234 if (n >= cdb->eod) return NULL; \
235 if (cdb_file_lseek(cdb->file, (zend_off_t)n, SEEK_SET) != (zend_off_t) n) return NULL; \
239 DBA_FIRSTKEY_FUNC(cdb) in DBA_FIRSTKEY_FUNC() argument
247 if (cdb->make) in DBA_FIRSTKEY_FUNC()
251 cdb->eod = -1; in DBA_FIRSTKEY_FUNC()
256 uint32_unpack(buf, &cdb->eod); in DBA_FIRSTKEY_FUNC()
266 if (cdb_file_read(cdb->file, ZSTR_VAL(key), klen) < klen) { in DBA_FIRSTKEY_FUNC()
274 cdb->pos = 2048 + 4 + 4 + klen + dlen; in DBA_FIRSTKEY_FUNC()
279 DBA_NEXTKEY_FUNC(cdb) in DBA_NEXTKEY_FUNC() argument
287 if (cdb->make) in DBA_NEXTKEY_FUNC()
291 CSEEK(cdb->pos); in DBA_NEXTKEY_FUNC()
297 if (cdb_file_read(cdb->file, ZSTR_VAL(key), klen) < klen) { in DBA_NEXTKEY_FUNC()
304 cdb->pos += 8 + klen + dlen; in DBA_NEXTKEY_FUNC()
309 DBA_OPTIMIZE_FUNC(cdb) in DBA_OPTIMIZE_FUNC() argument
314 DBA_SYNC_FUNC(cdb) in DBA_SYNC_FUNC() argument
320 DBA_INFO_FUNC(cdb) in DBA_INFO_FUNC() argument