mirror of
https://github.com/php-win-ext/pecl-database-pdo_oci.git
synced 2026-03-24 00:52:10 +01:00
Fix build on PHP 8.5 (#14)
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static php_stream *oci_create_lob_stream(zval *dbh, pdo_stmt_t *stmt, OCILobLocator *lob);
|
||||
static php_stream *oci_create_lob_stream(pdo_stmt_t *stmt, OCILobLocator *lob);
|
||||
|
||||
#define OCI_TEMPLOB_CLOSE(envhp, svchp, errhp, lob) \
|
||||
do \
|
||||
@@ -98,10 +98,13 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */
|
||||
S->einfo.errmsg = NULL;
|
||||
}
|
||||
|
||||
/* TODO: There's php_pdo_stmt_valid_db_obj_handle in PHP-8.5-dev that does these checks. */
|
||||
#if PHP_API_VERSION < 20240925
|
||||
bool server_obj_usable = !Z_ISUNDEF(stmt->database_object_handle)
|
||||
&& IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)])
|
||||
&& !(OBJ_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED);
|
||||
#else
|
||||
bool server_obj_usable = php_pdo_stmt_valid_db_obj_handle(stmt);
|
||||
#endif
|
||||
|
||||
if (S->cols) {
|
||||
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
|
||||
* wanted to bind a lob locator into it from the query
|
||||
* */
|
||||
|
||||
stm = oci_create_lob_stream(&stmt->database_object_handle, stmt, (OCILobLocator*)P->thing);
|
||||
stm = oci_create_lob_stream(stmt, (OCILobLocator*)P->thing);
|
||||
if (stm) {
|
||||
OCILobOpen(S->H->svc, S->err, (OCILobLocator*)P->thing, OCI_LOB_READWRITE);
|
||||
php_stream_to_zval(stm, parameter);
|
||||
@@ -711,12 +714,16 @@ static const php_stream_ops oci_blob_stream_ops = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static php_stream *oci_create_lob_stream(zval *dbh, pdo_stmt_t *stmt, OCILobLocator *lob)
|
||||
static php_stream *oci_create_lob_stream(pdo_stmt_t *stmt, OCILobLocator *lob)
|
||||
{
|
||||
php_stream *stm;
|
||||
struct oci_lob_self *self = ecalloc(1, sizeof(*self));
|
||||
|
||||
ZVAL_COPY_VALUE(&self->dbh, dbh);
|
||||
#if PHP_API_VERSION < 20240925
|
||||
ZVAL_COPY_VALUE(&self->dbh, &stmt->database_object_handle);
|
||||
#else
|
||||
ZVAL_OBJ(&self->dbh, stmt->database_object_handle);
|
||||
#endif
|
||||
self->lob = lob;
|
||||
self->offset = 1; /* 1-based */
|
||||
self->stmt = stmt;
|
||||
@@ -756,7 +763,7 @@ static int oci_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pdo_
|
||||
|
||||
if (C->dtype == SQLT_BLOB || C->dtype == SQLT_CLOB) {
|
||||
if (C->data) {
|
||||
php_stream *stream = oci_create_lob_stream(&stmt->database_object_handle, stmt, (OCILobLocator*)C->data);
|
||||
php_stream *stream = oci_create_lob_stream(stmt, (OCILobLocator*)C->data);
|
||||
OCILobOpen(S->H->svc, S->err, (OCILobLocator*)C->data, OCI_LOB_READONLY);
|
||||
php_stream_to_zval(stream, result);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user