Lines Matching refs:dba
50 int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC) { in flatfile_store() argument
52 if (flatfile_findkey(dba, key_datum TSRMLS_CC)) { in flatfile_store()
55 php_stream_seek(dba->fp, 0L, SEEK_END); in flatfile_store()
56 php_stream_printf(dba->fp TSRMLS_CC, "%zu\n", key_datum.dsize); in flatfile_store()
57 php_stream_flush(dba->fp); in flatfile_store()
58 if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) { in flatfile_store()
61 php_stream_printf(dba->fp TSRMLS_CC, "%zu\n", value_datum.dsize); in flatfile_store()
62 php_stream_flush(dba->fp); in flatfile_store()
63 if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) { in flatfile_store()
67 flatfile_delete(dba, key_datum TSRMLS_CC); in flatfile_store()
68 php_stream_printf(dba->fp TSRMLS_CC, "%zu\n", key_datum.dsize); in flatfile_store()
69 php_stream_flush(dba->fp); in flatfile_store()
70 if (php_stream_write(dba->fp, key_datum.dptr, key_datum.dsize) < key_datum.dsize) { in flatfile_store()
73 php_stream_printf(dba->fp TSRMLS_CC, "%zu\n", value_datum.dsize); in flatfile_store()
74 if (php_stream_write(dba->fp, value_datum.dptr, value_datum.dsize) < value_datum.dsize) { in flatfile_store()
79 php_stream_flush(dba->fp); in flatfile_store()
86 datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC) { in flatfile_fetch() argument
90 if (flatfile_findkey(dba, key_datum TSRMLS_CC)) { in flatfile_fetch()
91 if (php_stream_gets(dba->fp, buf, sizeof(buf))) { in flatfile_fetch()
94 value_datum.dsize = php_stream_read(dba->fp, value_datum.dptr, value_datum.dsize); in flatfile_fetch()
106 int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) { in flatfile_delete() argument
114 php_stream_rewind(dba->fp); in flatfile_delete()
115 while(!php_stream_eof(dba->fp)) { in flatfile_delete()
117 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_delete()
125 pos = php_stream_tell(dba->fp); in flatfile_delete()
128 num = php_stream_read(dba->fp, buf, num); in flatfile_delete()
131 php_stream_seek(dba->fp, pos, SEEK_SET); in flatfile_delete()
132 php_stream_putc(dba->fp, 0); in flatfile_delete()
133 php_stream_flush(dba->fp); in flatfile_delete()
134 php_stream_seek(dba->fp, 0L, SEEK_END); in flatfile_delete()
140 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_delete()
149 num = php_stream_read(dba->fp, buf, num); in flatfile_delete()
158 int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) { in flatfile_findkey() argument
166 php_stream_rewind(dba->fp); in flatfile_findkey()
167 while (!php_stream_eof(dba->fp)) { in flatfile_findkey()
168 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_findkey()
176 num = php_stream_read(dba->fp, buf, num); in flatfile_findkey()
184 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_findkey()
192 num = php_stream_read(dba->fp, buf, num); in flatfile_findkey()
201 datum flatfile_firstkey(flatfile *dba TSRMLS_DC) { in flatfile_firstkey()
207 php_stream_rewind(dba->fp); in flatfile_firstkey()
208 while(!php_stream_eof(dba->fp)) { in flatfile_firstkey()
209 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_firstkey()
217 num = php_stream_read(dba->fp, buf, num); in flatfile_firstkey()
220 dba->CurrentFlatFilePos = php_stream_tell(dba->fp); in flatfile_firstkey()
225 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_firstkey()
233 num = php_stream_read(dba->fp, buf, num); in flatfile_firstkey()
244 datum flatfile_nextkey(flatfile *dba TSRMLS_DC) { in flatfile_nextkey()
250 php_stream_seek(dba->fp, dba->CurrentFlatFilePos, SEEK_SET); in flatfile_nextkey()
251 while(!php_stream_eof(dba->fp)) { in flatfile_nextkey()
252 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_nextkey()
260 num = php_stream_read(dba->fp, buf, num); in flatfile_nextkey()
262 if (!php_stream_gets(dba->fp, buf, 15)) { in flatfile_nextkey()
270 num = php_stream_read(dba->fp, buf, num); in flatfile_nextkey()
273 dba->CurrentFlatFilePos = php_stream_tell(dba->fp); in flatfile_nextkey()