summaryrefslogtreecommitdiff
path: root/ext/interbase
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-03-15 21:03:08 +0000
committerWez Furlong <wez@php.net>2002-03-15 21:03:08 +0000
commit0f65280cb5118d8c1a85db6626f7be365f3d1b26 (patch)
tree931b09acc5041eb771017e3ebf9ecb9aa833d722 /ext/interbase
parent3a1ebd4f519facbd7ec769304857aad40e49cf1c (diff)
downloadphp-git-0f65280cb5118d8c1a85db6626f7be365f3d1b26.tar.gz
New PHP streams...
Diffstat (limited to 'ext/interbase')
-rw-r--r--ext/interbase/interbase.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
index 86dce7501f..22b2baf7ba 100644
--- a/ext/interbase/interbase.c
+++ b/ext/interbase/interbase.c
@@ -2867,13 +2867,12 @@ PHP_FUNCTION(ibase_blob_import)
zval **link_arg, **file_arg;
int trans_n = 0, link_id = 0, trans_id = 0, size;
unsigned short b;
- int issock=0, socketd=0;
ibase_blob_handle ib_blob;
ibase_db_link *ib_link;
char bl_data[IBASE_BLOB_SEG]; /* FIXME? blob_seg_size parameter? */
- FILE *fp;
void * what;
int type;
+ php_stream * stream;
RESET_ERRMSG;
@@ -2901,11 +2900,8 @@ PHP_FUNCTION(ibase_blob_import)
RETURN_FALSE;
}
- what = zend_fetch_resource(file_arg TSRMLS_CC, -1, "File-Handle", &type, 2, php_file_le_fopen(), php_file_le_stream());
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == php_file_le_fopen())
- fp = (FILE*)what;
+ stream = (php_stream*)zend_fetch_resource(file_arg TSRMLS_CC, -1, "File-Handle", &type, 1, php_file_le_stream());
+ ZEND_VERIFY_RESOURCE(stream);
ib_blob.link = ib_link->link;
ib_blob.trans_handle = ib_link->trans[trans_n];
@@ -2920,32 +2916,15 @@ PHP_FUNCTION(ibase_blob_import)
size = 0;
-#if HAVE_PHP_STREAM
- if (type == php_file_le_stream()) {
- while(b = php_stream_read((php_stream*)what, bl_data, 1, sizeof(bl_data)) > 0) {
- if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- size += b;
-
- }
- }
- else {
-#endif
- /* Can't see much use for the issock stuff here, it should be nuked --Wez */
- while (issock?(b=SOCK_FREAD(bl_data, sizeof(bl_data), socketd)):(b = fread(bl_data, 1, sizeof(bl_data), fp)) > 0) {
+ while(b = php_stream_read((php_stream*)what, bl_data, 1, sizeof(bl_data)) > 0) {
if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)) {
_php_ibase_error();
RETURN_FALSE;
}
size += b;
+
}
-#if HAVE_PHP_STREAM
- }
-#endif
-
if (isc_close_blob(IB_STATUS, &ib_blob.bl_handle)) {
_php_ibase_error();
RETURN_FALSE;