|
47 | 47 | } \ |
48 | 48 | } while(0) |
49 | 49 |
|
50 | | -static php_stream *oci_create_lob_stream(zval *dbh, pdo_stmt_t *stmt, OCILobLocator *lob); |
| 50 | +static php_stream *oci_create_lob_stream(pdo_stmt_t *stmt, OCILobLocator *lob); |
51 | 51 |
|
52 | 52 | #define OCI_TEMPLOB_CLOSE(envhp, svchp, errhp, lob) \ |
53 | 53 | do \ |
@@ -98,10 +98,13 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */ |
98 | 98 | S->einfo.errmsg = NULL; |
99 | 99 | } |
100 | 100 |
|
101 | | - /* TODO: There's php_pdo_stmt_valid_db_obj_handle in PHP-8.5-dev that does these checks. */ |
| 101 | +#if PHP_API_VERSION < 20240925 |
102 | 102 | bool server_obj_usable = !Z_ISUNDEF(stmt->database_object_handle) |
103 | 103 | && IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) |
104 | 104 | && !(OBJ_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED); |
| 105 | +#else |
| 106 | + bool server_obj_usable = php_pdo_stmt_valid_db_obj_handle(stmt); |
| 107 | +#endif |
105 | 108 |
|
106 | 109 | if (S->cols) { |
107 | 110 | for (i = 0; i < stmt->column_count; i++) { |
@@ -393,7 +396,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa |
393 | 396 | * wanted to bind a lob locator into it from the query |
394 | 397 | * */ |
395 | 398 |
|
396 | | - stm = oci_create_lob_stream(&stmt->database_object_handle, stmt, (OCILobLocator*)P->thing); |
| 399 | + stm = oci_create_lob_stream(stmt, (OCILobLocator*)P->thing); |
397 | 400 | if (stm) { |
398 | 401 | OCILobOpen(S->H->svc, S->err, (OCILobLocator*)P->thing, OCI_LOB_READWRITE); |
399 | 402 | php_stream_to_zval(stm, parameter); |
@@ -711,12 +714,16 @@ static const php_stream_ops oci_blob_stream_ops = { |
711 | 714 | NULL |
712 | 715 | }; |
713 | 716 |
|
714 | | -static php_stream *oci_create_lob_stream(zval *dbh, pdo_stmt_t *stmt, OCILobLocator *lob) |
| 717 | +static php_stream *oci_create_lob_stream(pdo_stmt_t *stmt, OCILobLocator *lob) |
715 | 718 | { |
716 | 719 | php_stream *stm; |
717 | 720 | struct oci_lob_self *self = ecalloc(1, sizeof(*self)); |
718 | 721 |
|
719 | | - ZVAL_COPY_VALUE(&self->dbh, dbh); |
| 722 | +#if PHP_API_VERSION < 20240925 |
| 723 | + ZVAL_COPY_VALUE(&self->dbh, &stmt->database_object_handle); |
| 724 | +#else |
| 725 | + ZVAL_OBJ(&self->dbh, stmt->database_object_handle); |
| 726 | +#endif |
720 | 727 | self->lob = lob; |
721 | 728 | self->offset = 1; /* 1-based */ |
722 | 729 | self->stmt = stmt; |
@@ -756,7 +763,7 @@ static int oci_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pdo_ |
756 | 763 |
|
757 | 764 | if (C->dtype == SQLT_BLOB || C->dtype == SQLT_CLOB) { |
758 | 765 | if (C->data) { |
759 | | - php_stream *stream = oci_create_lob_stream(&stmt->database_object_handle, stmt, (OCILobLocator*)C->data); |
| 766 | + php_stream *stream = oci_create_lob_stream(stmt, (OCILobLocator*)C->data); |
760 | 767 | OCILobOpen(S->H->svc, S->err, (OCILobLocator*)C->data, OCI_LOB_READONLY); |
761 | 768 | php_stream_to_zval(stream, result); |
762 | 769 | return 1; |
|
0 commit comments