Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pdo_fbird/VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
13.0.2
12 changes: 4 additions & 8 deletions pdo_fbird/config.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dnl pdo_fbird PDO driver for Firebird (fbird: DSN prefix)
dnl pdo_fbird - PDO driver for Firebird (fbird: DSN prefix)
dnl Separate shared extension depending on the firebird extension.
dnl Self-contained: shared headers from parent are bundled in this package.

PHP_ARG_WITH([pdo-fbird],
[for Firebird PDO support (fbird: DSN)],
Expand All @@ -16,11 +17,9 @@ if test "$PHP_PDO_FBIRD" != "no"; then

AC_DEFINE(HAVE_PDO_FBIRD,1,[Whether pdo_fbird is available])

dnl Version: read from VERSION.txt (same as main extension)
dnl Version: read from VERSION.txt (bundled in this package)
AC_MSG_CHECKING([for PDO fbird version])
if test -f "$srcdir/../VERSION.txt"; then
PHP_PDO_FBIRD_VERSION=`cat "$srcdir/../VERSION.txt" | tr -d ' \n\r\t'`
elif test -f "$srcdir/VERSION.txt"; then
if test -f "$srcdir/VERSION.txt"; then
PHP_PDO_FBIRD_VERSION=`cat "$srcdir/VERSION.txt" | tr -d ' \n\r\t'`
else
PHP_PDO_FBIRD_VERSION="0.0.0-unknown"
Expand Down Expand Up @@ -73,9 +72,6 @@ if test "$PHP_PDO_FBIRD" != "no"; then
PHP_ADD_INCLUDE($FIREBIRD_INCDIR)
PHP_ADD_LIBRARY_WITH_PATH(fbclient, $FIREBIRD_LIBDIR, PDO_FBIRD_SHARED_LIBADD)

dnl Also include the parent extension headers
PHP_ADD_INCLUDE([$srcdir/..])

PHP_NEW_EXTENSION(pdo_fbird,
pdo_fbird.c \
pdo_fbird_driver.c \
Expand Down
110 changes: 110 additions & 0 deletions pdo_fbird/fbird_classes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/* SPDX-License-Identifier: PHP-3.01
* SPDX-FileCopyrightText: The PHP Group and contributors (see CREDITS) */

#ifndef FBIRD_CLASSES_H
#define FBIRD_CLASSES_H

#include "php.h"
#include "php_fbird_includes.h"

extern zend_class_entry *fbird_connection_ce;
extern zend_class_entry *fbird_transaction_ce;
extern zend_class_entry *fbird_statement_ce;
extern zend_class_entry *fbird_resultset_ce;
extern zend_class_entry *fbird_blob_ce;
extern zend_class_entry *fbird_service_ce;
extern zend_class_entry *fbird_event_ce;
extern zend_class_entry *fbird_batch_ce;

#if FB_API_VER >= 40
extern zend_class_entry *fbird_decfloat_ce;
void fbird_register_decfloat_class(void);
void fbird_setup_decfloat_object(zval *return_value, unsigned char precision,
const void *raw_bytes, unsigned char byte_len);
#else
static zend_class_entry *fbird_decfloat_ce = NULL;
#endif

void fbird_register_classes(void);
void fbird_setup_connection_object(zval *return_value, zend_resource *res);
void fbird_setup_service_object(zval *return_value, zend_resource *res);
void fbird_setup_event_object(zval *rv, fbird_event *ev);
#if FB_API_VER >= 40
void fbird_setup_batch_object(zval *rv, fbird_batch *batch);
#endif

/**
* Extract the zend_resource* from a Firebird\Connection object.
* Returns NULL if obj is not a Firebird\Connection or has no resource.
*/
zend_resource *fbird_connection_get_resource(zend_object *obj);

/**
* Extract the zend_resource* from a Firebird\Service object.
* Returns NULL if obj is not a Firebird\Service or has no resource.
*/
zend_resource *fbird_service_get_resource(zend_object *obj);

/**
* Extract the zend_resource* from a Firebird\Transaction object.
* Returns NULL if obj is not a Firebird\Transaction or has no resource.
*/
zend_resource *fbird_transaction_get_resource(zend_object *obj);

/**
* Wrap a le_trans zend_resource* in a Firebird\Transaction object.
* Stores the resource as a weak reference (EG(regular_list) owns it).
*/
void fbird_setup_transaction_object(zval *return_value, zend_resource *res);

/**
* Extract the zend_resource* from a Firebird\ResultSet object.
* Returns NULL if obj is not a Firebird\ResultSet or has no resource.
*/
zend_resource *fbird_resultset_get_resource(zend_object *obj);

/**
* Extract the zend_resource* from a Firebird\Statement object.
* Returns NULL if obj is not a Firebird\Statement or has no resource.
*/
zend_resource *fbird_statement_get_resource(zend_object *obj);

/**
* Wrap a le_query zend_resource* in a Firebird\ResultSet object.
* Stores the resource as a weak reference (EG(regular_list) owns it).
*/
void fbird_setup_resultset_object(zval *return_value, zend_resource *res);

/**
* Wrap a le_query zend_resource* in a Firebird\Statement object.
* Same weak-reference pattern as fbird_setup_resultset_object().
*/
void fbird_setup_statement_object(zval *return_value, zend_resource *res);

/**
* Extract the zend_resource* from a Firebird\Blob object (M3 Phase G bridge).
* Returns NULL if no resource is set (OOP-native path).
*/
zend_resource *fbird_blob_get_resource(zend_object *obj);

/**
* Wrap a le_blob zend_resource* in a Firebird\Blob object.
* Stores the resource as a weak reference (EG(regular_list) owns it).
*/
void fbird_setup_blob_object(zval *return_value, zend_resource *res);

/**
* Extract the fbird_event* from a Firebird\Event object.
* Returns NULL if obj is not a Firebird\Event.
*/
fbird_event *fbird_event_get_ptr(zend_object *obj);

#if FB_API_VER >= 40
/**
* Extract the fbird_batch* from a Firebird\Batch object.
* Returns NULL if obj is not a Firebird\Batch.
*/
fbird_batch *fbird_batch_get_ptr(zend_object *obj);
#endif

#endif /* FBIRD_CLASSES_H */
23 changes: 23 additions & 0 deletions pdo_fbird/fbird_service_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* fbird_service_types.h - Unified service struct for procedural + OOP paths.
* Included by php_fbird_includes.h (procedural) and fbird_class_internal.h (OOP).
* Eliminates the dual-struct cast pattern (OC-11). */
#ifndef FBIRD_SERVICE_TYPES_H
#define FBIRD_SERVICE_TYPES_H

#include "php.h"
#include "zend.h"

typedef struct fbird_service_s {
char *hostname;
char *username;
zend_resource *res; /* resource handle (procedural path) or reference (OOP wrap) */
void *fbsvc; /* OO API ServiceWrapper* (fbsvc_attach) */
zend_object std; /* must be last for zend_object_alloc (OOP path only) */
} fbird_service;

static inline fbird_service *fbird_service_from_obj(zend_object *obj) {
return (fbird_service *)((char *)obj - XtOffsetOf(fbird_service, std));
}
#define Z_FBIRD_SERVICE_P(zv) fbird_service_from_obj(Z_OBJ_P(zv))

#endif /* FBIRD_SERVICE_TYPES_H */
Loading
Loading