com php-src: basic fixes to ext/oci8: ext/oci8/oci8.c ext/oci8/oci8_collection.c ext/oci8/oci8_interf ace.c ext/oci8/oci8_lob.c ext/oci8/oci8_sta
tement.c ext/oci8/php_oci8_int.h
| From: | Anatol Belski | Date: | Sat, 14 Dec 2013 10:39:47 +0000 |
| Subject: | com php-src: basic fixes to ext/oci8: ext/oci8/oci8.c ext/oci8/oci8_collection.c ext/oci8/oci8_interf ace.c ext/oci8/oci8_lob.c ext/oci8/oci8_sta tement.c ext/oci8/php_oci8_int.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74430@lists.php.net to get a copy of this message | ||
Commit: e0c5db0970a81e06aa23be4b8fc7cdd601f2f02b
Author: Anatol Belski <ab@php.net> Sat, 14 Dec 2013 11:39:47 +0100
Parents: 4c68e810183f6b02ce7c2731ddecb4aca14c87f3
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e0c5db0970a81e06aa23be4b8fc7cdd601f2f02b
Log:
basic fixes to ext/oci8
Changed paths:
M ext/oci8/oci8.c
M ext/oci8/oci8_collection.c
M ext/oci8/oci8_interface.c
M ext/oci8/oci8_lob.c
M ext/oci8/oci8_statement.c
M ext/oci8/php_oci8_int.h
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 1e505f1..a6c8823 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -137,10 +137,10 @@ static int php_oci_connection_close(php_oci_connection * TSRMLS_DC); static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC); static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC); -static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC); -static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC); -static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, int charsetid TSRMLS_DC); -static php_oci_spool *php_oci_create_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, char *hash_key, int hash_key_len, int charsetid TSRMLS_DC); +static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC); +static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC); +static php_oci_spool *php_oci_get_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, int charsetid TSRMLS_DC); +static php_oci_spool *php_oci_create_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, char *hash_key, zend_str_size_int hash_key_len, int charsetid TSRMLS_DC); static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TSRMLS_DC); /* }}} */ @@ -1129,7 +1129,7 @@ static void php_oci_init_global_handles(TSRMLS_D) OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ERROR); if (ora_error_code) { - int tmp_buf_len = strlen((char *)tmp_buf); + zend_str_size_int tmp_buf_len = strlen((char *)tmp_buf); if (tmp_buf_len > 0 && tmp_buf[tmp_buf_len - 1] == '\n') { tmp_buf[tmp_buf_len - 1] = '\0'; @@ -1699,7 +1699,7 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) PHP_OCI_CALL(OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, err_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR)); if (error_code) { - int err_buf_len = strlen((char *)err_buf); + zend_str_size_int err_buf_len = strlen((char *)err_buf); if (err_buf_len && err_buf[err_buf_len - 1] == '\n') { err_buf[err_buf_len - 1] = '\0'; @@ -1751,12 +1751,12 @@ 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; + zend_str_size_int username_len = 0, password_len = 0; + zend_str_size_int dbname_len = 0, charset_len = 0; + php_int_t 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|SSi", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) { return; } @@ -1792,7 +1792,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, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, char *dbname, zend_str_size_int dbname_len, char *charset, php_int_t session_mode, int persistent, int exclusive TSRMLS_DC) { zend_rsrc_list_entry *le; zend_rsrc_list_entry new_le; @@ -1881,7 +1881,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; + php_uint_t password_hash; password_hash = zend_inline_hash_func(password, password_len); smart_str_append_unsigned_ex(&hashed_details, password_hash, 0); } @@ -2471,7 +2471,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) * * Change password for the user with the username given */ -int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC) +int php_oci_password_change(php_oci_connection *connection, char *user, zend_str_size_int user_len, char *pass_old, zend_str_size_int pass_old_len, char *pass_new, zend_str_size_int pass_new_len TSRMLS_DC) { sword errstatus; @@ -2537,7 +2537,7 @@ int php_oci_server_get_version(php_oci_connection *connection, char **version TS * * Convert php_oci_out_column struct into zval */ -int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC) +int php_oci_column_to_zval(php_oci_out_column *column, zval *value, php_int_t mode TSRMLS_DC) { php_oci_descriptor *descriptor; ub4 lob_length; @@ -2631,12 +2631,12 @@ 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; + php_int_t fetch_mode = 0; if (expected_args > 2) { /* only for ocifetchinto BC */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|l", &z_statement, &array, &fetch_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|i", &z_statement, &array, &fetch_mode) == FAILURE) { return; } @@ -2646,7 +2646,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg } else if (expected_args == 2) { /* only for oci_fetch_array() */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &fetch_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &z_statement, &fetch_mode) == FAILURE) { return; } @@ -2815,7 +2815,7 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) * * Create(alloc + Init) Session pool for the given dbname and charsetid */ -static php_oci_spool *php_oci_create_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, char *hash_key, int hash_key_len, int charsetid TSRMLS_DC) +static php_oci_spool *php_oci_create_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, char *hash_key, zend_str_size_int hash_key_len, int charsetid TSRMLS_DC) { php_oci_spool *session_pool = NULL; zend_bool iserror = 0; @@ -2952,7 +2952,7 @@ exit_create_spool: * Get Session pool for the given dbname and charsetid from the persistent list. Function called for * non-persistent connections. */ -static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, int charsetid TSRMLS_DC) +static php_oci_spool *php_oci_get_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, int charsetid TSRMLS_DC) { smart_str spool_hashed_details = {0}; php_oci_spool *session_pool = NULL; @@ -2970,7 +2970,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; + php_uint_t password_hash; password_hash = zend_inline_hash_func(password, password_len); smart_str_append_unsigned_ex(&spool_hashed_details, password_hash, 0); } @@ -3057,7 +3057,7 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC) * This function is to be deprecated in future in favour of OCISessionGet which is used in * php_oci_do_connect_ex */ -static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC) +static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC) { ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0; @@ -3240,7 +3240,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna * * Create session using client-side session pool - new norm */ -static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC) +static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC) { php_oci_spool *actual_spool = NULL; #if (OCI_MAJOR_VERSION > 10) diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 35b70fa..2e95a9d 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -44,7 +44,7 @@ /* {{{ php_oci_collection_create() Create and return connection handle */ -php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) +php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, zend_str_size_int tdo_len, char *schema, zend_str_size_int schema_len TSRMLS_DC) { dvoid *dschp1 = NULL; dvoid *parmp1; @@ -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, php_int_t *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, php_int_t trim_size TSRMLS_DC) { php_oci_connection *connection = collection->connection; sword errstatus; @@ -313,7 +313,7 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC) /* {{{ php_oci_collection_append_date() Append DATE element to the end of the collection (use "DD-MON-YY" format) */ -int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC) +int php_oci_collection_append_date(php_oci_collection *collection, char *date, zend_str_size_int date_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; OCIDate oci_date; @@ -353,7 +353,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i /* {{{ php_oci_collection_append_number() Append NUMBER to the end of the collection */ -int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC) +int php_oci_collection_append_number(php_oci_collection *collection, char *number, zend_str_size_int number_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; double element_double; @@ -394,7 +394,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe /* {{{ php_oci_collection_append_string() Append STRING to the end of the collection */ -int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC) +int php_oci_collection_append_string(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; OCIString *ocistr = (OCIString *)0; @@ -432,7 +432,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme /* {{{ php_oci_collection_append() Append wrapper. Appends any supported element to the end of the collection */ -int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC) +int php_oci_collection_append(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC) { if (element_len == 0) { return php_oci_collection_append_null(collection TSRMLS_CC); @@ -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, php_int_t 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, php_int_t 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, php_int_t index, char *date, zend_str_size_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, php_int_t index, char *number, zend_str_size_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, php_int_t index, char *element, zend_str_size_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, php_int_t index, char *value, zend_str_size_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 1dc5e33..58386cf 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -51,12 +51,12 @@ PHP_FUNCTION(oci_define_by_name) { zval *stmt, *var; char *name; - int name_len; - long type = 0; + zend_str_size_int name_len; + php_int_t type = 0; php_oci_statement *statement; php_oci_define *define, *tmp_define; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|l", &stmt, &name, &name_len, &var, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rSz/|i", &stmt, &name, &name_len, &var, &type) == FAILURE) { return; } @@ -98,14 +98,14 @@ 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; + zend_str_size_int name_len; + php_int_t maxlen = -1, type = 0; char *name; zval *z_statement; zval *bind_var = NULL; php_oci_statement *statement; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rSz/|ii", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) { return; } @@ -126,16 +126,16 @@ 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; + zend_str_size_int name_len; + php_int_t max_item_len = -1; + php_int_t max_array_len = 0; + php_int_t type = SQLT_AFC; char *name; zval *z_statement; zval *bind_var = NULL; php_oci_statement *statement; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/l|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rSz/i|ii", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) { return; } @@ -189,17 +189,17 @@ PHP_FUNCTION(oci_lob_save) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *data; - int data_len; - long offset = 0; + zend_str_size_int data_len; + php_int_t offset = 0; ub4 bytes_written; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &data, &data_len, &offset) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|i", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &offset) == FAILURE) { return; } } @@ -230,22 +230,22 @@ PHP_FUNCTION(oci_lob_import) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *filename; - int filename_len; + zend_str_size_int filename_len; if (getThis()) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &filename, &filename_len) == FAILURE) { #endif return; } } else { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OP", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { #endif return; } @@ -313,17 +313,17 @@ PHP_FUNCTION(oci_lob_read) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long length; + php_int_t length; char *buffer; ub4 buffer_len; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &length) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) { return; } } @@ -438,16 +438,16 @@ PHP_FUNCTION(oci_lob_seek) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long offset, whence = PHP_OCI_SEEK_SET; + php_int_t offset, whence = PHP_OCI_SEEK_SET; ub4 lob_length; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &offset, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &offset, &whence) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|l", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi|i", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) { return; } } @@ -518,13 +518,13 @@ PHP_FUNCTION(oci_lob_write) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - int data_len; - long write_len = 0; + zend_str_size_int data_len; + php_int_t write_len = 0; ub4 bytes_written; char *data; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &write_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &data, &data_len, &write_len) == FAILURE) { return; } @@ -533,7 +533,7 @@ PHP_FUNCTION(oci_lob_write) } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|i", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) { return; } @@ -605,16 +605,16 @@ PHP_FUNCTION(oci_lob_truncate) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long trim_length = 0; + php_int_t trim_length = 0; ub4 ub_trim_length; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &trim_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &trim_length) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) { return; } } @@ -646,10 +646,10 @@ PHP_FUNCTION(oci_lob_erase) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; ub4 bytes_erased; - long offset = -1, length = -1; + php_int_t offset = -1, length = -1; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &offset, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &offset, &length) == FAILURE) { return; } @@ -664,7 +664,7 @@ PHP_FUNCTION(oci_lob_erase) } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ii", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) { return; } @@ -699,15 +699,15 @@ PHP_FUNCTION(oci_lob_flush) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long flush_flag = 0; + php_int_t flush_flag = 0; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flush_flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flush_flag) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &z_descriptor, oci_lob_class_entry_ptr, &flush_flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &z_descriptor, oci_lob_class_entry_ptr, &flush_flag) == FAILURE) { return; } } @@ -797,9 +797,9 @@ 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; + php_int_t 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO|i", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) { return; } @@ -877,16 +877,16 @@ PHP_FUNCTION(oci_lob_export) php_oci_descriptor *descriptor; char *filename; char *buffer; - int filename_len; - long start = -1, length = -1, block_length; + zend_str_size_int filename_len; + php_int_t start = -1, length = -1, block_length; php_stream *stream; ub4 lob_length; if (getThis()) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ll", &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ii", &filename, &filename_len, &start, &length) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &filename, &filename_len, &start, &length) == FAILURE) { #endif return; } @@ -902,9 +902,9 @@ PHP_FUNCTION(oci_lob_export) } else { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OP|ii", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|ii", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { #endif return; } @@ -1009,16 +1009,16 @@ 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; + zend_str_size_int data_len; + php_int_t type = OCI_TEMP_CLOB; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &data, &data_len, &type) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|i", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) { return; } } @@ -1071,9 +1071,9 @@ PHP_FUNCTION(oci_new_descriptor) zval *z_connection; php_oci_connection *connection; php_oci_descriptor *descriptor; - long type = OCI_DTYPE_LOB; + php_int_t type = OCI_DTYPE_LOB; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_connection, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &z_connection, &type) == FAILURE) { return; } @@ -1318,9 +1318,9 @@ PHP_FUNCTION(oci_execute) { zval *z_statement; php_oci_statement *statement; - long mode = OCI_COMMIT_ON_SUCCESS; + php_int_t mode = OCI_COMMIT_ON_SUCCESS; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &z_statement, &mode) == FAILURE) { return; } @@ -1392,9 +1392,9 @@ PHP_FUNCTION(oci_fetch_all) zval ***outarrs; ub4 nrows = 1; int i; - long rows = 0, flags = 0, skip = 0, maxrows = -1; + php_int_t 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|iii", &z_statement, &array, &skip, &maxrows, &flags) == FAILURE) { return; } @@ -1694,9 +1694,9 @@ PHP_FUNCTION(oci_parse) php_oci_connection *connection; php_oci_statement *statement; char *query; - int query_len; + zend_str_size_int query_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &query, &query_len) == FAILURE) { return; } @@ -1717,9 +1717,9 @@ PHP_FUNCTION(oci_set_prefetch) { zval *z_statement; php_oci_statement *statement; - long size; + php_int_t size; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_statement, &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &z_statement, &size) == FAILURE) { return; } @@ -1744,10 +1744,10 @@ PHP_FUNCTION(oci_set_client_identifier) zval *z_connection; php_oci_connection *connection; char *client_id; - int client_id_len; + zend_str_size_int client_id_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &client_id, &client_id_len) == FAILURE) { return; } @@ -1794,9 +1794,9 @@ PHP_FUNCTION(oci_set_edition) { #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) char *edition; - int edition_len; + zend_str_size_int edition_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &edition, &edition_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &edition, &edition_len) == FAILURE) { return; } @@ -1828,10 +1828,10 @@ PHP_FUNCTION(oci_set_module_name) zval *z_connection; php_oci_connection *connection; char *module; - int module_len; + zend_str_size_int module_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &module, &module_len) == FAILURE) { return; } @@ -1860,10 +1860,10 @@ PHP_FUNCTION(oci_set_action) zval *z_connection; php_oci_connection *connection; char *action; - int action_len; + zend_str_size_int action_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &action, &action_len) == FAILURE) { return; } @@ -1892,10 +1892,10 @@ PHP_FUNCTION(oci_set_client_info) zval *z_connection; php_oci_connection *connection; char *client_info; - int client_info_len; + zend_str_size_int client_info_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &client_info, &client_info_len) == FAILURE) { return; } @@ -1925,9 +1925,9 @@ PHP_FUNCTION(oci_set_db_operation) zval *z_connection; php_oci_connection *connection; char *dbop_name; - int dbop_name_len; + zend_str_size_int dbop_name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) { return; } @@ -1954,7 +1954,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; + zend_str_size_int 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) @@ -1965,7 +1965,7 @@ PHP_FUNCTION(oci_password_change) } #endif - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rSSS", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); if (!user_len) { @@ -1985,7 +1985,7 @@ PHP_FUNCTION(oci_password_change) RETURN_FALSE; } RETURN_TRUE; - } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &dbname, &dbname_len, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { + } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "SSSS", &dbname, &dbname_len, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { if (!user_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "username cannot be empty"); @@ -2190,15 +2190,15 @@ PHP_FUNCTION(oci_collection_append) zval **tmp, *z_collection = getThis(); php_oci_collection *collection; char *value; - int value_len; + zend_str_size_int value_len; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &value, &value_len) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) { return; } } @@ -2223,16 +2223,16 @@ PHP_FUNCTION(oci_collection_element_get) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long element_index; + php_int_t element_index; zval *value; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &element_index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &element_index) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) { return; } } @@ -2298,17 +2298,17 @@ PHP_FUNCTION(oci_collection_element_assign) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - int value_len; - long element_index; + zend_str_size_int value_len; + php_int_t element_index; char *value; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &element_index, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS", &element_index, &value, &value_len) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OiS", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) { return; } } @@ -2361,7 +2361,7 @@ PHP_FUNCTION(oci_collection_max) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long max; + php_int_t max; if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { @@ -2389,15 +2389,15 @@ PHP_FUNCTION(oci_collection_trim) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long trim_size; + php_int_t trim_size; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &trim_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &trim_size) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) { return; } } @@ -2424,9 +2424,9 @@ PHP_FUNCTION(oci_new_collection) php_oci_connection *connection; php_oci_collection *collection; char *tdo, *schema = NULL; - int tdo_len, schema_len = 0; + zend_str_size_int 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) { + 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 4f58c65..da4c18f 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, php_int_t type TSRMLS_DC) { php_oci_descriptor *descriptor; sword errstatus; @@ -209,7 +209,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 php_int_t php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, php_int_t read_length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; ub4 chunk_size; @@ -240,11 +240,11 @@ 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, php_int_t read_length, php_int_t initial_offset, char **data, ub4 *data_len TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; ub4 length = 0; - int buffer_size = PHP_OCI_LOB_BUFFER_SIZE; + php_int_t buffer_size = PHP_OCI_LOB_BUFFER_SIZE; php_oci_lob_ctx ctx; ub1 *bufp; oraub8 bytes_read, offset = 0; @@ -400,7 +400,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini /* {{{ php_oci_lob_write() Write data to the LOB */ -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_write (php_oci_descriptor *descriptor, ub4 offset, char *data, zend_str_size_int data_len, ub4 *bytes_written TSRMLS_DC) { OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor; php_oci_connection *connection = (php_oci_connection *) descriptor->connection; @@ -512,7 +512,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, php_int_t length TSRMLS_DC) { php_oci_connection *connection = descriptor_dest->connection; ub4 length_dest, length_from, copy_len; @@ -618,7 +618,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, php_int_t flush_flag TSRMLS_DC) { OCILobLocator *lob = descriptor->descriptor; php_oci_connection *connection = descriptor->connection; @@ -805,7 +805,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, php_int_t new_lob_length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; @@ -847,7 +847,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, php_int_t offset, ub4 length, ub4 *bytes_erased TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; @@ -905,7 +905,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, php_int_t type, char *data, zend_str_size_int data_len TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 43b2cea..87ccc9e 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -43,7 +43,7 @@ /* {{{ php_oci_statement_create() Create statemend handle and allocate necessary resources */ -php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC) +php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, zend_str_size_int query_len TSRMLS_DC) { php_oci_statement *statement; sword errstatus; @@ -371,7 +371,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, php_int_t column_index, char *column_name, zend_str_size_int column_name_len TSRMLS_DC) { php_oci_out_column *column = NULL; int i; @@ -972,18 +972,18 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) zval_dtor(val); ZVAL_NULL(val); } else if (Z_TYPE_P(bind->zval) == IS_STRING - && Z_STRLEN_P(bind->zval) > 0 - && Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] != '\0') { + && Z_STRSIZE_P(bind->zval) > 0 + && Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] != '\0') { /* The post- PHP 5.3 feature for "interned" strings disallows * their reallocation but (i) any IN binds either interned or * not should already be null terminated and (ii) for OUT * binds, php_oci_bind_out_callback() should have allocated a * new string that we can modify here. */ - Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1); - Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; + Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRSIZE_P(bind->zval)+1); + Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] = '\0'; } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) { - int i; + ub4 i; zval **entry; HashTable *hash = HASH_OF(bind->zval); @@ -1056,7 +1056,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) case SQLT_LVC: for (i = 0; i < bind->array.current_length; i++) { /* int curr_element_length = strlen(((text *)bind->array.elements)+i*bind->array.max_length); */ - int curr_element_length = bind->array.element_lengths[i]; + zend_str_size_int curr_element_length = bind->array.element_lengths[i]; if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { zval_dtor(*entry); ZVAL_STRINGL(*entry, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1); @@ -1075,7 +1075,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, zend_str_size_int name_len, zval *var, php_int_t maxlength, ub2 type TSRMLS_DC) { php_oci_collection *bind_collection = NULL; php_oci_descriptor *bind_descriptor = NULL; @@ -1158,7 +1158,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, convert_to_string(var); } if (maxlength == -1) { - value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0; + value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRSIZE_P(var) : 0; } else { value_sz = maxlength; } @@ -1314,7 +1314,7 @@ sb4 php_oci_bind_in_callback( convert_to_string(val); *bufpp = Z_STRVAL_P(val); - *alenp = Z_STRLEN_P(val); + *alenp = Z_STRSIZE_P(val); *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->statement != 0) { /* RSET */ @@ -1396,11 +1396,11 @@ sb4 php_oci_bind_out_callback( convert_to_string(val); zval_dtor(val); - Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1); + Z_STRSIZE_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ + Z_STRVAL_P(val) = ecalloc(1, Z_STRSIZE_P(phpbind->zval) + 1); /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); + *alenpp = (ub4*) &Z_STRSIZE_P(phpbind->zval); *bufpp = Z_STRVAL_P(phpbind->zval); *piecep = OCI_ONE_PIECE; *rcodepp = &phpbind->retcode; @@ -1435,7 +1435,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME } if (Z_TYPE_P(column_index) == IS_STRING) { - column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_index) TSRMLS_CC); + column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRSIZE_P(column_index) TSRMLS_CC); if (!column) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index)); return NULL; @@ -1448,7 +1448,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; } @@ -1506,7 +1506,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, zend_str_size_int name_len, zval *var, php_int_t max_table_length, php_int_t maxlength, php_int_t type TSRMLS_DC) { php_oci_bind *bind, *bindp; sword errstatus; @@ -1514,7 +1514,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 (%pu)", maxlength); return 1; } @@ -1608,7 +1608,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, php_int_t max_table_length, php_int_t maxlength TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1621,8 +1621,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - if (Z_STRLEN_PP(entry) > maxlength) { - maxlength = Z_STRLEN_PP(entry) + 1; + if (Z_STRSIZE_PP(entry) > maxlength) { + maxlength = Z_STRSIZE_PP(entry) + 1; } zend_hash_move_forward(hash); } @@ -1644,8 +1644,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, for (i = 0; i < bind->array.current_length; i++) { if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - bind->array.element_lengths[i] = Z_STRLEN_PP(entry); - if (Z_STRLEN_PP(entry) == 0) { + bind->array.element_lengths[i] = Z_STRSIZE_PP(entry); + if (Z_STRSIZE_PP(entry) == 0) { bind->array.indicators[i] = -1; } zend_hash_move_forward(hash); @@ -1657,10 +1657,10 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); for (i = 0; i < max_table_length; i++) { if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - int element_length; + zend_str_size_int element_length; convert_to_string_ex(entry); - element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength; + element_length = (maxlength > Z_STRSIZE_PP(entry)) ? Z_STRSIZE_PP(entry) : maxlength; memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length); ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; @@ -1678,7 +1678,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, php_int_t max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1717,7 +1717,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, php_int_t max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1756,7 +1756,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, php_int_t max_table_length, php_oci_connection *connection TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1784,7 +1784,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry), NULL, 0, NULL, 0, &oci_date)); if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index e50983d..e9e1cf0 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -120,7 +120,7 @@ extern zend_class_entry *oci_coll_class_entry_ptr; /* {{{ php_oci_spool */ typedef struct { - int id; /* resource id */ + php_int_t id; /* resource id */ OCIEnv *env; /* env of this session pool */ OCIError *err; /* pool's error handle */ OCISPool *poolh; /* pool handle */ @@ -132,7 +132,7 @@ typedef struct { /* {{{ php_oci_connection */ typedef struct { - int id; /* resource ID */ + php_int_t id; /* resource ID */ OCIEnv *env; /* private env handle */ ub2 charset; /* charset ID */ OCIServer *server; /* private server handle */ @@ -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 */ + php_uint_t 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 */ @@ -164,13 +164,13 @@ typedef struct { /* {{{ php_oci_descriptor */ typedef struct { - int id; - ulong index; /* descriptors hash table index */ + php_int_t id; + php_uint_t index; /* descriptors hash table index */ php_oci_connection *connection; /* parent connection handle */ dvoid *descriptor; /* OCI descriptor handle */ ub4 type; /* descriptor type (FILE/LOB) */ - int lob_current_position; /* LOB internal pointer */ - int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */ + php_int_t lob_current_position; /* LOB internal pointer */ + php_int_t lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */ int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */ ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */ ub1 charset_form; /* charset form, required for NCLOBs */ @@ -189,7 +189,7 @@ typedef struct { /* {{{ php_oci_collection */ typedef struct { - int id; + php_int_t id; php_oci_connection *connection; /* parent connection handle */ OCIType *tdo; /* collection's type handle */ OCITypeCode coll_typecode; /* collection's typecode handle */ @@ -211,8 +211,8 @@ typedef struct { /* {{{ php_oci_statement */ typedef struct { - int id; - int parent_stmtid; /* parent statement id */ + php_int_t id; + php_int_t parent_stmtid; /* parent statement id */ struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */ ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */ php_oci_connection *connection; /* parent connection handle */ @@ -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 recieved from Oracle */ char impres_flag; /* PHP_OCI_IMPRES_*_ */ - long last_query_len; /* last query length */ + php_int_t 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; + php_int_t type; } array; sb2 indicator; /* -1 means NULL */ ub2 retcode; @@ -273,7 +273,7 @@ typedef struct { ub4 retlen4; ub2 is_descr; /* column contains a descriptor */ ub2 is_cursor; /* column contains a cursor */ - int stmtid; /* statement id for cursors */ + php_int_t stmtid; /* statement id for cursors */ int descid; /* descriptor id for descriptors */ void *data; php_oci_define *define; /* define handle */ @@ -406,88 +406,88 @@ 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, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, char *dbname, zend_str_size_int dbname_len, char *charset, php_int_t 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); -int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC); +int php_oci_password_change(php_oci_connection *connection, char *user, zend_str_size_int user_len, char *pass_old, zend_str_size_int pass_old_len, char *pass_new, zend_str_size_int pass_new_len TSRMLS_DC); void php_oci_client_get_version(char **version TSRMLS_DC); int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC); void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args); -int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC); +int php_oci_column_to_zval(php_oci_out_column *column, zval *value, php_int_t mode TSRMLS_DC); void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus); /* }}} */ /* {{{ 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, php_int_t 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_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_read(php_oci_descriptor *descriptor, php_int_t read_length, php_int_t inital_offset, char **data, ub4 *data_len TSRMLS_DC); +int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, zend_str_size_int data_len, ub4 *bytes_written TSRMLS_DC); +int php_oci_lob_flush(php_oci_descriptor *descriptor, php_int_t 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, php_int_t 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, php_int_t type, char *data, zend_str_size_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, php_int_t new_lob_length TSRMLS_DC); +int php_oci_lob_erase(php_oci_descriptor *descriptor, php_int_t 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); /* }}} */ /* {{{ collection related prototypes */ -php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC); +php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, zend_str_size_int tdo_len, char *schema, zend_str_size_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_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_max(php_oci_collection *collection, php_int_t *max TSRMLS_DC); +int php_oci_collection_trim(php_oci_collection *collection, php_int_t trim_size TSRMLS_DC); +int php_oci_collection_append(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC); +int php_oci_collection_element_get(php_oci_collection *collection, php_int_t index, zval **result_element TSRMLS_DC); +int php_oci_collection_element_set(php_oci_collection *collection, php_int_t index, char *value, zend_str_size_int value_len TSRMLS_DC); +int php_oci_collection_element_set_null(php_oci_collection *collection, php_int_t index TSRMLS_DC); +int php_oci_collection_element_set_date(php_oci_collection *collection, php_int_t index, char *date, zend_str_size_int date_len TSRMLS_DC); +int php_oci_collection_element_set_number(php_oci_collection *collection, php_int_t index, char *number, zend_str_size_int number_len TSRMLS_DC); +int php_oci_collection_element_set_string(php_oci_collection *collection, php_int_t index, char *element, zend_str_size_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); -int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC); -int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC); -int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC); +int php_oci_collection_append_date(php_oci_collection *collection, char *date, zend_str_size_int date_len TSRMLS_DC); +int php_oci_collection_append_number(php_oci_collection *collection, char *number, zend_str_size_int number_len TSRMLS_DC); +int php_oci_collection_append_string(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC); /* }}} */ /* {{{ statement related prototypes */ -php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC); +php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, zend_str_size_int query_len TSRMLS_DC); 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, php_int_t column_index, char *column_name, zend_str_size_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, zend_str_size_int name_len, zval *var, php_int_t 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, zend_str_size_int name_len, zval *var, php_int_t max_table_length, php_int_t maxlength, php_int_t type TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_number(zval *var, php_int_t max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_double(zval *var, php_int_t max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_string(zval *var, php_int_t max_table_length, php_int_t maxlength TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_date(zval *var, php_int_t max_table_length, php_oci_connection *connection TSRMLS_DC); /* }}} */ @@ -495,14 +495,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 */ + php_int_t max_persistent; /* maximum number of persistent connections per process */ + php_int_t num_persistent; /* number of existing persistent connections */ + php_int_t num_links; /* non-persistent + persistent connections */ + php_int_t num_statements; /* number of statements open */ + php_int_t ping_interval; /* time interval between pings */ + php_int_t persistent_timeout; /* time period after which idle persistent connection is considered expired */ + php_int_t statement_cache_size; /* statement cache size. used with 9i+ clients only*/ + php_int_t 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) */
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 1e505f1..a6c8823 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -137,10 +137,10 @@ static int php_oci_connection_close(php_oci_connection * TSRMLS_DC); static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC); static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC); -static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC); -static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC); -static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, int charsetid TSRMLS_DC); -static php_oci_spool *php_oci_create_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, char *hash_key, int hash_key_len, int charsetid TSRMLS_DC); +static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC); +static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC); +static php_oci_spool *php_oci_get_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, int charsetid TSRMLS_DC); +static php_oci_spool *php_oci_create_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, char *hash_key, zend_str_size_int hash_key_len, int charsetid TSRMLS_DC); static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TSRMLS_DC); /* }}} */ @@ -1129,7 +1129,7 @@ static void php_oci_init_global_handles(TSRMLS_D) OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ERROR); if (ora_error_code) { - int tmp_buf_len = strlen((char *)tmp_buf); + zend_str_size_int tmp_buf_len = strlen((char *)tmp_buf); if (tmp_buf_len > 0 && tmp_buf[tmp_buf_len - 1] == '\n') { tmp_buf[tmp_buf_len - 1] = '\0'; @@ -1699,7 +1699,7 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) PHP_OCI_CALL(OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, err_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR)); if (error_code) { - int err_buf_len = strlen((char *)err_buf); + zend_str_size_int err_buf_len = strlen((char *)err_buf); if (err_buf_len && err_buf[err_buf_len - 1] == '\n') { err_buf[err_buf_len - 1] = '\0'; @@ -1751,12 +1751,12 @@ 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; + zend_str_size_int username_len = 0, password_len = 0; + zend_str_size_int dbname_len = 0, charset_len = 0; + php_int_t 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|SSi", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) { return; } @@ -1792,7 +1792,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, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, char *dbname, zend_str_size_int dbname_len, char *charset, php_int_t session_mode, int persistent, int exclusive TSRMLS_DC) { zend_rsrc_list_entry *le; zend_rsrc_list_entry new_le; @@ -1881,7 +1881,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; + php_uint_t password_hash; password_hash = zend_inline_hash_func(password, password_len); smart_str_append_unsigned_ex(&hashed_details, password_hash, 0); } @@ -2471,7 +2471,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) * * Change password for the user with the username given */ -int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC) +int php_oci_password_change(php_oci_connection *connection, char *user, zend_str_size_int user_len, char *pass_old, zend_str_size_int pass_old_len, char *pass_new, zend_str_size_int pass_new_len TSRMLS_DC) { sword errstatus; @@ -2537,7 +2537,7 @@ int php_oci_server_get_version(php_oci_connection *connection, char **version TS * * Convert php_oci_out_column struct into zval */ -int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC) +int php_oci_column_to_zval(php_oci_out_column *column, zval *value, php_int_t mode TSRMLS_DC) { php_oci_descriptor *descriptor; ub4 lob_length; @@ -2631,12 +2631,12 @@ 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; + php_int_t fetch_mode = 0; if (expected_args > 2) { /* only for ocifetchinto BC */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|l", &z_statement, &array, &fetch_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|i", &z_statement, &array, &fetch_mode) == FAILURE) { return; } @@ -2646,7 +2646,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg } else if (expected_args == 2) { /* only for oci_fetch_array() */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &fetch_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &z_statement, &fetch_mode) == FAILURE) { return; } @@ -2815,7 +2815,7 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) * * Create(alloc + Init) Session pool for the given dbname and charsetid */ -static php_oci_spool *php_oci_create_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, char *hash_key, int hash_key_len, int charsetid TSRMLS_DC) +static php_oci_spool *php_oci_create_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, char *hash_key, zend_str_size_int hash_key_len, int charsetid TSRMLS_DC) { php_oci_spool *session_pool = NULL; zend_bool iserror = 0; @@ -2952,7 +2952,7 @@ exit_create_spool: * Get Session pool for the given dbname and charsetid from the persistent list. Function called for * non-persistent connections. */ -static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *password, int password_len, char *dbname, int dbname_len, int charsetid TSRMLS_DC) +static php_oci_spool *php_oci_get_spool(char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *dbname, zend_str_size_int dbname_len, int charsetid TSRMLS_DC) { smart_str spool_hashed_details = {0}; php_oci_spool *session_pool = NULL; @@ -2970,7 +2970,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; + php_uint_t password_hash; password_hash = zend_inline_hash_func(password, password_len); smart_str_append_unsigned_ex(&spool_hashed_details, password_hash, 0); } @@ -3057,7 +3057,7 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC) * This function is to be deprecated in future in favour of OCISessionGet which is used in * php_oci_do_connect_ex */ -static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC) +static int php_oci_old_create_session(php_oci_connection *connection, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC) { ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0; @@ -3240,7 +3240,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna * * Create session using client-side session pool - new norm */ -static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, int dbname_len, char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, int session_mode TSRMLS_DC) +static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *session_pool, char *dbname, zend_str_size_int dbname_len, char *username, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, php_int_t session_mode TSRMLS_DC) { php_oci_spool *actual_spool = NULL; #if (OCI_MAJOR_VERSION > 10) diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 35b70fa..2e95a9d 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -44,7 +44,7 @@ /* {{{ php_oci_collection_create() Create and return connection handle */ -php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) +php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, zend_str_size_int tdo_len, char *schema, zend_str_size_int schema_len TSRMLS_DC) { dvoid *dschp1 = NULL; dvoid *parmp1; @@ -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, php_int_t *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, php_int_t trim_size TSRMLS_DC) { php_oci_connection *connection = collection->connection; sword errstatus; @@ -313,7 +313,7 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC) /* {{{ php_oci_collection_append_date() Append DATE element to the end of the collection (use "DD-MON-YY" format) */ -int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC) +int php_oci_collection_append_date(php_oci_collection *collection, char *date, zend_str_size_int date_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; OCIDate oci_date; @@ -353,7 +353,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i /* {{{ php_oci_collection_append_number() Append NUMBER to the end of the collection */ -int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC) +int php_oci_collection_append_number(php_oci_collection *collection, char *number, zend_str_size_int number_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; double element_double; @@ -394,7 +394,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe /* {{{ php_oci_collection_append_string() Append STRING to the end of the collection */ -int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC) +int php_oci_collection_append_string(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC) { OCIInd new_index = OCI_IND_NOTNULL; OCIString *ocistr = (OCIString *)0; @@ -432,7 +432,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme /* {{{ php_oci_collection_append() Append wrapper. Appends any supported element to the end of the collection */ -int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC) +int php_oci_collection_append(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC) { if (element_len == 0) { return php_oci_collection_append_null(collection TSRMLS_CC); @@ -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, php_int_t 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, php_int_t 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, php_int_t index, char *date, zend_str_size_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, php_int_t index, char *number, zend_str_size_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, php_int_t index, char *element, zend_str_size_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, php_int_t index, char *value, zend_str_size_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 1dc5e33..58386cf 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -51,12 +51,12 @@ PHP_FUNCTION(oci_define_by_name) { zval *stmt, *var; char *name; - int name_len; - long type = 0; + zend_str_size_int name_len; + php_int_t type = 0; php_oci_statement *statement; php_oci_define *define, *tmp_define; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|l", &stmt, &name, &name_len, &var, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rSz/|i", &stmt, &name, &name_len, &var, &type) == FAILURE) { return; } @@ -98,14 +98,14 @@ 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; + zend_str_size_int name_len; + php_int_t maxlen = -1, type = 0; char *name; zval *z_statement; zval *bind_var = NULL; php_oci_statement *statement; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rSz/|ii", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) { return; } @@ -126,16 +126,16 @@ 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; + zend_str_size_int name_len; + php_int_t max_item_len = -1; + php_int_t max_array_len = 0; + php_int_t type = SQLT_AFC; char *name; zval *z_statement; zval *bind_var = NULL; php_oci_statement *statement; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz/l|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rSz/i|ii", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) { return; } @@ -189,17 +189,17 @@ PHP_FUNCTION(oci_lob_save) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *data; - int data_len; - long offset = 0; + zend_str_size_int data_len; + php_int_t offset = 0; ub4 bytes_written; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &data, &data_len, &offset) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|i", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &offset) == FAILURE) { return; } } @@ -230,22 +230,22 @@ PHP_FUNCTION(oci_lob_import) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; char *filename; - int filename_len; + zend_str_size_int filename_len; if (getThis()) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &filename, &filename_len) == FAILURE) { #endif return; } } else { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OP", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) { #endif return; } @@ -313,17 +313,17 @@ PHP_FUNCTION(oci_lob_read) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long length; + php_int_t length; char *buffer; ub4 buffer_len; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &length) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) { return; } } @@ -438,16 +438,16 @@ PHP_FUNCTION(oci_lob_seek) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long offset, whence = PHP_OCI_SEEK_SET; + php_int_t offset, whence = PHP_OCI_SEEK_SET; ub4 lob_length; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &offset, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &offset, &whence) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|l", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi|i", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) { return; } } @@ -518,13 +518,13 @@ PHP_FUNCTION(oci_lob_write) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - int data_len; - long write_len = 0; + zend_str_size_int data_len; + php_int_t write_len = 0; ub4 bytes_written; char *data; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &write_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &data, &data_len, &write_len) == FAILURE) { return; } @@ -533,7 +533,7 @@ PHP_FUNCTION(oci_lob_write) } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|i", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) { return; } @@ -605,16 +605,16 @@ PHP_FUNCTION(oci_lob_truncate) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long trim_length = 0; + php_int_t trim_length = 0; ub4 ub_trim_length; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &trim_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &trim_length) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) { return; } } @@ -646,10 +646,10 @@ PHP_FUNCTION(oci_lob_erase) zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; ub4 bytes_erased; - long offset = -1, length = -1; + php_int_t offset = -1, length = -1; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &offset, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &offset, &length) == FAILURE) { return; } @@ -664,7 +664,7 @@ PHP_FUNCTION(oci_lob_erase) } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ii", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) { return; } @@ -699,15 +699,15 @@ PHP_FUNCTION(oci_lob_flush) { zval **tmp, *z_descriptor = getThis(); php_oci_descriptor *descriptor; - long flush_flag = 0; + php_int_t flush_flag = 0; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flush_flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flush_flag) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &z_descriptor, oci_lob_class_entry_ptr, &flush_flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &z_descriptor, oci_lob_class_entry_ptr, &flush_flag) == FAILURE) { return; } } @@ -797,9 +797,9 @@ 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; + php_int_t 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO|i", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) { return; } @@ -877,16 +877,16 @@ PHP_FUNCTION(oci_lob_export) php_oci_descriptor *descriptor; char *filename; char *buffer; - int filename_len; - long start = -1, length = -1, block_length; + zend_str_size_int filename_len; + php_int_t start = -1, length = -1, block_length; php_stream *stream; ub4 lob_length; if (getThis()) { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ll", &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ii", &filename, &filename_len, &start, &length) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &filename, &filename_len, &start, &length) == FAILURE) { #endif return; } @@ -902,9 +902,9 @@ PHP_FUNCTION(oci_lob_export) } else { #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OP|ii", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|ii", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) { #endif return; } @@ -1009,16 +1009,16 @@ 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; + zend_str_size_int data_len; + php_int_t type = OCI_TEMP_CLOB; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &data, &data_len, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &data, &data_len, &type) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|i", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) { return; } } @@ -1071,9 +1071,9 @@ PHP_FUNCTION(oci_new_descriptor) zval *z_connection; php_oci_connection *connection; php_oci_descriptor *descriptor; - long type = OCI_DTYPE_LOB; + php_int_t type = OCI_DTYPE_LOB; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_connection, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &z_connection, &type) == FAILURE) { return; } @@ -1318,9 +1318,9 @@ PHP_FUNCTION(oci_execute) { zval *z_statement; php_oci_statement *statement; - long mode = OCI_COMMIT_ON_SUCCESS; + php_int_t mode = OCI_COMMIT_ON_SUCCESS; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &z_statement, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &z_statement, &mode) == FAILURE) { return; } @@ -1392,9 +1392,9 @@ PHP_FUNCTION(oci_fetch_all) zval ***outarrs; ub4 nrows = 1; int i; - long rows = 0, flags = 0, skip = 0, maxrows = -1; + php_int_t 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) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|iii", &z_statement, &array, &skip, &maxrows, &flags) == FAILURE) { return; } @@ -1694,9 +1694,9 @@ PHP_FUNCTION(oci_parse) php_oci_connection *connection; php_oci_statement *statement; char *query; - int query_len; + zend_str_size_int query_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &query, &query_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &query, &query_len) == FAILURE) { return; } @@ -1717,9 +1717,9 @@ PHP_FUNCTION(oci_set_prefetch) { zval *z_statement; php_oci_statement *statement; - long size; + php_int_t size; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_statement, &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &z_statement, &size) == FAILURE) { return; } @@ -1744,10 +1744,10 @@ PHP_FUNCTION(oci_set_client_identifier) zval *z_connection; php_oci_connection *connection; char *client_id; - int client_id_len; + zend_str_size_int client_id_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &client_id, &client_id_len) == FAILURE) { return; } @@ -1794,9 +1794,9 @@ PHP_FUNCTION(oci_set_edition) { #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) char *edition; - int edition_len; + zend_str_size_int edition_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &edition, &edition_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &edition, &edition_len) == FAILURE) { return; } @@ -1828,10 +1828,10 @@ PHP_FUNCTION(oci_set_module_name) zval *z_connection; php_oci_connection *connection; char *module; - int module_len; + zend_str_size_int module_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &module, &module_len) == FAILURE) { return; } @@ -1860,10 +1860,10 @@ PHP_FUNCTION(oci_set_action) zval *z_connection; php_oci_connection *connection; char *action; - int action_len; + zend_str_size_int action_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &action, &action_len) == FAILURE) { return; } @@ -1892,10 +1892,10 @@ PHP_FUNCTION(oci_set_client_info) zval *z_connection; php_oci_connection *connection; char *client_info; - int client_info_len; + zend_str_size_int client_info_len; sword errstatus; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &client_info, &client_info_len) == FAILURE) { return; } @@ -1925,9 +1925,9 @@ PHP_FUNCTION(oci_set_db_operation) zval *z_connection; php_oci_connection *connection; char *dbop_name; - int dbop_name_len; + zend_str_size_int dbop_name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) { return; } @@ -1954,7 +1954,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; + zend_str_size_int 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) @@ -1965,7 +1965,7 @@ PHP_FUNCTION(oci_password_change) } #endif - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rSSS", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); if (!user_len) { @@ -1985,7 +1985,7 @@ PHP_FUNCTION(oci_password_change) RETURN_FALSE; } RETURN_TRUE; - } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &dbname, &dbname_len, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { + } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "SSSS", &dbname, &dbname_len, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) { if (!user_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "username cannot be empty"); @@ -2190,15 +2190,15 @@ PHP_FUNCTION(oci_collection_append) zval **tmp, *z_collection = getThis(); php_oci_collection *collection; char *value; - int value_len; + zend_str_size_int value_len; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &value, &value_len) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) { return; } } @@ -2223,16 +2223,16 @@ PHP_FUNCTION(oci_collection_element_get) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long element_index; + php_int_t element_index; zval *value; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &element_index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &element_index) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) { return; } } @@ -2298,17 +2298,17 @@ PHP_FUNCTION(oci_collection_element_assign) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - int value_len; - long element_index; + zend_str_size_int value_len; + php_int_t element_index; char *value; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &element_index, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS", &element_index, &value, &value_len) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OiS", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) { return; } } @@ -2361,7 +2361,7 @@ PHP_FUNCTION(oci_collection_max) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long max; + php_int_t max; if (!getThis()) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) { @@ -2389,15 +2389,15 @@ PHP_FUNCTION(oci_collection_trim) { zval **tmp, *z_collection = getThis(); php_oci_collection *collection; - long trim_size; + php_int_t trim_size; if (getThis()) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &trim_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &trim_size) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) { return; } } @@ -2424,9 +2424,9 @@ PHP_FUNCTION(oci_new_collection) php_oci_connection *connection; php_oci_collection *collection; char *tdo, *schema = NULL; - int tdo_len, schema_len = 0; + zend_str_size_int 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) { + 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 4f58c65..da4c18f 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, php_int_t type TSRMLS_DC) { php_oci_descriptor *descriptor; sword errstatus; @@ -209,7 +209,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 php_int_t php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, php_int_t read_length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; ub4 chunk_size; @@ -240,11 +240,11 @@ 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, php_int_t read_length, php_int_t initial_offset, char **data, ub4 *data_len TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; ub4 length = 0; - int buffer_size = PHP_OCI_LOB_BUFFER_SIZE; + php_int_t buffer_size = PHP_OCI_LOB_BUFFER_SIZE; php_oci_lob_ctx ctx; ub1 *bufp; oraub8 bytes_read, offset = 0; @@ -400,7 +400,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini /* {{{ php_oci_lob_write() Write data to the LOB */ -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_write (php_oci_descriptor *descriptor, ub4 offset, char *data, zend_str_size_int data_len, ub4 *bytes_written TSRMLS_DC) { OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor; php_oci_connection *connection = (php_oci_connection *) descriptor->connection; @@ -512,7 +512,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, php_int_t length TSRMLS_DC) { php_oci_connection *connection = descriptor_dest->connection; ub4 length_dest, length_from, copy_len; @@ -618,7 +618,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, php_int_t flush_flag TSRMLS_DC) { OCILobLocator *lob = descriptor->descriptor; php_oci_connection *connection = descriptor->connection; @@ -805,7 +805,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, php_int_t new_lob_length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; @@ -847,7 +847,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, php_int_t offset, ub4 length, ub4 *bytes_erased TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; @@ -905,7 +905,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, php_int_t type, char *data, zend_str_size_int data_len TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 43b2cea..87ccc9e 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -43,7 +43,7 @@ /* {{{ php_oci_statement_create() Create statemend handle and allocate necessary resources */ -php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC) +php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, zend_str_size_int query_len TSRMLS_DC) { php_oci_statement *statement; sword errstatus; @@ -371,7 +371,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, php_int_t column_index, char *column_name, zend_str_size_int column_name_len TSRMLS_DC) { php_oci_out_column *column = NULL; int i; @@ -972,18 +972,18 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) zval_dtor(val); ZVAL_NULL(val); } else if (Z_TYPE_P(bind->zval) == IS_STRING - && Z_STRLEN_P(bind->zval) > 0 - && Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] != '\0') { + && Z_STRSIZE_P(bind->zval) > 0 + && Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] != '\0') { /* The post- PHP 5.3 feature for "interned" strings disallows * their reallocation but (i) any IN binds either interned or * not should already be null terminated and (ii) for OUT * binds, php_oci_bind_out_callback() should have allocated a * new string that we can modify here. */ - Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1); - Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; + Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRSIZE_P(bind->zval)+1); + Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] = '\0'; } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) { - int i; + ub4 i; zval **entry; HashTable *hash = HASH_OF(bind->zval); @@ -1056,7 +1056,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) case SQLT_LVC: for (i = 0; i < bind->array.current_length; i++) { /* int curr_element_length = strlen(((text *)bind->array.elements)+i*bind->array.max_length); */ - int curr_element_length = bind->array.element_lengths[i]; + zend_str_size_int curr_element_length = bind->array.element_lengths[i]; if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { zval_dtor(*entry); ZVAL_STRINGL(*entry, (char *)(((text *)bind->array.elements)+i*bind->array.max_length), curr_element_length, 1); @@ -1075,7 +1075,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, zend_str_size_int name_len, zval *var, php_int_t maxlength, ub2 type TSRMLS_DC) { php_oci_collection *bind_collection = NULL; php_oci_descriptor *bind_descriptor = NULL; @@ -1158,7 +1158,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, convert_to_string(var); } if (maxlength == -1) { - value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0; + value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRSIZE_P(var) : 0; } else { value_sz = maxlength; } @@ -1314,7 +1314,7 @@ sb4 php_oci_bind_in_callback( convert_to_string(val); *bufpp = Z_STRVAL_P(val); - *alenp = Z_STRLEN_P(val); + *alenp = Z_STRSIZE_P(val); *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->statement != 0) { /* RSET */ @@ -1396,11 +1396,11 @@ sb4 php_oci_bind_out_callback( convert_to_string(val); zval_dtor(val); - Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1); + Z_STRSIZE_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ + Z_STRVAL_P(val) = ecalloc(1, Z_STRSIZE_P(phpbind->zval) + 1); /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); + *alenpp = (ub4*) &Z_STRSIZE_P(phpbind->zval); *bufpp = Z_STRVAL_P(phpbind->zval); *piecep = OCI_ONE_PIECE; *rcodepp = &phpbind->retcode; @@ -1435,7 +1435,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME } if (Z_TYPE_P(column_index) == IS_STRING) { - column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_index) TSRMLS_CC); + column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRSIZE_P(column_index) TSRMLS_CC); if (!column) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index)); return NULL; @@ -1448,7 +1448,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; } @@ -1506,7 +1506,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, zend_str_size_int name_len, zval *var, php_int_t max_table_length, php_int_t maxlength, php_int_t type TSRMLS_DC) { php_oci_bind *bind, *bindp; sword errstatus; @@ -1514,7 +1514,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 (%pu)", maxlength); return 1; } @@ -1608,7 +1608,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, php_int_t max_table_length, php_int_t maxlength TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1621,8 +1621,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - if (Z_STRLEN_PP(entry) > maxlength) { - maxlength = Z_STRLEN_PP(entry) + 1; + if (Z_STRSIZE_PP(entry) > maxlength) { + maxlength = Z_STRSIZE_PP(entry) + 1; } zend_hash_move_forward(hash); } @@ -1644,8 +1644,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, for (i = 0; i < bind->array.current_length; i++) { if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - bind->array.element_lengths[i] = Z_STRLEN_PP(entry); - if (Z_STRLEN_PP(entry) == 0) { + bind->array.element_lengths[i] = Z_STRSIZE_PP(entry); + if (Z_STRSIZE_PP(entry) == 0) { bind->array.indicators[i] = -1; } zend_hash_move_forward(hash); @@ -1657,10 +1657,10 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); for (i = 0; i < max_table_length; i++) { if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - int element_length; + zend_str_size_int element_length; convert_to_string_ex(entry); - element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength; + element_length = (maxlength > Z_STRSIZE_PP(entry)) ? Z_STRSIZE_PP(entry) : maxlength; memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length); ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; @@ -1678,7 +1678,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, php_int_t max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1717,7 +1717,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, php_int_t max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1756,7 +1756,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, php_int_t max_table_length, php_oci_connection *connection TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1784,7 +1784,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry), NULL, 0, NULL, 0, &oci_date)); if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index e50983d..e9e1cf0 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -120,7 +120,7 @@ extern zend_class_entry *oci_coll_class_entry_ptr; /* {{{ php_oci_spool */ typedef struct { - int id; /* resource id */ + php_int_t id; /* resource id */ OCIEnv *env; /* env of this session pool */ OCIError *err; /* pool's error handle */ OCISPool *poolh; /* pool handle */ @@ -132,7 +132,7 @@ typedef struct { /* {{{ php_oci_connection */ typedef struct { - int id; /* resource ID */ + php_int_t id; /* resource ID */ OCIEnv *env; /* private env handle */ ub2 charset; /* charset ID */ OCIServer *server; /* private server handle */ @@ -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 */ + php_uint_t 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 */ @@ -164,13 +164,13 @@ typedef struct { /* {{{ php_oci_descriptor */ typedef struct { - int id; - ulong index; /* descriptors hash table index */ + php_int_t id; + php_uint_t index; /* descriptors hash table index */ php_oci_connection *connection; /* parent connection handle */ dvoid *descriptor; /* OCI descriptor handle */ ub4 type; /* descriptor type (FILE/LOB) */ - int lob_current_position; /* LOB internal pointer */ - int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */ + php_int_t lob_current_position; /* LOB internal pointer */ + php_int_t lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */ int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */ ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */ ub1 charset_form; /* charset form, required for NCLOBs */ @@ -189,7 +189,7 @@ typedef struct { /* {{{ php_oci_collection */ typedef struct { - int id; + php_int_t id; php_oci_connection *connection; /* parent connection handle */ OCIType *tdo; /* collection's type handle */ OCITypeCode coll_typecode; /* collection's typecode handle */ @@ -211,8 +211,8 @@ typedef struct { /* {{{ php_oci_statement */ typedef struct { - int id; - int parent_stmtid; /* parent statement id */ + php_int_t id; + php_int_t parent_stmtid; /* parent statement id */ struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */ ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */ php_oci_connection *connection; /* parent connection handle */ @@ -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 recieved from Oracle */ char impres_flag; /* PHP_OCI_IMPRES_*_ */ - long last_query_len; /* last query length */ + php_int_t 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; + php_int_t type; } array; sb2 indicator; /* -1 means NULL */ ub2 retcode; @@ -273,7 +273,7 @@ typedef struct { ub4 retlen4; ub2 is_descr; /* column contains a descriptor */ ub2 is_cursor; /* column contains a cursor */ - int stmtid; /* statement id for cursors */ + php_int_t stmtid; /* statement id for cursors */ int descid; /* descriptor id for descriptors */ void *data; php_oci_define *define; /* define handle */ @@ -406,88 +406,88 @@ 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, zend_str_size_int username_len, char *password, zend_str_size_int password_len, char *new_password, zend_str_size_int new_password_len, char *dbname, zend_str_size_int dbname_len, char *charset, php_int_t 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); -int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC); +int php_oci_password_change(php_oci_connection *connection, char *user, zend_str_size_int user_len, char *pass_old, zend_str_size_int pass_old_len, char *pass_new, zend_str_size_int pass_new_len TSRMLS_DC); void php_oci_client_get_version(char **version TSRMLS_DC); int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC); void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args); -int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC); +int php_oci_column_to_zval(php_oci_out_column *column, zval *value, php_int_t mode TSRMLS_DC); void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus); /* }}} */ /* {{{ 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, php_int_t 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_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_read(php_oci_descriptor *descriptor, php_int_t read_length, php_int_t inital_offset, char **data, ub4 *data_len TSRMLS_DC); +int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, zend_str_size_int data_len, ub4 *bytes_written TSRMLS_DC); +int php_oci_lob_flush(php_oci_descriptor *descriptor, php_int_t 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, php_int_t 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, php_int_t type, char *data, zend_str_size_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, php_int_t new_lob_length TSRMLS_DC); +int php_oci_lob_erase(php_oci_descriptor *descriptor, php_int_t 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); /* }}} */ /* {{{ collection related prototypes */ -php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC); +php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, zend_str_size_int tdo_len, char *schema, zend_str_size_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_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_max(php_oci_collection *collection, php_int_t *max TSRMLS_DC); +int php_oci_collection_trim(php_oci_collection *collection, php_int_t trim_size TSRMLS_DC); +int php_oci_collection_append(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC); +int php_oci_collection_element_get(php_oci_collection *collection, php_int_t index, zval **result_element TSRMLS_DC); +int php_oci_collection_element_set(php_oci_collection *collection, php_int_t index, char *value, zend_str_size_int value_len TSRMLS_DC); +int php_oci_collection_element_set_null(php_oci_collection *collection, php_int_t index TSRMLS_DC); +int php_oci_collection_element_set_date(php_oci_collection *collection, php_int_t index, char *date, zend_str_size_int date_len TSRMLS_DC); +int php_oci_collection_element_set_number(php_oci_collection *collection, php_int_t index, char *number, zend_str_size_int number_len TSRMLS_DC); +int php_oci_collection_element_set_string(php_oci_collection *collection, php_int_t index, char *element, zend_str_size_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); -int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC); -int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC); -int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC); +int php_oci_collection_append_date(php_oci_collection *collection, char *date, zend_str_size_int date_len TSRMLS_DC); +int php_oci_collection_append_number(php_oci_collection *collection, char *number, zend_str_size_int number_len TSRMLS_DC); +int php_oci_collection_append_string(php_oci_collection *collection, char *element, zend_str_size_int element_len TSRMLS_DC); /* }}} */ /* {{{ statement related prototypes */ -php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC); +php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, zend_str_size_int query_len TSRMLS_DC); 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, php_int_t column_index, char *column_name, zend_str_size_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, zend_str_size_int name_len, zval *var, php_int_t 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, zend_str_size_int name_len, zval *var, php_int_t max_table_length, php_int_t maxlength, php_int_t type TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_number(zval *var, php_int_t max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_double(zval *var, php_int_t max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_string(zval *var, php_int_t max_table_length, php_int_t maxlength TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_date(zval *var, php_int_t max_table_length, php_oci_connection *connection TSRMLS_DC); /* }}} */ @@ -495,14 +495,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 */ + php_int_t max_persistent; /* maximum number of persistent connections per process */ + php_int_t num_persistent; /* number of existing persistent connections */ + php_int_t num_links; /* non-persistent + persistent connections */ + php_int_t num_statements; /* number of statements open */ + php_int_t ping_interval; /* time interval between pings */ + php_int_t persistent_timeout; /* time period after which idle persistent connection is considered expired */ + php_int_t statement_cache_size; /* statement cache size. used with 9i+ clients only*/ + php_int_t 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) */