Lines Matching refs:dba
47 int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode) { in flatfile_store() argument
49 if (flatfile_findkey(dba, key_datum)) { in flatfile_store()
52 php_stream_seek(dba->fp, 0L, SEEK_END); in flatfile_store()
53 php_stream_printf(dba->fp, "%zu\n", key_datum.dsize); in flatfile_store()
54 php_stream_flush(dba->fp); in flatfile_store()
55 if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) { in flatfile_store()
58 php_stream_printf(dba->fp, "%zu\n", value_datum.dsize); in flatfile_store()
59 php_stream_flush(dba->fp); in flatfile_store()
60 if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) { in flatfile_store()
64 flatfile_delete(dba, key_datum); in flatfile_store()
65 php_stream_printf(dba->fp, "%zu\n", key_datum.dsize); in flatfile_store()
66 php_stream_flush(dba->fp); in flatfile_store()
67 if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) { in flatfile_store()
70 php_stream_printf(dba->fp, "%zu\n", value_datum.dsize); in flatfile_store()
71 if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) { in flatfile_store()
76 php_stream_flush(dba->fp); in flatfile_store()
82 datum flatfile_fetch(flatfile *dba, datum key_datum) { in flatfile_fetch() argument
86 if (flatfile_findkey(dba, key_datum)) { in flatfile_fetch()
87 if (php_stream_gets(dba->fp, buf, sizeof(buf))) { in flatfile_fetch()
90 value_datum.dsize = php_stream_read(dba->fp, value_datum.dptr, value_datum.dsize); in flatfile_fetch()
101 int flatfile_delete(flatfile *dba, datum key_datum) { in flatfile_delete() argument
109 php_stream_rewind(dba->fp); in flatfile_delete()
110 while(!php_stream_eof(dba->fp)) { in flatfile_delete()
112 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_delete()
120 pos = php_stream_tell(dba->fp); in flatfile_delete()
123 num = php_stream_read(dba->fp, buf, num); in flatfile_delete()
126 php_stream_seek(dba->fp, pos, SEEK_SET); in flatfile_delete()
127 php_stream_putc(dba->fp, 0); in flatfile_delete()
128 php_stream_flush(dba->fp); in flatfile_delete()
129 php_stream_seek(dba->fp, 0L, SEEK_END); in flatfile_delete()
135 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_delete()
144 num = php_stream_read(dba->fp, buf, num); in flatfile_delete()
152 int flatfile_findkey(flatfile *dba, datum key_datum) { in flatfile_findkey() argument
160 php_stream_rewind(dba->fp); in flatfile_findkey()
161 while (!php_stream_eof(dba->fp)) { in flatfile_findkey()
162 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_findkey()
170 num = php_stream_read(dba->fp, buf, num); in flatfile_findkey()
178 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_findkey()
186 num = php_stream_read(dba->fp, buf, num); in flatfile_findkey()
194 datum flatfile_firstkey(flatfile *dba) { in flatfile_firstkey() argument
200 php_stream_rewind(dba->fp); in flatfile_firstkey()
201 while(!php_stream_eof(dba->fp)) { in flatfile_firstkey()
202 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_firstkey()
210 num = php_stream_read(dba->fp, buf, num); in flatfile_firstkey()
213 dba->CurrentFlatFilePos = php_stream_tell(dba->fp); in flatfile_firstkey()
218 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_firstkey()
226 num = php_stream_read(dba->fp, buf, num); in flatfile_firstkey()
236 datum flatfile_nextkey(flatfile *dba) { in flatfile_nextkey() argument
242 php_stream_seek(dba->fp, dba->CurrentFlatFilePos, SEEK_SET); in flatfile_nextkey()
243 while(!php_stream_eof(dba->fp)) { in flatfile_nextkey()
244 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_nextkey()
252 num = php_stream_read(dba->fp, buf, num); in flatfile_nextkey()
254 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_nextkey()
262 num = php_stream_read(dba->fp, buf, num); in flatfile_nextkey()
265 dba->CurrentFlatFilePos = php_stream_tell(dba->fp); in flatfile_nextkey()