|
38 | 38 | #include "php_oci8.h"
|
39 | 39 | #include "php_oci8_int.h"
|
40 | 40 |
|
| 41 | +#if defined(OCI_MAJOR_VERSION) && (OCI_MAJOR_VERSION > 10) && \ |
| 42 | + (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) |
| 43 | +typedef ub8 oci_phpsized_int; |
| 44 | +#else |
| 45 | +typedef ub4 oci_phpsized_int; |
| 46 | +#endif |
| 47 | + |
41 | 48 | /* {{{ php_oci_statement_create()
|
42 | 49 | Create statemend handle and allocate necessary resources */
|
43 | 50 | php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len)
|
@@ -997,10 +1004,10 @@ int php_oci_bind_post_exec(zval *data)
|
997 | 1004 | for (i = 0; i < (int) bind->array.current_length; i++) {
|
998 | 1005 | if ((i < (int) bind->array.old_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
|
999 | 1006 | zval_dtor(entry);
|
1000 |
| - ZVAL_LONG(entry, ((ub4 *)(bind->array.elements))[i]); |
| 1007 | + ZVAL_LONG(entry, ((oci_phpsized_int *)(bind->array.elements))[i]); |
1001 | 1008 | zend_hash_move_forward(hash);
|
1002 | 1009 | } else {
|
1003 |
| - add_next_index_long(bind->zval, ((ub4 *)(bind->array.elements))[i]); |
| 1010 | + add_next_index_long(bind->zval, ((oci_phpsized_int *)(bind->array.elements))[i]); |
1004 | 1011 | }
|
1005 | 1012 | }
|
1006 | 1013 | break;
|
@@ -1153,14 +1160,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
|
1153 | 1160 | return 1;
|
1154 | 1161 | }
|
1155 | 1162 | convert_to_long(param);
|
1156 |
| -#if defined(OCI_MAJOR_VERSION) && (OCI_MAJOR_VERSION > 10) && \ |
1157 |
| - (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) |
1158 |
| - bind_data = (ub8 *)&Z_LVAL_P(param); |
1159 |
| - value_sz = sizeof(ub8); |
1160 |
| -#else |
1161 |
| - bind_data = (ub4 *)&Z_LVAL_P(param); |
1162 |
| - value_sz = sizeof(ub4); |
1163 |
| -#endif |
| 1163 | + bind_data = (oci_phpsized_int *)&Z_LVAL_P(param); |
| 1164 | + value_sz = sizeof(oci_phpsized_int); |
1164 | 1165 | mode = OCI_DEFAULT;
|
1165 | 1166 | break;
|
1166 | 1167 |
|
@@ -1783,25 +1784,25 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_le
|
1783 | 1784 |
|
1784 | 1785 | bind = emalloc(sizeof(php_oci_bind));
|
1785 | 1786 | ZVAL_UNDEF(&bind->parameter);
|
1786 |
| - bind->array.elements = (ub4 *)safe_emalloc(max_table_length, sizeof(ub4), 0); |
| 1787 | + bind->array.elements = (oci_phpsized_int *)safe_emalloc(max_table_length, sizeof(oci_phpsized_int), 0); |
1787 | 1788 | bind->array.current_length = zend_hash_num_elements(Z_ARRVAL_P(var));
|
1788 | 1789 | bind->array.old_length = bind->array.current_length;
|
1789 |
| - bind->array.max_length = sizeof(ub4); |
| 1790 | + bind->array.max_length = sizeof(oci_phpsized_int); |
1790 | 1791 | bind->array.element_lengths = safe_emalloc(max_table_length, sizeof(ub2), 0);
|
1791 | 1792 | memset(bind->array.element_lengths, 0, max_table_length * sizeof(ub2));
|
1792 | 1793 | bind->array.indicators = NULL;
|
1793 | 1794 |
|
1794 | 1795 | zend_hash_internal_pointer_reset(hash);
|
1795 | 1796 | for (i = 0; i < max_table_length; i++) {
|
1796 | 1797 | if (i < bind->array.current_length) {
|
1797 |
| - bind->array.element_lengths[i] = sizeof(ub4); |
| 1798 | + bind->array.element_lengths[i] = sizeof(oci_phpsized_int); |
1798 | 1799 | }
|
1799 | 1800 | if ((i < bind->array.current_length) && (entry = zend_hash_get_current_data(hash)) != NULL) {
|
1800 | 1801 | convert_to_long_ex(entry);
|
1801 |
| - ((ub4 *)bind->array.elements)[i] = (ub4) Z_LVAL_P(entry); |
| 1802 | + ((oci_phpsized_int *)bind->array.elements)[i] = (oci_phpsized_int) Z_LVAL_P(entry); |
1802 | 1803 | zend_hash_move_forward(hash);
|
1803 | 1804 | } else {
|
1804 |
| - ((ub4 *)bind->array.elements)[i] = 0; |
| 1805 | + ((oci_phpsized_int *)bind->array.elements)[i] = 0; |
1805 | 1806 | }
|
1806 | 1807 | }
|
1807 | 1808 | zend_hash_internal_pointer_reset(hash);
|
|
0 commit comments