From bf91c766267a8d77f4d25e0f6aa723559d4ef5e8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 18 Feb 2019 17:06:20 +0100 Subject: pdo_oci: backport PDOStatement::getColumnMeta from 7.4 rebuild using libicu62 drop configuration for ZTS mod_php (Fedora >= 27) --- php-7.3.3-pdooci.patch | 269 +++++++++++++++++++++++++++++++++++++++++++++++++ php73.spec | 20 +++- 2 files changed, 287 insertions(+), 2 deletions(-) create mode 100644 php-7.3.3-pdooci.patch diff --git a/php-7.3.3-pdooci.patch b/php-7.3.3-pdooci.patch new file mode 100644 index 0000000..bd54849 --- /dev/null +++ b/php-7.3.3-pdooci.patch @@ -0,0 +1,269 @@ +diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c +index f2c43b9a69..79733c2c57 100644 +--- a/ext/pdo_oci/oci_statement.c ++++ b/ext/pdo_oci/oci_statement.c +@@ -2,7 +2,7 @@ + +----------------------------------------------------------------------+ + | PHP Version 7 | + +----------------------------------------------------------------------+ +- | Copyright (c) 1997-2018 The PHP Group | ++ | Copyright (c) The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | +@@ -525,7 +525,7 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */ + pdo_oci_stmt *S = (pdo_oci_stmt*)stmt->driver_data; + OCIParam *param = NULL; + text *colname; +- ub2 dtype, data_size, scale, precis; ++ ub2 dtype, data_size, precis; + ub4 namelen; + struct pdo_column_data *col = &stmt->columns[colno]; + zend_bool dyn = FALSE; +@@ -541,10 +541,6 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */ + STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_DATA_SIZE", + (param, OCI_DTYPE_PARAM, &data_size, 0, OCI_ATTR_DATA_SIZE, S->err)); + +- /* scale ? */ +- STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_SCALE", +- (param, OCI_DTYPE_PARAM, &scale, 0, OCI_ATTR_SCALE, S->err)); +- + /* precision ? */ + STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_PRECISION", + (param, OCI_DTYPE_PARAM, &precis, 0, OCI_ATTR_PRECISION, S->err)); +@@ -553,7 +549,7 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */ + STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_NAME", + (param, OCI_DTYPE_PARAM, &colname, &namelen, OCI_ATTR_NAME, S->err)); + +- col->precision = scale; ++ col->precision = precis; + col->maxlen = data_size; + col->name = zend_string_init((char *)colname, namelen, 0); + +@@ -598,7 +594,7 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */ + S->cols[colno].datalen = 1024; + #endif + } else if (dtype == SQLT_BIN) { +- S->cols[colno].datalen = (ub4) col->maxlen * 2; // raw characters to hex digits ++ S->cols[colno].datalen = (ub4) col->maxlen * 2; /* raw characters to hex digits */ + } else { + S->cols[colno].datalen = (ub4) (col->maxlen * S->H->max_char_width); + } +@@ -793,20 +789,207 @@ static int oci_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, size_t *len + } + } /* }}} */ + ++ ++static int oci_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *return_value) /* {{{ */ ++{ ++ pdo_oci_stmt *S = (pdo_oci_stmt*)stmt->driver_data; ++ OCIParam *param = NULL; ++ ub2 dtype, precis; ++ sb1 scale; ++ zval flags; ++ ub1 isnull, charset_form; ++ if (!S->stmt) { ++ return FAILURE; ++ } ++ if (colno >= stmt->column_count) { ++ /* error invalid column */ ++ return FAILURE; ++ } ++ ++ array_init(return_value); ++ array_init(&flags); ++ ++ /* describe the column */ ++ STMT_CALL(OCIParamGet, (S->stmt, OCI_HTYPE_STMT, S->err, (dvoid*)¶m, colno+1)); ++ ++ /* column data type */ ++ STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_DATA_TYPE", ++ (param, OCI_DTYPE_PARAM, &dtype, 0, OCI_ATTR_DATA_TYPE, S->err)); ++ ++ /* column precision */ ++ STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_PRECISION", ++ (param, OCI_DTYPE_PARAM, &precis, 0, OCI_ATTR_PRECISION, S->err)); ++ ++ /* column scale */ ++ STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_SCALE", ++ (param, OCI_DTYPE_PARAM, &scale, 0, OCI_ATTR_SCALE, S->err)); ++ ++ /* string column charset form */ ++ if (dtype == SQLT_CHR || dtype == SQLT_VCS || dtype == SQLT_AFC || dtype == SQLT_CLOB) { ++ STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_CHARSET_FORM", ++ (param, OCI_DTYPE_PARAM, &charset_form, 0, OCI_ATTR_CHARSET_FORM, S->err)); ++ } ++ ++ ++ if (dtype) { ++ /* if there is a declared type */ ++ switch (dtype) { ++#ifdef SQLT_TIMESTAMP ++ case SQLT_TIMESTAMP: ++ add_assoc_string(return_value, "oci:decl_type", "TIMESTAMP"); ++ add_assoc_string(return_value, "native_type", "TIMESTAMP"); ++ break; ++#endif ++#ifdef SQLT_TIMESTAMP_TZ ++ case SQLT_TIMESTAMP_TZ: ++ add_assoc_string(return_value, "oci:decl_type", "TIMESTAMP WITH TIMEZONE"); ++ add_assoc_string(return_value, "native_type", "TIMESTAMP WITH TIMEZONE"); ++ break; ++#endif ++#ifdef SQLT_TIMESTAMP_LTZ ++ case SQLT_TIMESTAMP_LTZ: ++ add_assoc_string(return_value, "oci:decl_type", "TIMESTAMP WITH LOCAL TIMEZONE"); ++ add_assoc_string(return_value, "native_type", "TIMESTAMP WITH LOCAL TIMEZONE"); ++ break; ++#endif ++#ifdef SQLT_INTERVAL_YM ++ case SQLT_INTERVAL_YM: ++ add_assoc_string(return_value, "oci:decl_type", "INTERVAL YEAR TO MONTH"); ++ add_assoc_string(return_value, "native_type", "INTERVAL YEAR TO MONTH"); ++ break; ++#endif ++#ifdef SQLT_INTERVAL_DS ++ case SQLT_INTERVAL_DS: ++ add_assoc_string(return_value, "oci:decl_type", "INTERVAL DAY TO SECOND"); ++ add_assoc_string(return_value, "native_type", "INTERVAL DAY TO SECOND"); ++ break; ++#endif ++ case SQLT_DAT: ++ add_assoc_string(return_value, "oci:decl_type", "DATE"); ++ add_assoc_string(return_value, "native_type", "DATE"); ++ break; ++ case SQLT_FLT : ++ case SQLT_NUM: ++ /* if the precision is nonzero and scale is -127 then it is a FLOAT */ ++ if (scale == -127 && precis != 0) { ++ add_assoc_string(return_value, "oci:decl_type", "FLOAT"); ++ add_assoc_string(return_value, "native_type", "FLOAT"); ++ } else { ++ add_assoc_string(return_value, "oci:decl_type", "NUMBER"); ++ add_assoc_string(return_value, "native_type", "NUMBER"); ++ } ++ break; ++ case SQLT_LNG: ++ add_assoc_string(return_value, "oci:decl_type", "LONG"); ++ add_assoc_string(return_value, "native_type", "LONG"); ++ break; ++ case SQLT_BIN: ++ add_assoc_string(return_value, "oci:decl_type", "RAW"); ++ add_assoc_string(return_value, "native_type", "RAW"); ++ break; ++ case SQLT_LBI: ++ add_assoc_string(return_value, "oci:decl_type", "LONG RAW"); ++ add_assoc_string(return_value, "native_type", "LONG RAW"); ++ break; ++ case SQLT_CHR: ++ case SQLT_VCS: ++ if (charset_form == SQLCS_NCHAR) { ++ add_assoc_string(return_value, "oci:decl_type", "NVARCHAR2"); ++ add_assoc_string(return_value, "native_type", "NVARCHAR2"); ++ } else { ++ add_assoc_string(return_value, "oci:decl_type", "VARCHAR2"); ++ add_assoc_string(return_value, "native_type", "VARCHAR2"); ++ } ++ break; ++ case SQLT_AFC: ++ if (charset_form == SQLCS_NCHAR) { ++ add_assoc_string(return_value, "oci:decl_type", "NCHAR"); ++ add_assoc_string(return_value, "native_type", "NCHAR"); ++ } else { ++ add_assoc_string(return_value, "oci:decl_type", "CHAR"); ++ add_assoc_string(return_value, "native_type", "CHAR"); ++ } ++ break; ++ case SQLT_BLOB: ++ add_assoc_string(return_value, "oci:decl_type", "BLOB"); ++ add_next_index_string(&flags, "blob"); ++ add_assoc_string(return_value, "native_type", "BLOB"); ++ break; ++ case SQLT_CLOB: ++ if (charset_form == SQLCS_NCHAR) { ++ add_assoc_string(return_value, "oci:decl_type", "NCLOB"); ++ add_assoc_string(return_value, "native_type", "NCLOB"); ++ } else { ++ add_assoc_string(return_value, "oci:decl_type", "CLOB"); ++ add_assoc_string(return_value, "native_type", "CLOB"); ++ } ++ add_next_index_string(&flags, "blob"); ++ break; ++ case SQLT_BFILE: ++ add_assoc_string(return_value, "oci:decl_type", "BFILE"); ++ add_next_index_string(&flags, "blob"); ++ add_assoc_string(return_value, "native_type", "BFILE"); ++ break; ++ case SQLT_RDD: ++ add_assoc_string(return_value, "oci:decl_type", "ROWID"); ++ add_assoc_string(return_value, "native_type", "ROWID"); ++ break; ++ case SQLT_BFLOAT: ++ case SQLT_IBFLOAT: ++ add_assoc_string(return_value, "oci:decl_type", "BINARY_FLOAT"); ++ add_assoc_string(return_value, "native_type", "BINARY_FLOAT"); ++ break; ++ case SQLT_BDOUBLE: ++ case SQLT_IBDOUBLE: ++ add_assoc_string(return_value, "oci:decl_type", "BINARY_DOUBLE"); ++ add_assoc_string(return_value, "native_type", "BINARY_DOUBLE"); ++ break; ++ default: ++ add_assoc_long(return_value, "oci:decl_type", dtype); ++ add_assoc_string(return_value, "native_type", "UNKNOWN"); ++ } ++ } else { ++ /* if the column is NULL */ ++ add_assoc_long(return_value, "oci:decl_type", 0); ++ add_assoc_string(return_value, "native_type", "NULL"); ++ } ++ ++ /* column can be null */ ++ STMT_CALL_MSG(OCIAttrGet, "OCI_ATTR_IS_NULL", ++ (param, OCI_DTYPE_PARAM, &isnull, 0, OCI_ATTR_IS_NULL, S->err)); ++ ++ if (isnull) { ++ add_next_index_string(&flags, "nullable"); ++ } else { ++ add_next_index_string(&flags, "not_null"); ++ } ++ ++ /* PDO type */ ++ switch (dtype) { ++ case SQLT_BFILE: ++ case SQLT_BLOB: ++ case SQLT_CLOB: ++ add_assoc_long(return_value, "pdo_type", PDO_PARAM_LOB); ++ break; ++ default: ++ add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR); ++ } ++ ++ add_assoc_long(return_value, "scale", scale); ++ add_assoc_zval(return_value, "flags", &flags); ++ ++ OCIDescriptorFree(param, OCI_DTYPE_PARAM); ++ return SUCCESS; ++} /* }}} */ ++ + const struct pdo_stmt_methods oci_stmt_methods = { + oci_stmt_dtor, + oci_stmt_execute, + oci_stmt_fetch, + oci_stmt_describe, + oci_stmt_get_col, +- oci_stmt_param_hook ++ oci_stmt_param_hook, ++ NULL, /* set_attr */ ++ NULL, /* get_attr */ ++ oci_stmt_col_meta + }; +- +-/* +- * Local variables: +- * tab-width: 4 +- * c-basic-offset: 4 +- * End: +- * vim600: noet sw=4 ts=4 fdm=marker +- * vim<600: noet sw=4 ts=4 +- */ diff --git a/php73.spec b/php73.spec index 3d68a07..9313f9d 100644 --- a/php73.spec +++ b/php73.spec @@ -176,6 +176,8 @@ Patch45: php-7.2.3-ldap_r.patch Patch46: php-7.2.4-fixheader.patch # drop "Configure command" from phpinfo output Patch47: php-5.6.3-phpinfo.patch +# backport PDOStatement::getColumnMeta from 7.4 +Patch48: php-7.3.3-pdooci.patch # RC Patch Patch91: php-7.2.0-oci8conf.patch @@ -440,6 +442,11 @@ Requires: libtool %if %{with_libpcre} Requires: pcre2-devel%{?_isa} %endif +%if 0%{?rhel} == 6 +Requires: libicu-last-devel%{?_isa} +%else +Requires: libicu-devel%{?_isa} > 62 +%endif Obsoletes: php-pecl-pdo-devel Obsoletes: php-pecl-json-devel < %{jsonver} Obsoletes: php-pecl-jsonc-devel < %{jsonver} @@ -1004,8 +1011,11 @@ Group: System Environment/Libraries # All files licensed under PHP version 3.01 License: PHP Requires: php-common%{?_isa} = %{version}-%{release} -# Upstream requires 4.0, we require 50 to ensure use of libicu-last -BuildRequires: libicu-devel >= 50 +%if 0%{?rhel} == 6 +BuildRequires: libicu-last-devel +%else +BuildRequires: libicu-devel > 62 +%endif %if 0%{?rhel} Obsoletes: php53-intl, php53u-intl, php54-intl, php54w-intl, php55u-intl, php55w-intl, php56u-intl, php56w-intl Obsoletes: php70u-intl, php70w-intl, php71u-intl, php71w-intl, php72u-intl, php72w-intl @@ -1129,6 +1139,7 @@ low-level PHP extension for the libsodium cryptographic library. %endif %patch46 -p1 -b .fixheader %patch47 -p1 -b .phpinfo +%patch48 -p1 -b .pdooci %patch91 -p1 -b .remi-oci8 @@ -2204,6 +2215,11 @@ fi %changelog +* Mon Feb 18 2019 Remi Collet - 7.3.2-2 +- pdo_oci: backport PDOStatement::getColumnMeta from 7.4 +- rebuild using libicu62 +- drop configuration for ZTS mod_php (Fedora >= 27) + * Wed Feb 6 2019 Remi Collet - 7.3.2-1 - Update to 7.3.2 - http://www.php.net/releases/7_3_2.php -- cgit