From 2e085df5c07e897f2f2f729547b27477bf33de6e Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 9 Sep 2014 13:12:26 +0200 Subject: [PATCH] basic datatype fixes for ext/oci8 --- ext/oci8/oci8.c | 22 +++++----- ext/oci8/oci8_collection.c | 16 ++++---- ext/oci8/oci8_interface.c | 84 +++++++++++++++++++------------------- ext/oci8/oci8_lob.c | 22 +++++----- ext/oci8/oci8_statement.c | 20 ++++----- ext/oci8/php_oci8_int.h | 70 +++++++++++++++---------------- 6 files changed, 117 insertions(+), 117 deletions(-) diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 3c63692533..6f78524fca 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1383,9 +1383,9 @@ PHP_MINFO_FUNCTION(oci) php_info_print_table_start(); php_info_print_table_header(2, "Statistics", ""); - snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent)); + snprintf(buf, sizeof(buf), "%pd", OCI_G(num_persistent)); php_info_print_table_row(2, "Active Persistent Connections", buf); - snprintf(buf, sizeof(buf), "%ld", OCI_G(num_links)); + snprintf(buf, sizeof(buf), "%pd", OCI_G(num_links)); php_info_print_table_row(2, "Active Connections", buf); php_info_print_table_end(); } @@ -1758,9 +1758,9 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus php_oci_connection *connection; char *username, *password; char *dbname = NULL, *charset = NULL; - int username_len = 0, password_len = 0; - int dbname_len = 0, charset_len = 0; - long session_mode = OCI_DEFAULT; + size_t username_len = 0, password_len = 0; + size_t dbname_len = 0, charset_len = 0; + zend_long session_mode = OCI_DEFAULT; /* if a fourth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ssl", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) { @@ -1799,7 +1799,7 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus * The real connect function. Allocates all the resources needed, establishes the connection and * returns the result handle (or NULL) */ -php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC) +php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, zend_long session_mode, int persistent, int exclusive TSRMLS_DC) { zval *zvp; zend_resource *le; @@ -1815,7 +1815,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char ub2 charsetid_nls_lang = 0; if (session_mode & ~(OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%ld)", session_mode); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid session mode specified (%pd)", session_mode); return NULL; } if (session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) { @@ -1889,7 +1889,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char smart_str_appendl_ex(&hashed_details, "**", sizeof("**") - 1, 0); if (password_len) { - ulong password_hash; + zend_ulong password_hash; password_hash = zend_inline_hash_func(password, password_len); smart_str_append_unsigned_ex(&hashed_details, password_hash, 0); } @@ -2083,7 +2083,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) { /* all persistent connactions are in use, fallback to non-persistent connection creation */ - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections (%ld)", OCI_G(num_persistent)); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections (%pd)", OCI_G(num_persistent)); alloc_non_persistent = 1; } } @@ -2648,7 +2648,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg php_oci_out_column *column; ub4 nrows = 1; int i; - long fetch_mode = 0; + zend_long fetch_mode = 0; if (expected_args > 2) { /* only for ocifetchinto BC */ @@ -2987,7 +2987,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char * } smart_str_appendl_ex(&spool_hashed_details, "**", sizeof("**") - 1, 0); if (password_len) { - ulong password_hash; + zend_ulong password_hash; password_hash = zend_inline_hash_func(password, password_len); smart_str_append_unsigned_ex(&spool_hashed_details, password_hash, 0); } diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index d525ef4a9b..e1ed10877d 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -260,7 +260,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC) /* {{{ php_oci_collection_max() Return max number of elements in the collection */ -int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC) +int php_oci_collection_max(php_oci_collection *collection, zend_long *max TSRMLS_DC) { php_oci_connection *connection = collection->connection; @@ -273,7 +273,7 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC) /* {{{ php_oci_collection_trim() Trim collection to the given number of elements */ -int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC) +int php_oci_collection_trim(php_oci_collection *collection, zend_long trim_size TSRMLS_DC) { php_oci_connection *connection = collection->connection; sword errstatus; @@ -473,7 +473,7 @@ int php_oci_collection_append(php_oci_collection *collection, char *element, int /* {{{ php_oci_collection_element_get() Get the element with the given index */ -int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC) +int php_oci_collection_element_get(php_oci_collection *collection, zend_long index, zval **result_element TSRMLS_DC) { php_oci_connection *connection = collection->connection; dvoid *element; @@ -590,7 +590,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z /* {{{ php_oci_collection_element_set_null() Set the element with the given index to NULL */ -int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC) +int php_oci_collection_element_set_null(php_oci_collection *collection, zend_long index TSRMLS_DC) { OCIInd null_index = OCI_IND_NULL; php_oci_connection *connection = collection->connection; @@ -611,7 +611,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind /* {{{ php_oci_collection_element_set_date() Change element's value to the given DATE */ -int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC) +int php_oci_collection_element_set_date(php_oci_collection *collection, zend_long index, char *date, int date_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; OCIDate oci_date; @@ -652,7 +652,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind /* {{{ php_oci_collection_element_set_number() Change element's value to the given NUMBER */ -int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC) +int php_oci_collection_element_set_number(php_oci_collection *collection, zend_long index, char *number, int number_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; double element_double; @@ -694,7 +694,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i /* {{{ php_oci_collection_element_set_string() Change element's value to the given string */ -int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC) +int php_oci_collection_element_set_string(php_oci_collection *collection, zend_long index, char *element, int element_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; OCIString *ocistr = (OCIString *)0; @@ -733,7 +733,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i /* {{{ php_oci_collection_element_set() Collection element setter */ -int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC) +int php_oci_collection_element_set(php_oci_collection *collection, zend_long index, char *value, int value_len TSRMLS_DC) { if (value_len == 0) { return php_oci_collection_element_set_null(collection, index TSRMLS_CC); diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 198493b946..39ab399516 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -51,8 +51,8 @@ PHP_FUNCTION(oci_define_by_name) { zval *stmt, *var; char *name; - int name_len; - long type = 0; + size_t name_len; + zend_long type = 0; php_oci_statement *statement; php_oci_define *define, *tmp_define; @@ -98,8 +98,8 @@ PHP_FUNCTION(oci_define_by_name) PHP_FUNCTION(oci_bind_by_name) { ub2 bind_type = SQLT_CHR; /* unterminated string */ - int name_len; - long maxlen = -1, type = 0; + size_t name_len; + zend_long maxlen = -1, type = 0; char *name; zval *z_statement; zval *bind_var = NULL; @@ -126,10 +126,10 @@ PHP_FUNCTION(oci_bind_by_name) Bind a PHP array to an Oracle PL/SQL type by name */ PHP_FUNCTION(oci_bind_array_by_name) { - int name_len; - long max_item_len = -1; - long max_array_len = 0; - long type = SQLT_AFC; + size_t name_len; + zend_long max_item_len = -1; + zend_long max_array_len = 0; + zend_long type = SQLT_AFC; char *name; zval *z_statement; zval *bind_var = NULL; @@ -189,8 +189,8 @@ PHP_FUNCTION(oci_lob_save) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *data; - int data_len; - long offset = 0; + size_t data_len; + zend_long offset = 0; ub4 bytes_written; if (getThis()) { @@ -230,7 +230,7 @@ PHP_FUNCTION(oci_lob_import) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *filename; - int filename_len; + size_t filename_len; if (getThis()) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) @@ -313,7 +313,7 @@ PHP_FUNCTION(oci_lob_read) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long length; + zend_long length; char *buffer; ub4 buffer_len; @@ -438,7 +438,7 @@ PHP_FUNCTION(oci_lob_seek) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long offset, whence = PHP_OCI_SEEK_SET; + zend_long offset, whence = PHP_OCI_SEEK_SET; ub4 lob_length; if (getThis()) { @@ -518,8 +518,8 @@ PHP_FUNCTION(oci_lob_write) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - int data_len; - long write_len = 0; + size_t data_len; + zend_long write_len = 0; ub4 bytes_written; char *data; @@ -605,7 +605,7 @@ PHP_FUNCTION(oci_lob_truncate) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long trim_length = 0; + zend_long trim_length = 0; ub4 ub_trim_length; if (getThis()) { @@ -646,7 +646,7 @@ PHP_FUNCTION(oci_lob_erase) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; ub4 bytes_erased; - long offset = -1, length = -1; + zend_long offset = -1, length = -1; if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &offset, &length) == FAILURE) { @@ -699,7 +699,7 @@ PHP_FUNCTION(oci_lob_flush) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long flush_flag = 0; + zend_long flush_flag = 0; if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flush_flag) == FAILURE) { @@ -797,7 +797,7 @@ PHP_FUNCTION(oci_lob_copy) { zval **tmp_dest, **tmp_from, *z_descriptor_dest, *z_descriptor_from; php_oci_descriptor *descriptor_dest, *descriptor_from; - long length = 0; + zend_long length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) { return; @@ -877,8 +877,8 @@ PHP_FUNCTION(oci_lob_export) php_oci_descriptor *descriptor; char *filename; char *buffer; - int filename_len; - long start = -1, length = -1, block_length; + size_t filename_len; + zend_long start = -1, length = -1, block_length; php_stream *stream; ub4 lob_length; @@ -1009,8 +1009,8 @@ PHP_FUNCTION(oci_lob_write_temporary) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *data; - int data_len; - long type = OCI_TEMP_CLOB; + size_t data_len; + zend_long type = OCI_TEMP_CLOB; if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &type) == FAILURE) { @@ -1071,7 +1071,7 @@ PHP_FUNCTION(oci_new_descriptor) zval *z_connection; php_oci_connection *connection; php_oci_descriptor *descriptor; - long type = OCI_DTYPE_LOB; + zend_long type = OCI_DTYPE_LOB; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_connection, &type) == FAILURE) { return; @@ -1318,7 +1318,7 @@ PHP_FUNCTION(oci_execute) { zval *z_statement; php_oci_statement *statement; - long mode = OCI_COMMIT_ON_SUCCESS; + zend_long mode = OCI_COMMIT_ON_SUCCESS; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &mode) == FAILURE) { return; @@ -1392,7 +1392,7 @@ PHP_FUNCTION(oci_fetch_all) zval ***outarrs; ub4 nrows = 1; int i; - long rows = 0, flags = 0, skip = 0, maxrows = -1; + zend_long rows = 0, flags = 0, skip = 0, maxrows = -1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|lll", &z_statement, &array, &skip, &maxrows, &flags) == FAILURE) { return; @@ -1696,7 +1696,7 @@ PHP_FUNCTION(oci_parse) php_oci_connection *connection; php_oci_statement *statement; char *query; - int query_len; + size_t query_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) { return; @@ -1719,7 +1719,7 @@ PHP_FUNCTION(oci_set_prefetch) { zval *z_statement; php_oci_statement *statement; - long size; + zend_long size; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_statement, &size) == FAILURE) { return; @@ -1746,7 +1746,7 @@ PHP_FUNCTION(oci_set_client_identifier) zval *z_connection; php_oci_connection *connection; char *client_id; - int client_id_len; + size_t client_id_len; sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) { @@ -1796,7 +1796,7 @@ PHP_FUNCTION(oci_set_edition) { #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) char *edition; - int edition_len; + size_t edition_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &edition, &edition_len) == FAILURE) { return; @@ -1830,7 +1830,7 @@ PHP_FUNCTION(oci_set_module_name) zval *z_connection; php_oci_connection *connection; char *module; - int module_len; + size_t module_len; sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) { @@ -1862,7 +1862,7 @@ PHP_FUNCTION(oci_set_action) zval *z_connection; php_oci_connection *connection; char *action; - int action_len; + size_t action_len; sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) { @@ -1894,7 +1894,7 @@ PHP_FUNCTION(oci_set_client_info) zval *z_connection; php_oci_connection *connection; char *client_info; - int client_info_len; + size_t client_info_len; sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) { @@ -1927,7 +1927,7 @@ PHP_FUNCTION(oci_set_db_operation) zval *z_connection; php_oci_connection *connection; char *dbop_name; - int dbop_name_len; + size_t dbop_name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) { return; @@ -1956,7 +1956,7 @@ PHP_FUNCTION(oci_password_change) { zval *z_connection; char *user, *pass_old, *pass_new, *dbname; - int user_len, pass_old_len, pass_new_len, dbname_len; + size_t user_len, pass_old_len, pass_new_len, dbname_len; php_oci_connection *connection; #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5) @@ -2192,7 +2192,7 @@ PHP_FUNCTION(oci_collection_append) zval **tmp, *z_collection = getThis(); php_oci_collection *collection; char *value; - int value_len; + size_t value_len; if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) { @@ -2225,7 +2225,7 @@ PHP_FUNCTION(oci_collection_element_get) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long element_index; + zend_long element_index; zval *value; if (getThis()) { @@ -2300,8 +2300,8 @@ PHP_FUNCTION(oci_collection_element_assign) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - int value_len; - long element_index; + size_t value_len; + zend_long element_index; char *value; if (getThis()) { @@ -2363,7 +2363,7 @@ PHP_FUNCTION(oci_collection_max) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long max; + zend_long max; if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { @@ -2391,7 +2391,7 @@ PHP_FUNCTION(oci_collection_trim) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long trim_size; + zend_long trim_size; if (getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &trim_size) == FAILURE) { @@ -2426,7 +2426,7 @@ PHP_FUNCTION(oci_new_collection) php_oci_connection *connection; php_oci_collection *collection; char *tdo, *schema = NULL; - int tdo_len, schema_len = 0; + size_t tdo_len, schema_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) { return; diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index 4982d0f88f..deeaafd58f 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -51,7 +51,7 @@ /* {{{ php_oci_lob_create() Create LOB descriptor and allocate all the resources needed */ -php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC) +php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_long type TSRMLS_DC) { php_oci_descriptor *descriptor; sword errstatus; @@ -63,7 +63,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ /* these three are allowed */ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %ld", type); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %pd", type); return NULL; break; } @@ -210,7 +210,7 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece /* {{{ php_oci_lob_calculate_buffer() Work out the size for LOB buffering */ -static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, long read_length TSRMLS_DC) +static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, zend_long read_length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; ub4 chunk_size; @@ -241,7 +241,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l /* {{{ php_oci_lob_read() Read specified portion of the LOB into the buffer */ -int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long initial_offset, char **data, ub4 *data_len TSRMLS_DC) +int php_oci_lob_read (php_oci_descriptor *descriptor, zend_long read_length, zend_long initial_offset, char **data, ub4 *data_len TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; ub4 length = 0; @@ -513,7 +513,7 @@ int php_oci_lob_get_buffering (php_oci_descriptor *descriptor) /* {{{ php_oci_lob_copy() Copy one LOB (or its part) to another one */ -int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, long length TSRMLS_DC) +int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from, zend_long length TSRMLS_DC) { php_oci_connection *connection = descriptor_dest->connection; ub4 length_dest, length_from, copy_len; @@ -619,7 +619,7 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) /* {{{ php_oci_lob_flush() Flush buffers for the LOB (only if they have been used) */ -int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) +int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag TSRMLS_DC) { OCILobLocator *lob = descriptor->descriptor; php_oci_connection *connection = descriptor->connection; @@ -635,7 +635,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) /* only these two are allowed */ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %ld", flush_flag); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid flag value: %pd", flush_flag); return 1; break; } @@ -806,7 +806,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor /* {{{ php_oci_lob_truncate() Truncate LOB to the given length */ -int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC) +int php_oci_lob_truncate (php_oci_descriptor *descriptor, zend_long new_lob_length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; @@ -848,7 +848,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS /* {{{ php_oci_lob_erase() Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */ -int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC) +int php_oci_lob_erase (php_oci_descriptor *descriptor, zend_long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; @@ -906,7 +906,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript /* {{{ php_oci_lob_write_tmp() Create temporary LOB and write data to it */ -int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC) +int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, zend_long type, char *data, int data_len TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; @@ -919,7 +919,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data /* only these two are allowed */ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %ld", type); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %pd", type); return 1; break; } diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index f9d2a3a0ff..b9ad0643e3 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -377,7 +377,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) /* {{{ php_oci_statement_get_column() Get column from the result set */ -php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC) +php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_index, char *column_name, int column_name_len TSRMLS_DC) { php_oci_out_column *column = NULL; int i; @@ -1079,7 +1079,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) /* {{{ php_oci_bind_by_name() Bind zval to the given placeholder */ -int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC) +int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long maxlength, ub2 type TSRMLS_DC) { php_oci_collection *bind_collection = NULL; php_oci_descriptor *bind_descriptor = NULL; @@ -1466,7 +1466,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME convert_to_long(&tmp); column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0 TSRMLS_CC); if (!column) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL(tmp)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%pd\"", Z_LVAL(tmp)); zval_dtor(&tmp); return NULL; } @@ -1524,7 +1524,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR /* {{{ php_oci_bind_array_by_name() Bind arrays to PL/SQL types */ -int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC) +int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long max_table_length, zend_long maxlength, zend_long type TSRMLS_DC) { php_oci_bind *bind, *bindp; sword errstatus; @@ -1532,7 +1532,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam convert_to_array(var); if (maxlength < -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid max length value (%ld)", maxlength); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid max length value (%pd)", maxlength); return 1; } @@ -1563,7 +1563,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam bind = php_oci_bind_array_helper_date(var, max_table_length, statement->connection TSRMLS_CC); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given: %ld", type); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or unsupported datatype given: %pd", type); return 1; break; } @@ -1626,7 +1626,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam /* {{{ php_oci_bind_array_helper_string() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_length, zend_long maxlength TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1696,7 +1696,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, /* {{{ php_oci_bind_array_helper_number() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1735,7 +1735,7 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length /* {{{ php_oci_bind_array_helper_double() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1774,7 +1774,7 @@ php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length /* {{{ php_oci_bind_array_helper_date() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_length, php_oci_connection *connection TSRMLS_DC) { php_oci_bind *bind; ub4 i; diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index 7cf3d170fa..7c67ba3716 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -144,7 +144,7 @@ typedef struct { sb4 errcode; /* last ORA- error number */ HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */ - ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */ + zend_ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */ unsigned is_open:1; /* hels to determine if the connection is dead or not */ unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */ unsigned is_persistent:1; /* self-descriptive */ @@ -165,7 +165,7 @@ typedef struct { /* {{{ php_oci_descriptor */ typedef struct { zend_resource *id; - ulong index; /* descriptors hash table index */ + zend_ulong index; /* descriptors hash table index */ php_oci_connection *connection; /* parent connection handle */ dvoid *descriptor; /* OCI descriptor handle */ ub4 type; /* descriptor type (FILE/LOB) */ @@ -221,7 +221,7 @@ typedef struct { OCIStmt *stmt; /* statement handle */ char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor received from Oracle */ char impres_flag; /* PHP_OCI_IMPRES_*_ */ - long last_query_len; /* last query length */ + zend_long last_query_len; /* last query length */ HashTable *columns; /* hash containing all the result columns */ HashTable *binds; /* binds hash */ HashTable *defines; /* defines hash */ @@ -249,7 +249,7 @@ typedef struct { ub4 current_length; ub4 old_length; ub4 max_length; - long type; + zend_long type; } array; sb2 indicator; /* -1 means NULL */ ub2 retcode; @@ -407,7 +407,7 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC); sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC); int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC); void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive); -php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC); +php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, zend_long session_mode, int persistent, int exclusive TSRMLS_DC); int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC); int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC); int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC); @@ -422,22 +422,22 @@ void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode /* {{{ lob related prototypes */ -php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, long type TSRMLS_DC); +php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, zend_long type TSRMLS_DC); int php_oci_lob_get_length(php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC); -int php_oci_lob_read(php_oci_descriptor *descriptor, long read_length, long inital_offset, char **data, ub4 *data_len TSRMLS_DC); +int php_oci_lob_read(php_oci_descriptor *descriptor, zend_long read_length, zend_long inital_offset, char **data, ub4 *data_len TSRMLS_DC); int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC); -int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC); +int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag TSRMLS_DC); int php_oci_lob_set_buffering(php_oci_descriptor *descriptor, int on_off TSRMLS_DC); int php_oci_lob_get_buffering(php_oci_descriptor *descriptor); -int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, long length TSRMLS_DC); +int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, zend_long length TSRMLS_DC); int php_oci_lob_close(php_oci_descriptor *descriptor TSRMLS_DC); int php_oci_temp_lob_close(php_oci_descriptor *descriptor TSRMLS_DC); -int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC); +int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, zend_long type, char *data, int data_len TSRMLS_DC); void php_oci_lob_free(php_oci_descriptor *descriptor TSRMLS_DC); int php_oci_lob_import(php_oci_descriptor *descriptor, char *filename TSRMLS_DC); int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC); -int php_oci_lob_truncate(php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC); -int php_oci_lob_erase(php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC); +int php_oci_lob_truncate(php_oci_descriptor *descriptor, zend_long new_lob_length TSRMLS_DC); +int php_oci_lob_erase(php_oci_descriptor *descriptor, zend_long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC); int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC); sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp); /* }}} */ @@ -446,15 +446,15 @@ sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC); int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC); -int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC); -int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC); +int php_oci_collection_max(php_oci_collection *collection, zend_long *max TSRMLS_DC); +int php_oci_collection_trim(php_oci_collection *collection, zend_long trim_size TSRMLS_DC); int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC); -int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC); -int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC); -int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC); -int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC); -int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC); -int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC); +int php_oci_collection_element_get(php_oci_collection *collection, zend_long index, zval **result_element TSRMLS_DC); +int php_oci_collection_element_set(php_oci_collection *collection, zend_long index, char *value, int value_len TSRMLS_DC); +int php_oci_collection_element_set_null(php_oci_collection *collection, zend_long index TSRMLS_DC); +int php_oci_collection_element_set_date(php_oci_collection *collection, zend_long index, char *date, int date_len TSRMLS_DC); +int php_oci_collection_element_set_number(php_oci_collection *collection, zend_long index, char *number, int number_len TSRMLS_DC); +int php_oci_collection_element_set_string(php_oci_collection *collection, zend_long index, char *element, int element_len TSRMLS_DC); int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC); void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC); int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC); @@ -471,24 +471,24 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement TSRMLS_DC); int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC); int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC); -php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC); +php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, zend_long column_index, char *column_name, int column_name_len TSRMLS_DC); int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC); int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC); void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC); int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC); int php_oci_bind_post_exec(void *data TSRMLS_DC); -int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC); +int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long maxlength, ub2 type TSRMLS_DC); sb4 php_oci_bind_in_callback(dvoid *ictxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 *alenp, ub1 *piecep, dvoid **indpp); sb4 php_oci_bind_out_callback(dvoid *octxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcodepp); php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data); int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC); int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC); int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC); -int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC); +int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, zend_long max_table_length, zend_long maxlength, zend_long type TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_number(zval *var, zend_long max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_double(zval *var, zend_long max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_string(zval *var, zend_long max_table_length, zend_long maxlength TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_date(zval *var, zend_long max_table_length, php_oci_connection *connection TSRMLS_DC); /* }}} */ @@ -496,14 +496,14 @@ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */ sb4 errcode; /* global last ORA- error number. Used when connect fails, for example */ OCIError *err; /* global error handle */ - long max_persistent; /* maximum number of persistent connections per process */ - long num_persistent; /* number of existing persistent connections */ - long num_links; /* non-persistent + persistent connections */ - long num_statements; /* number of statements open */ - long ping_interval; /* time interval between pings */ - long persistent_timeout; /* time period after which idle persistent connection is considered expired */ - long statement_cache_size; /* statement cache size. used with 9i+ clients only*/ - long default_prefetch; /* default prefetch setting */ + zend_long max_persistent; /* maximum number of persistent connections per process */ + zend_long num_persistent; /* number of existing persistent connections */ + zend_long num_links; /* non-persistent + persistent connections */ + zend_long num_statements; /* number of statements open */ + zend_long ping_interval; /* time interval between pings */ + zend_long persistent_timeout; /* time period after which idle persistent connection is considered expired */ + zend_long statement_cache_size; /* statement cache size. used with 9i+ clients only*/ + zend_long default_prefetch; /* default prefetch setting */ zend_bool privileged_connect; /* privileged connect flag (On/Off) */ zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */ -- 2.40.0