zval_ptr_dtor(&define->zval);
- if (define->name) {
- efree(define->name);
- define->name = NULL;
+ if (define->name.v) {
+ efree(define->name.v);
+ define->name.v = NULL;
}
}
/* }}} */
efree(column->data);
}
- if (column->name) {
- efree(column->name);
+ if (column->name.v) {
+ efree(column->name.v);
}
}
/* }}} */
case OCI_SUCCESS_WITH_INFO:
errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC);
if (errbuf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %s", errbuf);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: %R", (UG(unicode) ? IS_UNICODE : IS_STRING), errbuf);
efree(errbuf);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_SUCCESS_WITH_INFO: failed to fetch error message");
case OCI_ERROR:
errcode = php_oci_fetch_errmsg(err_p, &errbuf TSRMLS_CC);
if (errbuf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errbuf);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%R", (UG(unicode) ? IS_UNICODE : IS_STRING), errbuf);
efree(errbuf);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to fetch error message");
text tmp_buf[PHP_OCI_ERRBUF_LEN];
tmp_buf[0] = '\0';
-
+
+ memset(tmp_buf, 0, sizeof(tmp_buf));
PHP_OCI_CALL(OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR));
if (error_code) {
- int tmp_buf_len = strlen(tmp_buf);
-
- if (tmp_buf_len && tmp_buf[tmp_buf_len - 1] == '\n') {
- tmp_buf[tmp_buf_len - 1] = '\0';
+ int tmp_buf_len;
+ if (UG(unicode)) {
+ tmp_buf_len = u_strlen((UChar *)tmp_buf);
+ if (tmp_buf_len && tmp_buf[UBYTES(tmp_buf_len - 1)] == '\n') {
+ tmp_buf[UBYTES(tmp_buf_len - 1)] = '\0';
+ }
+ } else {
+ tmp_buf_len = strlen(tmp_buf);
+ if (tmp_buf_len && tmp_buf[tmp_buf_len - 1] == '\n') {
+ tmp_buf[tmp_buf_len - 1] = '\0';
+ }
}
+
if (tmp_buf_len && error_buf) {
- *error_buf = NULL;
- *error_buf = estrndup(tmp_buf, tmp_buf_len);
+ *error_buf = estrndup(tmp_buf, TEXT_BYTES(tmp_buf_len));
}
}
return error_code;
#ifdef HAVE_OCI8_ATTR_STATEMENT
/* {{{ php_oci_fetch_sqltext_offset()
Compute offset in the SQL statement */
-int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC)
+int php_oci_fetch_sqltext_offset(php_oci_statement *statement, zstr *sqltext, ub2 *error_offset TSRMLS_DC)
{
- *sqltext = NULL;
+ ub4 sqltext_len = 0;
+
+ *sqltext = NULL_ZSTR;
*error_offset = 0;
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (text *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err));
+ if (UG(unicode)) {
+ PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) &(sqltext->u), (ub4 *)&sqltext_len, OCI_ATTR_STATEMENT, statement->err));
+ } else {
+ PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) &(sqltext->s), (ub4 *)&sqltext_len, OCI_ATTR_STATEMENT, statement->err));
+ }
if (statement->errcode != OCI_SUCCESS) {
php_oci_error(statement->err, statement->errcode TSRMLS_CC);
void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive)
{
php_oci_connection *connection;
- char *username, *password;
- char *dbname = NULL, *charset = NULL;
+ zstr username, password;
+ zstr dbname, charset = NULL_ZSTR;
int username_len = 0, password_len = 0;
int dbname_len = 0, charset_len = 0;
+ zend_uchar username_type, password_type;
+ zend_uchar dbname_type, charset_type;
long session_mode = OCI_DEFAULT;
/* if a fourth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ssl", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT|TTl", &username, &username_len, &username_type, &password, &password_len, &password_type, &dbname, &dbname_len, &dbname_type, &charset, &charset_len, &charset_type, &session_mode) == FAILURE) {
return;
}
-
- if (!charset_len) {
- charset = NULL;
- }
-
- connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive TSRMLS_CC);
+
+ connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL_ZSTR, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive, username_type TSRMLS_CC);
if (!connection) {
RETURN_FALSE;
/* {{{ php_oci_do_connect_ex()
* 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(zstr username, int username_len, zstr password, int password_len, zstr new_password, int new_password_len, zstr dbname, int dbname_len, zstr charset, long session_mode, int persistent, int exclusive, zend_uchar type TSRMLS_DC)
{
zend_rsrc_list_entry *le;
zend_rsrc_list_entry new_le;
}
smart_str_appendl_ex(&hashed_details, "oci8___", sizeof("oci8___") - 1, 0);
- smart_str_appendl_ex(&hashed_details, username, username_len, 0);
+ smart_str_appendl_ex(&hashed_details, username.s, USTR_BYTES(type, username_len), 0);
smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
if (password_len) {
ulong password_hash;
- password_hash = zend_inline_hash_func(password, password_len);
+ password_hash = zend_u_inline_hash_func(type, password, password_len);
smart_str_append_unsigned_ex(&hashed_details, password_hash, 0);
}
smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
- if (dbname) {
- smart_str_appendl_ex(&hashed_details, dbname, dbname_len, 0);
+ if (dbname_len) {
+ smart_str_appendl_ex(&hashed_details, dbname.s, USTR_BYTES(type, dbname_len), 0);
}
smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
}
#if HAVE_OCI_ENV_NLS_CREATE
- if (charset && *charset) {
- PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), charset));
- if (!charsetid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset);
- } else {
- smart_str_append_unsigned_ex(&hashed_details, charsetid, 0);
+ if (!UG(unicode)) {
+ if (charset.s && *charset.s) {
+ PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), charset.s));
+ if (!charsetid) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset.s);
+ } else {
+ smart_str_append_unsigned_ex(&hashed_details, charsetid, 0);
+ }
}
- }
+
- /* use NLS_LANG if no or invalid charset specified */
- if (!charsetid) {
- size_t rsize = 0;
- sword result;
+ /* use NLS_LANG if no or invalid charset specified */
+
+ if (!charsetid) {
+ size_t rsize = 0;
+ sword result;
- PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize))
- if (result != OCI_SUCCESS) {
- charsetid_nls_lang = 0;
+ PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize))
+ if (result != OCI_SUCCESS) {
+ charsetid_nls_lang = 0;
+ }
+ smart_str_append_unsigned_ex(&hashed_details, charsetid_nls_lang, 0);
}
- smart_str_append_unsigned_ex(&hashed_details, charsetid_nls_lang, 0);
}
+
#else
if (charset && *charset) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Your version of Oracle Client doesn't support setting the charset; bad or no charset conversions may result");
/* make it lowercase */
php_strtolower(hashed_details.c, hashed_details.len);
- if (!exclusive && !new_password) {
+ if (!exclusive && !new_password.v) {
zend_bool found = 0;
if (persistent && zend_hash_find(&EG(persistent_list), hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
connection->used_this_request = 1;
tmp = (php_oci_connection *)zend_list_find(connection->rsrc_id, &rsrc_type);
- if (tmp != NULL && rsrc_type == le_pconnection && strlen(tmp->hash_key) == hashed_details.len &&
+ if (tmp != NULL && rsrc_type == le_pconnection && tmp->hash_key_len == hashed_details.len &&
memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->rsrc_id) == SUCCESS) {
/* do nothing */
} else {
if (alloc_non_persistent) {
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
+ connection->hash_key_len = hashed_details.len;
connection->is_persistent = 0;
} else {
connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection));
connection->hash_key = zend_strndup(hashed_details.c, hashed_details.len);
+ connection->hash_key_len = hashed_details.len;
connection->is_persistent = 1;
}
} else {
connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
+ connection->hash_key_len = hashed_details.len;
connection->is_persistent = 0;
}
/* allocate environment handle */
#if HAVE_OCI_ENV_NLS_CREATE
#define PHP_OCI_INIT_FUNC_NAME "OCIEnvNlsCreate"
-
- if (charsetid) {
- connection->charset = charsetid;
+
+ if (UG(unicode)) {
+ connection->charset = OCI_UTF16ID;
} else {
- connection->charset = charsetid_nls_lang;
+ if (charsetid) {
+ connection->charset = charsetid;
+ } else {
+ connection->charset = charsetid_nls_lang;
+ }
}
/* create an environment using the character set id, Oracle 9i+ ONLY */
php_oci_connection_close(connection TSRMLS_CC);
return NULL;
}
-
+
/* allocate our server handle {{{ */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL));
} /* }}} */
/* attach to the server {{{ */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text*)dbname, dbname_len, (ub4) OCI_DEFAULT));
+ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text*)dbname.s, USTR_BYTES(type, dbname_len), (ub4) OCI_DEFAULT));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
} /* }}} */
/* set the username {{{ */
- if (username) {
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err)));
+ if (username.v) {
+ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username.s, (ub4) USTR_BYTES(type, username_len), (ub4) OCI_ATTR_USERNAME, OCI_G(err)));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
}/* }}} */
/* set the password {{{ */
- if (password) {
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err)));
+ if (password.v) {
+ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password.s, (ub4) USTR_BYTES(type, password_len), (ub4) OCI_ATTR_PASSWORD, OCI_G(err)));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return NULL;
} /* }}} */
- if (new_password) {
+ if (new_password_len) {
/* try to change password if new one was provided {{{ */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH));
+ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username.s, USTR_BYTES(type, username_len), (text *)password.s, USTR_BYTES(type, password_len), (text *)new_password.s, USTR_BYTES(type, new_password_len), OCI_AUTH));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
case OCI_SYSDBA:
case OCI_SYSOPER:
default:
- if (username_len == 1 && username[0] == '/' && password_len == 0) {
+ if (username_len == 1 && username.s[0] == '/' && password_len == 0) {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode));
} else {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) session_mode));
new_le.type = le_pconnection;
connection->used_this_request = 1;
connection->rsrc_id = zend_list_insert(connection, le_pconnection);
- zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
+ zend_hash_update(&EG(persistent_list), connection->hash_key, connection->hash_key_len+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
OCI_G(num_persistent)++;
} else if (!exclusive) {
connection->rsrc_id = zend_list_insert(connection, le_connection);
new_le.ptr = (void *)connection->rsrc_id;
new_le.type = le_index_ptr;
- zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
+ zend_hash_update(&EG(regular_list), connection->hash_key, connection->hash_key_len+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
OCI_G(num_links)++;
} else {
connection->rsrc_id = zend_list_insert(connection, le_connection);
/* {{{ php_oci_password_change()
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, zstr user, int user_len, zstr pass_old, int pass_old_len, zstr pass_new, int pass_new_len, zend_uchar type TSRMLS_DC)
{
- PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user.s, USTR_BYTES(type, user_len), (text *)pass_old.s, USTR_BYTES(type, pass_old_len), (text *)pass_new.s, USTR_BYTES(type, pass_new_len), OCI_DEFAULT));
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
/* {{{ php_oci_server_get_version()
Get Oracle server version */
-int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC)
+int php_oci_server_get_version(php_oci_connection *connection, zstr *version TSRMLS_DC)
{
- char version_buff[256];
+ char version_buff[512];
PHP_OCI_CALL_RETURN(connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text*)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX));
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
-
- *version = estrdup(version_buff);
+
+ if (UG(unicode)) {
+ version->u = eustrdup((UChar *)version_buff);
+ } else {
+ version->s = estrdup(version_buff);
+ }
return 0;
} /* }}} */
php_oci_descriptor *descriptor;
ub4 lob_length;
int column_size;
- char *lob_buffer;
+ zstr lob_buffer, zstr_data = (zstr)column->data;
if (column->indicator == -1) { /* column is NULL */
ZVAL_NULL(value);
}
if (column->data_type != SQLT_RDD && (mode & PHP_OCI_RETURN_LOBS)) {
+ php_oci_lob_type lob_type;
/* PHP_OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
if (php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC)) {
ZVAL_FALSE(value);
return 1;
- } else {
- if (lob_length > 0) {
- ZVAL_STRINGL(value, lob_buffer, lob_length, 0);
- } else {
- ZVAL_EMPTY_STRING(value);
- }
- return 0;
}
+
+ if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+ return 1;
+ }
+
+ switch (lob_type) {
+ case OCI_IS_CLOB:
+ if (lob_length > 0) {
+ ZVAL_TEXTL(value, lob_buffer, TEXT_CHARS(lob_length), 0);
+ } else {
+ ZVAL_EMPTY_TEXT(value);
+ }
+ break;
+ case OCI_IS_BLOB:
+ if (lob_length > 0) {
+ ZVAL_STRINGL(value, lob_buffer.s, lob_length, 0);
+ } else {
+ ZVAL_EMPTY_STRING(value);
+ }
+ break;
+ }
+ return 0;
} else {
/* return the locator */
object_init_ex(value, oci_lob_class_entry_ptr);
return 0;
}
- ZVAL_STRINGL(value, column->data, column_size, 1);
+ ZVAL_TEXTL(value, zstr_data, TEXT_CHARS(column_size), 1);
}
return 0;
}
for (i = 0; i < statement->ncolumns; i++) {
- column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
if (column == NULL) {
continue;
if (fetch_mode & PHP_OCI_NUM) {
ZVAL_ADDREF(element);
}
- add_assoc_zval(return_value, column->name, element);
+ add_u_assoc_zval(return_value, (UG(unicode) ? IS_UNICODE : IS_STRING), column->name, element);
}
} else {
add_index_null(return_value, i);
}
if (fetch_mode & PHP_OCI_ASSOC) {
- add_assoc_null(return_value, column->name);
+ add_u_assoc_null(return_value, (UG(unicode) ? IS_UNICODE : IS_STRING), column->name);
}
}
}
/* {{{ 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, zstr tdo, int tdo_len, zstr schema, int schema_len TSRMLS_DC)
{
dvoid *dschp1;
dvoid *parmp1;
connection->env,
connection->err,
connection->svc,
- (text *) schema,
- (ub4) schema_len,
- (text *) tdo,
- (ub4) tdo_len,
+ (text *) schema.s,
+ (ub4) TEXT_BYTES(schema_len),
+ (text *) tdo.s,
+ (ub4) TEXT_BYTES(tdo_len),
(CONST text *) 0,
(ub4) 0,
OCI_DURATION_SESSION,
/* {{{ 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, zstr date, int date_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIDate oci_date;
php_oci_connection *connection = collection->connection;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date.s, TEXT_BYTES(date_len), NULL, 0, NULL, 0, &oci_date));
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
/* {{{ 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, zstr number, int number_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
double element_double;
OCINumber oci_number;
php_oci_connection *connection = collection->connection;
- element_double = zend_strtod(number, NULL);
+ if (UG(unicode)) {
+ element_double = zend_u_strtod(number.u, NULL);
+ } else {
+ element_double = zend_strtod(number.s, NULL);
+ }
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
/* {{{ 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, zstr element, int element_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element.s, TEXT_BYTES(element_len), &ocistr));
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
/* {{{ 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, zstr element, int element_len TSRMLS_DC)
{
if (element_len == 0) {
return php_oci_collection_append_null(collection TSRMLS_CC);
return 1;
}
- ZVAL_STRINGL(*result_element, buff, buff_len, 1);
- Z_STRVAL_P(*result_element)[buff_len] = '\0';
-
+ if (UG(unicode)) {
+ ZVAL_UNICODEL(*result_element, (UChar *)buff, TEXT_CHARS(buff_len), 1);
+ /* Z_UNIVAL_P(*result_element)[buff_len] = 0; XXX */
+ } else {
+ ZVAL_STRINGL(*result_element, buff, buff_len, 1);
+ Z_STRVAL_P(*result_element)[buff_len] = '\0';
+ }
+
return 0;
break;
PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
if (str) {
- ZVAL_STRING(*result_element, str, 1);
+ if (UG(unicode)) {
+ ZVAL_UNICODE(*result_element, (UChar *)str, 1);
+ } else {
+ ZVAL_STRING(*result_element, str, 1);
+ }
}
return 0;
}
/* {{{ 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, long index, zstr date, int date_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIDate oci_date;
php_oci_connection *connection = collection->connection;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date.s, TEXT_BYTES(date_len), NULL, 0, NULL, 0, &oci_date));
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
/* {{{ 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, long index, zstr number, int number_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
double element_double;
OCINumber oci_number;
php_oci_connection *connection = collection->connection;
- element_double = zend_strtod(number, NULL);
+ if (UG(unicode)) {
+ element_double = zend_u_strtod(number.u, NULL);
+ } else {
+ element_double = zend_strtod(number.s, NULL);
+ }
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
/* {{{ 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, long index, zstr element, int element_len TSRMLS_DC)
{
OCIInd new_index = OCI_IND_NOTNULL;
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
+ PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element.s, TEXT_BYTES(element_len), &ocistr));
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
/* {{{ 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, long index, zstr value, int value_len TSRMLS_DC)
{
if (value_len == 0) {
return php_oci_collection_element_set_null(collection, index TSRMLS_CC);
PHP_FUNCTION(oci_define_by_name)
{
zval *stmt, *var;
- char *name;
+ zstr name;
int name_len;
+ zend_uchar name_type;
long type = SQLT_CHR;
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, "rtz/|l", &stmt, &name, &name_len, &name_type, &var, &type) == FAILURE) {
return;
}
define = ecalloc(1,sizeof(php_oci_define));
- if (zend_hash_add(statement->defines, name, name_len, define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
+ if (zend_hash_add(statement->defines, name.s, USTR_BYTES(name_type, name_len+1), define, sizeof(php_oci_define), (void **)&tmp_define) == SUCCESS) {
efree(define);
define = tmp_define;
} else {
RETURN_FALSE;
}
- define->name = (text*) estrndup(name, name_len);
+ if (name_type == IS_UNICODE) {
+ define->name.u = eustrndup(name.u, name_len);
+ } else {
+ define->name.s = estrndup(name.s, name_len);
+ }
+
define->name_len = name_len;
+ define->name_type = name_type;
define->type = type;
define->zval = var;
zval_add_ref(&var);
ub2 bind_type = SQLT_CHR; /* unterminated string */
int name_len;
long maxlen = -1, type = 0;
- char *name;
+ zstr name;
+ zend_uchar name_type;
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, "rtz/|ll", &z_statement, &name, &name_len, &name_type, &bind_var, &maxlen, &type) == FAILURE) {
return;
}
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
- if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type TSRMLS_CC)) {
+ if (php_oci_bind_by_name(statement, name, name_len, bind_var, maxlen, bind_type, name_type TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;
long max_item_len = -1;
long max_array_len = 0;
long type = SQLT_AFC;
- char *name;
+ zstr name;
+ zend_uchar name_type;
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, "rtz/l|ll", &z_statement, &name, &name_len, &name_type, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
return;
}
RETURN_FALSE;
}
- if (php_oci_bind_array_by_name(statement, name, name_len, bind_var, max_array_len, max_item_len, type TSRMLS_CC)) {
+ if (php_oci_bind_array_by_name(statement, name, name_len, bind_var, max_array_len, max_item_len, type, name_type TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;
{
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- char *data;
+ zstr data;
int data_len;
+ zend_uchar data_type;
long 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, "t|l", &data, &data_len, &data_type, &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) {
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ot|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &data_type, &offset) == FAILURE) {
return;
}
}
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset parameter must be greater than or equal to 0");
RETURN_FALSE;
}
-
- if (php_oci_lob_write(descriptor, offset, data, data_len, &bytes_written TSRMLS_CC)) {
+
+ if (php_oci_lob_write(descriptor, offset, data, USTR_BYTES(data_type, data_len), &bytes_written TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;
{
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- char *buffer = NULL;
+ zstr buffer = NULL_ZSTR;
ub4 buffer_len;
+ php_oci_lob_type lob_type;
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
if (php_oci_lob_read(descriptor, -1, 0, &buffer, &buffer_len TSRMLS_CC)) {
RETURN_FALSE;
}
- if (buffer_len > 0) {
- RETURN_STRINGL(buffer, buffer_len, 0);
+
+ if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+ RETURN_FALSE;
}
- else {
- RETURN_EMPTY_STRING();
+
+ switch (lob_type) {
+ case OCI_IS_CLOB:
+ if (buffer_len > 0) {
+ RETURN_TEXTL(buffer, TEXT_CHARS(buffer_len), 0);
+ }
+ RETURN_EMPTY_TEXT();
+ break;
+ case OCI_IS_BLOB:
+ if (buffer_len > 0) {
+ RETURN_STRINGL(buffer.s, buffer_len, 0);
+ }
+ RETURN_EMPTY_STRING();
+ break;
}
}
/* }}} */
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
long length;
- char *buffer;
+ zstr buffer;
ub4 buffer_len;
+ php_oci_lob_type lob_type;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) {
if (php_oci_lob_read(descriptor, length, descriptor->lob_current_position, &buffer, &buffer_len TSRMLS_CC)) {
RETURN_FALSE;
- }
- if (buffer_len > 0) {
- RETURN_STRINGL(buffer, buffer_len, 0);
}
- else {
- RETURN_EMPTY_STRING();
+
+ if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+ RETURN_FALSE;
+ }
+
+ switch (lob_type) {
+ case OCI_IS_CLOB:
+ if (buffer_len > 0) {
+ RETURN_TEXTL(buffer, TEXT_CHARS(buffer_len), 0);
+ }
+ RETURN_EMPTY_TEXT();
+ break;
+ case OCI_IS_BLOB:
+ if (buffer_len > 0) {
+ RETURN_STRINGL(buffer.s, buffer_len, 0);
+ }
+ RETURN_EMPTY_STRING();
+ break;
}
}
/* }}} */
PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
-
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
RETURN_FALSE;
}
descriptor->lob_current_position += offset;
break;
case PHP_OCI_SEEK_END:
- if (descriptor->lob_size + offset >= 0) {
+ if ((descriptor->lob_size + offset) >= 0) {
descriptor->lob_current_position = descriptor->lob_size + offset;
}
else {
break;
case PHP_OCI_SEEK_SET:
default:
- descriptor->lob_current_position = (offset > 0) ? offset : 0;
+ descriptor->lob_current_position = (offset > 0) ? offset : 0;
break;
}
-
RETURN_TRUE;
}
/* }}} */
int data_len;
long write_len = 0;
ub4 bytes_written;
- char *data;
+ zstr data;
+ zend_uchar data_type;
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, "t|l", &data, &data_len, &data_type, &write_len) == FAILURE) {
return;
}
}
}
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, "Ot|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &data_type, &write_len) == FAILURE) {
return;
}
if (data_len <= 0) {
RETURN_LONG(0);
}
-
- if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, data_len, &bytes_written TSRMLS_CC)) {
+
+ if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, USTR_BYTES(data_type, data_len), &bytes_written TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_LONG(bytes_written);
{
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- char *filename, *buffer;
+ char *filename;
+ zstr buffer;
int filename_len;
long start = -1, length = -1, block_length;
php_stream *stream;
ub4 lob_length;
+ php_oci_lob_type lob_type;
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &filename, &filename_len, &start, &length) == FAILURE) {
block_length = length;
}
+ if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
while(length > 0) {
ub4 tmp_bytes_read = 0;
if (php_oci_lob_read(descriptor, block_length, start, &buffer, &tmp_bytes_read TSRMLS_CC)) {
php_stream_close(stream);
RETURN_FALSE;
}
- if (tmp_bytes_read && !php_stream_write(stream, buffer, tmp_bytes_read)) {
+ if (tmp_bytes_read && !php_stream_u_write(stream, (lob_type == OCI_IS_CLOB ? IS_UNICODE : IS_STRING), buffer, tmp_bytes_read)) {
php_stream_close(stream);
- efree(buffer);
+ efree(buffer.v);
RETURN_FALSE;
}
- if (buffer) {
- efree(buffer);
+ if (buffer.v) {
+ efree(buffer.v);
}
length -= tmp_bytes_read;
{
zval **tmp, *z_descriptor = getThis();
php_oci_descriptor *descriptor;
- char *data;
+ zstr data;
int data_len;
+ zend_uchar data_type;
long 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, "t|l", &data, &data_len, &data_type, &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, "Ot|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &data_type, &type) == FAILURE) {
return;
}
}
PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
- if (php_oci_lob_write_tmp(descriptor, type, data, data_len TSRMLS_CC)) {
+ if (php_oci_lob_write_tmp(descriptor, type, data, USTR_BYTES(data_type, data_len) TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;
php_oci_out_column *column;
if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) {
- RETURN_STRINGL(column->name, column->name_len, 1);
+ RETURN_TEXTL(column->name, column->name_len, 1);
}
RETURN_FALSE;
}
switch (column->data_type) {
#ifdef SQLT_TIMESTAMP
case SQLT_TIMESTAMP:
- RETVAL_STRING("TIMESTAMP",1);
+ RETVAL_ASCII_STRING("TIMESTAMP", ZSTR_DUPLICATE);
break;
#endif
#ifdef SQLT_TIMESTAMP_TZ
case SQLT_TIMESTAMP_TZ:
- RETVAL_STRING("TIMESTAMP_TZ",1);
+ RETVAL_ASCII_STRING("TIMESTAMP_TZ", ZSTR_DUPLICATE);
break;
#endif
case SQLT_DAT:
- RETVAL_STRING("DATE",1);
+ RETVAL_ASCII_STRING("DATE", ZSTR_DUPLICATE);
break;
case SQLT_NUM:
- RETVAL_STRING("NUMBER",1);
+ RETVAL_ASCII_STRING("NUMBER", ZSTR_DUPLICATE);
break;
case SQLT_LNG:
- RETVAL_STRING("LONG",1);
+ RETVAL_ASCII_STRING("LONG", ZSTR_DUPLICATE);
break;
case SQLT_BIN:
- RETVAL_STRING("RAW",1);
+ RETVAL_ASCII_STRING("RAW", ZSTR_DUPLICATE);
break;
case SQLT_LBI:
- RETVAL_STRING("LONG RAW",1);
+ RETVAL_ASCII_STRING("LONG RAW", ZSTR_DUPLICATE);
break;
case SQLT_CHR:
- RETVAL_STRING("VARCHAR2",1);
+ RETVAL_ASCII_STRING("VARCHAR2", ZSTR_DUPLICATE);
break;
case SQLT_RSET:
- RETVAL_STRING("REFCURSOR",1);
+ RETVAL_ASCII_STRING("REFCURSOR", ZSTR_DUPLICATE);
break;
case SQLT_AFC:
- RETVAL_STRING("CHAR",1);
+ RETVAL_ASCII_STRING("CHAR", ZSTR_DUPLICATE);
break;
case SQLT_BLOB:
- RETVAL_STRING("BLOB",1);
+ RETVAL_ASCII_STRING("BLOB", ZSTR_DUPLICATE);
break;
case SQLT_CLOB:
- RETVAL_STRING("CLOB",1);
+ RETVAL_ASCII_STRING("CLOB", ZSTR_DUPLICATE);
break;
case SQLT_BFILE:
- RETVAL_STRING("BFILE",1);
+ RETVAL_ASCII_STRING("BFILE", ZSTR_DUPLICATE);
break;
case SQLT_RDD:
- RETVAL_STRING("ROWID",1);
+ RETVAL_ASCII_STRING("ROWID", ZSTR_DUPLICATE);
break;
default:
RETVAL_LONG(column->data_type);
columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);
for (i = 0; i < statement->ncolumns; i++) {
- columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
}
while (!php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
if (flags & PHP_OCI_NUM) {
zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL);
} else { /* default to ASSOC */
- zend_hash_update(Z_ARRVAL_P(row), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
+ zend_u_hash_update(Z_ARRVAL_P(row), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL);
}
}
if (flags & PHP_OCI_NUM) {
for (i = 0; i < statement->ncolumns; i++) {
- columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
MAKE_STD_ZVAL(tmp);
array_init(tmp);
}
} else { /* default to ASSOC */
for (i = 0; i < statement->ncolumns; i++) {
- columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ columns[ i ] = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
MAKE_STD_ZVAL(tmp);
array_init(tmp);
- zend_hash_update(Z_ARRVAL_P(array), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
+ zend_u_hash_update(Z_ARRVAL_P(array), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
}
}
dvoid *errh = NULL;
#ifdef HAVE_OCI8_ATTR_STATEMENT
ub2 error_offset = 0;
- text *sqltext = NULL;
+ zstr sqltext = NULL_ZSTR;
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg) == FAILURE) {
if (errcode) {
array_init(return_value);
add_assoc_long(return_value, "code", errcode);
- add_assoc_string(return_value, "message", (char*) errbuf, 0);
+ if (UG(unicode)) {
+ add_assoc_unicode(return_value, "message", (UChar *)errbuf, 0);
+ } else {
+ add_assoc_string(return_value, "message", errbuf, 0);
+ }
#ifdef HAVE_OCI8_ATTR_STATEMENT
add_assoc_long(return_value, "offset", error_offset);
- add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "", 1);
+ if (sqltext.v) {
+ add_assoc_text(return_value, "sqltext", sqltext, 1);
+ } else {
+ add_assoc_ascii_string(return_value, "sqltext", "", 1);
+ }
#endif
} else {
RETURN_FALSE;
zval *z_connection;
php_oci_connection *connection;
php_oci_statement *statement;
- char *query;
+ zstr query;
+ zend_uchar query_type;
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, "rt", &z_connection, &query, &query_len, &query_type) == FAILURE) {
return;
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- statement = php_oci_statement_create(connection, query, query_len TSRMLS_CC);
+ statement = php_oci_statement_create(connection, query, query_len, query_type TSRMLS_CC);
if (statement) {
RETURN_RESOURCE(statement->id);
PHP_FUNCTION(oci_password_change)
{
zval *z_connection;
- text *user, *pass_old, *pass_new, *dbname;
+ zstr user, pass_old, pass_new, dbname;
+ zend_uchar user_type, pass_old_type, pass_new_type, dbname_type;
int user_len, pass_old_len, pass_new_len, dbname_len;
php_oci_connection *connection;
- 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, "rTTT", &z_connection, &user, &user_len, &user_type, &pass_old, &pass_old_len, &pass_old_type, &pass_new, &pass_new_len, &pass_new_type) == SUCCESS) {
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
if (!user_len) {
RETURN_FALSE;
}
- if (php_oci_password_change(connection, user, user_len, pass_old, pass_old_len, pass_new, pass_new_len TSRMLS_CC)) {
+ if (php_oci_password_change(connection, user, user_len, pass_old, pass_old_len, pass_new, pass_new_len, user_type TSRMLS_CC)) {
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, "TTTT", &dbname, &dbname_len, &dbname_type, &user, &user_len, &user_type, &pass_old, &pass_old_len, &pass_old_type, &pass_new, &pass_new_len, &pass_new_type) == SUCCESS) {
if (!user_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "username cannot be empty");
RETURN_FALSE;
}
- connection = php_oci_do_connect_ex(user, user_len, pass_old, pass_old_len, pass_new, pass_new_len, dbname, dbname_len, NULL, OCI_DEFAULT, 0, 0 TSRMLS_CC);
+ connection = php_oci_do_connect_ex(user, user_len, pass_old, pass_old_len, pass_new, pass_new_len, dbname, dbname_len, NULL_ZSTR, OCI_DEFAULT, 0, 0, user_type TSRMLS_CC);
if (!connection) {
RETURN_FALSE;
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- statement = php_oci_statement_create(connection, NULL, 0 TSRMLS_CC);
+ statement = php_oci_statement_create(connection, NULL_ZSTR, 0, 0 TSRMLS_CC);
if (statement) {
RETURN_RESOURCE(statement->id);
{
zval *z_connection;
php_oci_connection *connection;
- char *version = NULL;
+ zstr version = NULL_ZSTR;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_connection) == FAILURE) {
return;
RETURN_FALSE;
}
- RETURN_STRING(version, 0);
+ RETURN_TEXT(version, 0);
}
/* }}} */
{
zval **tmp, *z_collection = getThis();
php_oci_collection *collection;
- char *value;
+ zstr value;
int value_len;
+ zend_uchar value_type;
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, "t", &value, &value_len, &value_type) == FAILURE) {
return;
}
- }
- else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) {
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ot", &z_collection, oci_coll_class_entry_ptr, &value, &value_len, &value_type) == FAILURE) {
return;
}
}
php_oci_collection *collection;
int value_len;
long element_index;
- char *value;
+ zstr value;
+ zend_uchar value_type;
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, "lt", &element_index, &value, &value_len, &value_type) == 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) {
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Olt", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len, &value_type) == FAILURE) {
return;
}
}
zval *z_connection;
php_oci_connection *connection;
php_oci_collection *collection;
- char *tdo, *schema = NULL;
+ zstr tdo, schema = NULL_ZSTR;
int tdo_len, schema_len = 0;
+ zend_uchar tdo_type, schema_type;
- 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, "rT|T", &z_connection, &tdo, &tdo_len, &tdo_type, &schema, &schema_len, &schema_type) == FAILURE) {
return;
}
if ( (collection = php_oci_collection_create(connection, tdo, tdo_len, schema, schema_len TSRMLS_CC)) ) {
object_init_ex(return_value, oci_coll_class_entry_ptr);
add_property_resource(return_value, "collection", collection->id);
- }
- else {
+ } else {
RETURN_FALSE;
}
}
{
ub4 lenp = (ub4) len;
php_oci_lob_ctx *ctx = (php_oci_lob_ctx *)ctxp;
+ TSRMLS_FETCH();
switch (piece)
{
case OCI_LAST_PIECE:
- *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp + 1));
+ *(ctx->lob_data) = erealloc(*(ctx->lob_data), (size_t) (*(ctx->lob_len) + lenp + TEXT_BYTES(1)));
memcpy(*(ctx->lob_data) + *(ctx->lob_len), bufxp, (size_t) lenp);
*(ctx->lob_len) += lenp;
- *(*(ctx->lob_data) + *(ctx->lob_len)) = 0x00;
+
+ if (UG(unicode)) {
+ *(*(ctx->lob_data) + *(ctx->lob_len) + 1) = 0;
+ }
+ *(*(ctx->lob_data) + *(ctx->lob_len)) = 0;
+
return OCI_CONTINUE;
case OCI_FIRST_PIECE:
*(ctx->lob_len) += lenp;
return OCI_CONTINUE;
- default: {
- TSRMLS_FETCH();
+ default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected LOB piece id received (value:%d)", piece);
efree(*(ctx->lob_data));
*(ctx->lob_data) = NULL;
*(ctx->lob_len) = 0;
return OCI_ERROR;
- }
}
}
/* }}} */
/* {{{ 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, long read_length, long initial_offset, zstr *data, ub4 *data_len TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
ub4 length = 0;
int buffer_size = PHP_OCI_LOB_BUFFER_SIZE;
php_oci_lob_ctx ctx;
ub1 *bufp;
+ php_oci_lob_type lob_type;
#if defined(HAVE_OCI_LOB_READ2)
oraub8 bytes_read, offset = 0;
oraub8 requested_len = read_length; /* this is by default */
oraub8 chars_read = 0;
- int is_clob = 0;
#else
int bytes_read, offset = 0;
int requested_len = read_length; /* this is by default */
#endif
*data_len = 0;
- *data = NULL;
+ *data = NULL_ZSTR;
ctx.lob_len = data_len;
- ctx.lob_data = data;
+ ctx.lob_data = &(data->s);
if (php_oci_lob_get_length(descriptor, &length TSRMLS_CC)) {
return 1;
if (requested_len <= 0) {
return 0;
}
-
+
offset = initial_offset;
if (descriptor->type == OCI_DTYPE_FILE) {
return 1;
}
}
-#ifdef HAVE_OCI_LOB_READ2
- else {
- ub2 charset_id = 0;
-
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
-
- if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
- PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- return 1;
- }
- if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
- is_clob = 1;
- }
+ if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC) > 0) {
+ return 1;
}
- if (is_clob) {
+#ifdef HAVE_OCI_LOB_READ2
+ if (lob_type == OCI_IS_CLOB) {
chars_read = requested_len;
bytes_read = 0;
} else {
efree(bufp);
- if (is_clob) {
+ if (lob_type == OCI_IS_CLOB) {
offset = descriptor->lob_current_position + chars_read;
} else {
offset = descriptor->lob_current_position + bytes_read;
);
efree(bufp);
- offset = descriptor->lob_current_position + bytes_read;
+ if (!is_clob) {
+ offset = descriptor->lob_current_position + TEXT_BYTES(bytes_read);
+ } else {
+ offset = descriptor->lob_current_position + bytes_read;
+ }
#endif
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- if (*data) {
- efree(*data);
- *data = NULL;
+ if (data->s) {
+ efree(data->s);
+ *data = NULL_ZSTR;
}
*data_len = 0;
return 1;
}
- descriptor->lob_current_position = (int)offset;
+ descriptor->lob_current_position = (offset <= descriptor->lob_size) ? offset : descriptor->lob_size;
if (descriptor->type == OCI_DTYPE_FILE) {
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- if (*data) {
- efree(*data);
- *data = NULL;
+ if (data->s) {
+ efree(data->s);
+ *data = NULL_ZSTR;
}
*data_len = 0;
return 1;
/* {{{ 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, zstr data, int data_len, ub4 *bytes_written TSRMLS_DC)
{
OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor;
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
ub4 lob_length;
+ ub4 data_len_out = data_len;
+ php_oci_lob_type lob_type;
*bytes_written = 0;
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
return 1;
}
-
- if (!data || data_len <= 0) {
+
+ if (php_oci_lob_get_type(descriptor, &lob_type TSRMLS_CC)) {
+ return 1;
+ }
+
+ if (lob_type == OCI_IS_CLOB) {
+ data_len_out = TEXT_CHARS(data_len);
+ }
+
+ if (!data.v || data_len <= 0) {
return 0;
}
if (offset > descriptor->lob_current_position) {
offset = descriptor->lob_current_position;
}
-
+
PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite,
(
connection->svc,
connection->err,
lob,
- (ub4 *)&data_len,
+ (ub4 *)&data_len_out,
(ub4) offset + 1,
- (dvoid *) data,
+ (dvoid *) (text *)data.s,
(ub4) data_len,
OCI_ONE_PIECE,
(dvoid *)0,
*bytes_written = 0;
return 1;
}
- *bytes_written = data_len;
- descriptor->lob_current_position += data_len;
+ *bytes_written = data_len_out;
+ descriptor->lob_current_position += data_len_out;
if (descriptor->lob_current_position > descriptor->lob_size) {
descriptor->lob_size = descriptor->lob_current_position;
if (length == -1) {
length = lob_length;
}
-
+
PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1));
if (connection->errcode != OCI_SUCCESS) {
/* {{{ php_oci_lob_write_tmp()
Create temporary LOB and write data to it */
-int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data, int data_len TSRMLS_DC)
+int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, zstr data, int data_len TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
break;
}
- if (!data || data_len <= 0) {
+ if (!data.v || data_len <= 0) {
/* nothing to write, silently fail */
return 1;
}
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
} /* }}} */
+int php_oci_lob_get_type(php_oci_descriptor *descriptor, php_oci_lob_type *lob_type TSRMLS_DC) /* {{{ */
+{
+ php_oci_connection *connection = descriptor->connection;
+
+ *lob_type = 0;
+
+ if (descriptor->lob_type) {
+ *lob_type = descriptor->lob_type;
+ return 0;
+ }
+
+ if (descriptor->type == OCI_DTYPE_FILE) {
+ *lob_type = OCI_IS_BLOB;
+ descriptor->lob_type = OCI_IS_BLOB;
+ return 0;
+ } else {
+ ub2 charset_id = 0;
+
+ PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
+
+ if (connection->errcode != OCI_SUCCESS) {
+ php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+ return 1;
+ }
+
+ if (charset_id > 0) { /* charset_id is always > 0 for [N]CLOBs */
+ *lob_type = OCI_IS_CLOB;
+ descriptor->lob_type = OCI_IS_CLOB;
+ return 0;
+ }
+ }
+
+ *lob_type = OCI_IS_BLOB;
+ descriptor->lob_type = OCI_IS_BLOB;
+
+ return 0;
+}
+/* }}} */
+
#endif /* HAVE_OCI8 */
/* {{{ 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, zstr query, int query_len, zend_uchar type TSRMLS_DC)
{
php_oci_statement *statement;
connection->svc,
&(statement->stmt),
connection->err,
- (text *)query,
- query_len,
+ (text *)query.s,
+ USTR_BYTES(type, query_len),
NULL,
0,
OCI_NTV_SYNTAX,
}
}
- if (query && query_len) {
- statement->last_query = estrndup(query, query_len);
+ if (query.s && query_len) {
+ statement->last_query = emalloc(USTR_BYTES(type, query_len + 1));
+ memcpy(statement->last_query, query.s, USTR_BYTES(type, query_len));
+ statement->last_query[USTR_BYTES(type, query_len)] = '\0';
statement->last_query_len = query_len;
}
else {
ub4 typep, iterp, idxp;
ub1 in_outp, piecep;
zend_bool piecewisecols = 0;
-
php_oci_out_column *column;
+ zstr zstr_data;
PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
/* reset length for all piecewise columns */
for (i = 0; i < statement->ncolumns; i++) {
- column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
if (column->piecewise) {
column->retlen4 = 0;
piecewisecols = 1;
/* scan through our columns for a piecewise column with a matching handle */
for (i = 0; i < statement->ncolumns; i++) {
- column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
- if (column->piecewise && handlepp == column->oci_define) {
+ column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
+ if (column->piecewise && handlepp == column->oci_define) {
if (!column->data) {
- column->data = (text *) ecalloc(1, PHP_OCI_PIECE_SIZE + 1);
+ zstr_data.v = ecalloc(1, PHP_OCI_PIECE_SIZE + 1);
+ column->data = zstr_data.v;
} else {
- column->data = erealloc(column->data, column->retlen4 + PHP_OCI_PIECE_SIZE + 1);
+ zstr_data.v = erealloc(column->data, column->retlen4 + PHP_OCI_PIECE_SIZE + 1);
+ column->data = zstr_data.v;
}
column->cb_retlen = PHP_OCI_PIECE_SIZE;
(void *) column->oci_define,
OCI_HTYPE_DEFINE,
statement->err,
- ((char*)column->data) + column->retlen4,
+ ((void*)zstr_data.s) + column->retlen4,
&(column->cb_retlen),
piecep,
&column->indicator,
if (piecewisecols) {
for (i = 0; i < statement->ncolumns; i++) {
- column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
if (column && column->piecewise && handlepp == column->oci_define) {
column->retlen4 += column->cb_retlen;
}
/* do the stuff needed for OCIDefineByName */
for (i = 0; i < statement->ncolumns; i++) {
- column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
if (column == NULL) {
continue;
}
/* {{{ 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, long column_index, zstr column_name, int column_name_len TSRMLS_DC)
{
php_oci_out_column *column = NULL;
int i;
return NULL;
}
- if (column_name) {
+ if (column_name.v != NULL) {
for (i = 0; i < statement->ncolumns; i++) {
- column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
+ column = php_oci_statement_get_column(statement, i + 1, NULL_ZSTR, 0 TSRMLS_CC);
if (column == NULL) {
continue;
- } else if (((int) column->name_len == column_name_len) && (!strncmp(column->name, column_name, column_name_len))) {
- return column;
+ } else if ((int) column->name_len == column_name_len) {
+ if (!UG(unicode) && !strncmp(column->name.s, column_name.s, column_name_len)) {
+ return column;
+ } else if (UG(unicode) && !u_strncmp(column->name.u, column_name.u, column_name_len)) {
+ return column;
+ }
}
}
} else if (column_index != -1) {
}
outcol->storage_size4 = outcol->data_size;
- outcol->retlen = outcol->data_size;
+ outcol->retlen = TEXT_CHARS(outcol->data_size);
/* get scale of the column */
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
}
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- outcol->name = estrndup((char*) colname, outcol->name_len);
+ if (UG(unicode)) {
+ outcol->name_len = TEXT_CHARS(outcol->name_len);
+ outcol->name.u = eustrndup((UChar*) colname, outcol->name_len);
+ } else {
+ outcol->name.s = estrndup((char*) colname, outcol->name_len);
+ }
/* find a user-setted define */
if (statement->defines) {
- zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define);
+ zend_hash_find(statement->defines, outcol->name.s, TEXT_BYTES(outcol->name_len+1), (void **) &outcol->define);
}
buf = 0;
switch (outcol->data_type) {
case SQLT_RSET:
- outcol->statement = php_oci_statement_create(statement->connection, NULL, 0 TSRMLS_CC);
+ outcol->statement = php_oci_statement_create(statement->connection, NULL_ZSTR, 0, 0 TSRMLS_CC);
outcol->stmtid = outcol->statement->id;
outcol->statement->nested = 1;
descr = php_oci_lob_create(statement->connection, dtype TSRMLS_CC);
if (!descr) {
- efree(outcol->name);
+ efree(outcol->name.v);
return 1;
}
outcol->descid = descr->id;
} else if (Z_TYPE_P(bind->zval) == IS_STRING && Z_STRLEN_P(bind->zval) > 0) {
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';
+ } else if (Z_TYPE_P(bind->zval) == IS_UNICODE && Z_UNILEN_P(bind->zval) > 0) {
+ if (bind->out) {
+ /* OCI returns _bytes_ as data length for OUT binds */
+ Z_UNILEN_P(bind->zval) = TEXT_CHARS(Z_UNILEN_P(bind->zval));
+ }
+ Z_UNIVAL_P(bind->zval).u = eurealloc(Z_UNIVAL_P(bind->zval).u, Z_UNILEN_P(bind->zval)+1);
+ Z_UNIVAL_P(bind->zval).s[ TEXT_BYTES(Z_UNILEN_P(bind->zval)) - 1 ] = '\0';
+ Z_UNIVAL_P(bind->zval).s[ TEXT_BYTES(Z_UNILEN_P(bind->zval)) ] = '\0';
} else if (Z_TYPE_P(bind->zval) == IS_ARRAY) {
int i;
zval **entry;
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
ZVAL_NULL(*entry);
} else {
- ZVAL_STRINGL(*entry, buff, buff_len, 1);
+ zstr tmp;
+ tmp.s = buff;
+ ZVAL_TEXTL(*entry, tmp, buff_len, 1);
}
zend_hash_move_forward(hash);
} else {
+ zstr tmp;
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
+ tmp.s = buff;
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
add_next_index_null(bind->zval);
} else {
- add_next_index_stringl(bind->zval, buff, buff_len, 1);
+ add_next_index_textl(bind->zval, tmp, buff_len, 1);
}
}
}
case SQLT_AVC:
case SQLT_STR:
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];
- if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- zval_dtor(*entry);
- ZVAL_STRINGL(*entry, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1);
- zend_hash_move_forward(hash);
- } else {
- add_next_index_stringl(bind->zval, ((text *)bind->array.elements)+i*bind->array.max_length, curr_element_length, 1);
+ {
+ zstr tmp;
+ 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];
+ if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
+ zval_dtor(*entry);
+ tmp.s = ((text *)bind->array.elements)+i*bind->array.max_length;
+ ZVAL_TEXTL(*entry, tmp, curr_element_length, 1);
+ zend_hash_move_forward(hash);
+ } else {
+ tmp.s = ((text *)bind->array.elements)+i*bind->array.max_length;
+ add_next_index_textl(bind->zval, tmp, curr_element_length, 1);
+ }
}
}
break;
/* {{{ 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, long type TSRMLS_DC)
+int php_oci_bind_by_name(php_oci_statement *statement, zstr name, int name_len, zval* var, long maxlength, long type, zend_uchar uni_type TSRMLS_DC)
{
php_oci_collection *bind_collection = NULL;
php_oci_descriptor *bind_descriptor = NULL;
case SQLT_CHR:
/* this is the default case when type was not specified */
if (Z_TYPE_P(var) != IS_NULL) {
- convert_to_string(var);
+ convert_to_text(var);
}
if (maxlength == -1) {
- value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0;
+ switch (Z_TYPE_P(var)) {
+ case IS_STRING:
+ value_sz = Z_STRLEN_P(var);
+ break;
+ case IS_UNICODE:
+ value_sz = Z_UNILEN_P(var);
+ break;
+ default:
+ value_sz = 0;
+ break;
+ }
} else {
value_sz = maxlength;
}
}
memset((void*)&bind,0,sizeof(php_oci_bind));
- if (zend_hash_find(statement->binds, name, name_len + 1, (void **)&old_bind) == SUCCESS) {
+ if (zend_hash_find(statement->binds, name.s, USTR_BYTES(uni_type, name_len + 1), (void **)&old_bind) == SUCCESS) {
bindp = old_bind;
if (bindp->zval) {
zval_ptr_dtor(&bindp->zval);
}
} else {
- zend_hash_update(statement->binds, name, name_len + 1, &bind, sizeof(php_oci_bind), (void **)&bindp);
+ zend_hash_update(statement->binds, name.s, USTR_BYTES(uni_type, name_len + 1), &bind, sizeof(php_oci_bind), (void **)&bindp);
}
bindp->descriptor = oci_desc;
statement->stmt, /* statement handle */
(OCIBind **)&bindp->bind, /* bind hdl (will alloc) */
statement->err, /* error handle */
- (text*) name, /* placeholder name */
- name_len, /* placeholder length */
+ (text*) name.s, /* placeholder name */
+ USTR_BYTES(uni_type, name_len), /* placeholder length */
(dvoid *)bind_data, /* in/out data */
- value_sz, /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output data */
+ TEXT_BYTES(value_sz), /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of input/output data */
(ub2)type, /* in/out data type */
(dvoid *)&bindp->indicator, /* indicator (ignored) */
(ub2 *)0, /* size array (ignored) */
*indpp = (dvoid *)&phpbind->indicator;
} else if ((phpbind->descriptor == 0) && (phpbind->statement == 0)) {
/* "normal string bind */
- convert_to_string(val);
+ convert_to_text(val);
- *bufpp = Z_STRVAL_P(val);
- *alenp = Z_STRLEN_P(val);
+ if (UG(unicode)) {
+ *bufpp = Z_UNIVAL_P(val).v;
+ *alenp = UBYTES(Z_UNILEN_P(val));
+ } else {
+ *bufpp = Z_STRVAL_P(val);
+ *alenp = Z_STRLEN_P(val);
+ }
*indpp = (dvoid *)&phpbind->indicator;
} else if (phpbind->statement != 0) {
/* RSET */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid phpbind pointer value");
return retval;
}
+
+ phpbind->out = 1; /* mark as OUT bind */
if ((Z_TYPE_P(val) == IS_OBJECT) || (Z_TYPE_P(val) == IS_RESOURCE)) {
retval = OCI_CONTINUE;
- } else {
- 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);
-
- /* XXX we assume that zend-zval len has 4 bytes */
- *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval);
- *bufpp = Z_STRVAL_P(phpbind->zval);
- *piecep = OCI_ONE_PIECE;
- *rcodepp = &phpbind->retcode;
- *indpp = &phpbind->indicator;
- retval = OCI_CONTINUE;
+ } else {
+ if (UG(unicode)) {
+ convert_to_unicode(val);
+ zval_dtor(val);
+
+ Z_UNILEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */
+ Z_UNIVAL_P(val).v = ecalloc(1, UBYTES(Z_UNILEN_P(phpbind->zval) + 1));
+
+ *alenpp = (ub4*) &Z_UNILEN_P(phpbind->zval);
+ *bufpp = Z_UNIVAL_P(phpbind->zval).v;
+ *piecep = OCI_ONE_PIECE;
+ *rcodepp = &phpbind->retcode;
+ *indpp = &phpbind->indicator;
+ retval = OCI_CONTINUE;
+ } else {
+ 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);
+
+ /* XXX we assume that zend-zval len has 4 bytes */
+ *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval);
+ *bufpp = Z_STRVAL_P(phpbind->zval);
+ *piecep = OCI_ONE_PIECE;
+ *rcodepp = &phpbind->retcode;
+ *indpp = &phpbind->indicator;
+ retval = OCI_CONTINUE;
+ }
}
-
return retval;
}
/* }}} */
return NULL;
}
- if (Z_TYPE_PP(column_index) == IS_STRING) {
- column = php_oci_statement_get_column(statement, -1, Z_STRVAL_PP(column_index), Z_STRLEN_PP(column_index) TSRMLS_CC);
+ if (Z_TYPE_PP(column_index) == IS_STRING || Z_TYPE_PP(column_index) == IS_UNICODE) {
+ column = php_oci_statement_get_column(statement, -1, Z_UNIVAL_PP(column_index), Z_UNILEN_PP(column_index) TSRMLS_CC);
if (!column) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_PP(column_index));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%v\"", Z_UNIVAL_PP(column_index));
return NULL;
}
} else {
convert_to_long_ex(column_index);
- column = php_oci_statement_get_column(statement, Z_LVAL_PP(column_index), NULL, 0 TSRMLS_CC);
+ column = php_oci_statement_get_column(statement, Z_LVAL_PP(column_index), NULL_ZSTR, 0 TSRMLS_CC);
if (!column) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL_PP(column_index));
return NULL;
/* {{{ 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, zstr name, int name_len, zval* var, long max_table_length, long maxlength, long type, zend_uchar uni_type TSRMLS_DC)
{
php_oci_bind *bind, *bindp;
zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0);
}
- zend_hash_update(statement->binds, name, name_len + 1, bind, sizeof(php_oci_bind), (void **)&bindp);
+ zend_hash_update(statement->binds, name.s, USTR_BYTES(uni_type, name_len + 1), bind, sizeof(php_oci_bind), (void **)&bindp);
bindp->descriptor = NULL;
bindp->statement = NULL;
statement->stmt,
(OCIBind **)&bindp->bind,
statement->err,
- (text *)name,
- name_len,
+ (text *)name.s,
+ USTR_BYTES(uni_type, name_len),
(dvoid *) bindp->array.elements,
- (sb4) bind->array.max_length,
+ (sb4) USTR_BYTES(uni_type, bind->array.max_length),
type,
(dvoid *)0, /* bindp->array.indicators, */
(ub2 *)bind->array.element_lengths,
if (maxlength == -1) {
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;
+ convert_to_text_ex(entry);
+ if (Z_UNILEN_PP(entry) > maxlength) {
+ maxlength = Z_UNILEN_PP(entry) + 1;
}
zend_hash_move_forward(hash);
}
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);
+ convert_to_text_ex(entry);
+ bind->array.element_lengths[i] = Z_UNILEN_PP(entry);
zend_hash_move_forward(hash);
} else {
break;
if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
int element_length;
- convert_to_string_ex(entry);
- element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength;
+ convert_to_text_ex(entry);
+ element_length = (maxlength > Z_UNILEN_PP(entry)) ? Z_UNILEN_PP(entry) : maxlength;
- memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length);
+ memcpy((text *)bind->array.elements + i*maxlength, Z_UNIVAL_PP(entry).s, element_length);
((text *)bind->array.elements)[i*maxlength + element_length] = '\0';
zend_hash_move_forward(hash);
/* }}} */
+typedef enum {
+ OCI_IS_CLOB=1,
+ OCI_IS_BLOB
+} php_oci_lob_type;
+
typedef struct { /* php_oci_connection {{{ */
OCIEnv *env; /* private env handle */
ub2 charset; /* charset ID */
time_t idle_expiry; /* time when the connection will be considered as expired */
time_t next_ping; /* time of the next ping */
char *hash_key; /* hashed details of the connection */
+ int hash_key_len;
} php_oci_connection; /* }}} */
typedef struct { /* php_oci_descriptor {{{ */
int id;
php_oci_connection *connection; /* parent connection handle */
dvoid *descriptor; /* OCI descriptor handle */
- ub4 type; /* descriptor type */
+ 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 */
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 */
ub2 charset_id; /* charset ID */
+ php_oci_lob_type lob_type; /* CLOB/BLOB */
} php_oci_descriptor; /* }}} */
typedef struct { /* php_oci_lob_ctx {{{ */
typedef struct { /* php_oci_define {{{ */
zval *zval; /* zval used in define */
- text *name; /* placeholder's name */
+ zstr name; /* placeholder's name */
+ zend_uchar name_type; /* unicode or not */
ub4 name_len; /* placeholder's name length */
ub4 type; /* define type */
} php_oci_define; /* }}} */
} array;
sb2 indicator; /* -1 means NULL */
ub2 retcode; /* */
+ zend_bool out; /* OUT bind or not */
} php_oci_bind; /* }}} */
typedef struct { /* php_oci_out_column {{{ */
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
OCIDefine *oci_define; /* define handle */
- char *name; /* column name */
+ zstr name; /* column name */
ub4 name_len; /* column name length */
ub2 data_type; /* column data type */
ub2 data_size; /* data size */
sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
#ifdef HAVE_OCI8_ATTR_STATEMENT
-int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC);
+int php_oci_fetch_sqltext_offset(php_oci_statement *, zstr *, ub2 * TSRMLS_DC);
#endif
void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
-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(zstr username, int username_len, zstr password, int password_len, zstr new_password, int new_password_len, zstr dbname, int dbname_len, zstr charset, long session_mode, int persistent, int exclusive, zend_uchar type TSRMLS_DC);
int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC);
int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
-int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC);
-int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC);
+int php_oci_password_change(php_oci_connection *, zstr, int, zstr, int, zstr, int, zend_uchar TSRMLS_DC);
+int php_oci_server_get_version(php_oci_connection *, zstr* TSRMLS_DC);
void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int);
int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC);
int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC);
-int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC);
-int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC);
+int php_oci_lob_get_type(php_oci_descriptor *descriptor, php_oci_lob_type *lob_type TSRMLS_DC);
+int php_oci_lob_read (php_oci_descriptor *, long, long, zstr *, ub4 * TSRMLS_DC);
+int php_oci_lob_write (php_oci_descriptor *, ub4, zstr, int, ub4 * TSRMLS_DC);
int php_oci_lob_flush (php_oci_descriptor *, int TSRMLS_DC);
int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
int php_oci_lob_get_buffering (php_oci_descriptor *);
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
#ifdef HAVE_OCI8_TEMP_LOB
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
-int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
+int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, zstr, int TSRMLS_DC);
#endif
void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
#else
sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
#endif
-
/* }}} */
/* collection related prototypes {{{ */
-php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC);
+php_oci_collection * php_oci_collection_create(php_oci_connection *, zstr, int, zstr, int TSRMLS_DC);
int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC);
int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC);
int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC);
-int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC);
+int php_oci_collection_append(php_oci_collection *, zstr, int TSRMLS_DC);
int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC);
-int php_oci_collection_element_set(php_oci_collection *, long, char*, int TSRMLS_DC);
+int php_oci_collection_element_set(php_oci_collection *, long, zstr, int TSRMLS_DC);
int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC);
-int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC);
+int php_oci_collection_element_set_date(php_oci_collection *, long, zstr, int TSRMLS_DC);
+int php_oci_collection_element_set_number(php_oci_collection *, long, zstr, int TSRMLS_DC);
+int php_oci_collection_element_set_string(php_oci_collection *, long, zstr, int TSRMLS_DC);
int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC);
void php_oci_collection_close(php_oci_collection * TSRMLS_DC);
int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC);
-int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC);
-int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC);
-int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC);
+int php_oci_collection_append_date(php_oci_collection *, zstr, int TSRMLS_DC);
+int php_oci_collection_append_number(php_oci_collection *, zstr, int TSRMLS_DC);
+int php_oci_collection_append_string(php_oci_collection *, zstr, int TSRMLS_DC);
/* }}} */
/* statement related prototypes {{{ */
-php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC);
+php_oci_statement * php_oci_statement_create (php_oci_connection *, zstr, int, zend_uchar TSRMLS_DC);
int php_oci_statement_set_prefetch (php_oci_statement *, ub4 TSRMLS_DC);
int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
-php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char*, int TSRMLS_DC);
+php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, zstr, int TSRMLS_DC);
int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC);
int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC);
void php_oci_statement_free (php_oci_statement * TSRMLS_DC);
int php_oci_bind_pre_exec(void *data TSRMLS_DC);
int php_oci_bind_post_exec(void *data TSRMLS_DC);
-int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, long TSRMLS_DC);
+int php_oci_bind_by_name(php_oci_statement *, zstr, int, zval*, long, long, zend_uchar TSRMLS_DC);
sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC);
int php_oci_statement_get_numrows(php_oci_statement *, ub4 * 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);
+int php_oci_bind_array_by_name(php_oci_statement *statement, zstr name, int name_len, zval* var, long max_table_length, long maxlength, long type, zend_uchar uni_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);
string(0) ""
}
Done
+--UEXPECTF--
+Warning: oci_execute(): ORA-01405: fetched column value is NULL in %s on line %d
+array(5) {
+ [0]=>
+ unicode(0) ""
+ [1]=>
+ unicode(0) ""
+ [2]=>
+ unicode(0) ""
+ [3]=>
+ unicode(0) ""
+ [4]=>
+ unicode(0) ""
+}
+Done
string(1) "5"
}
Done
+--UEXPECTF--
+Warning: oci_execute(): ORA-06550: line 1, column 28:
+PLS-00418: array bind type must match PL/SQL table row type
+ORA-06550: line 1, column 7:
+PL/SQL: Statement ignored in %s on line %d
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "2"
+ [2]=>
+ unicode(1) "3"
+ [3]=>
+ unicode(1) "4"
+ [4]=>
+ unicode(1) "5"
+}
+Done
--TEST--
-oci_bind_array_by_name() and invalid values 8
+oci_bind_array_by_name() and invalid values 10
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
string(1) "5"
}
Done
+--UEXPECTF--
+Warning: oci_bind_array_by_name(): ORA-01036: illegal variable name/number in %s on line %d
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "2"
+ [2]=>
+ unicode(1) "3"
+ [3]=>
+ unicode(1) "4"
+ [4]=>
+ unicode(1) "5"
+}
+Done
oci_execute($stmt);
$row = oci_fetch_row($stmt);
-var_dump(md5($row[0]));
+var_dump(md5((binary)$row[0]));
var_dump(strlen($row[0]));
$stmt = oci_parse($c, "drop table phptestlng");
oci_execute($stmt);
$row = oci_fetch_row($stmt);
-var_dump(md5($row[0]));
+var_dump(md5((binary)$row[0]));
var_dump(strlen($row[0]));
$stmt = oci_parse($c, "drop table phptestlngraw");
oci_execute($stmt);
$row = oci_fetch_row($stmt);
-var_dump(md5($row[0]));
+var_dump(md5((binary)$row[0]));
var_dump(strlen($row[0]));
$stmt = oci_parse($c, "drop table phptestrawtable");
string(3) "198"
string(3) "199"
Done
+--UEXPECTF--
+unicode(1) "1"
+unicode(1) "2"
+unicode(1) "3"
+unicode(1) "4"
+unicode(1) "5"
+unicode(1) "6"
+unicode(1) "7"
+unicode(1) "8"
+unicode(1) "9"
+unicode(2) "10"
+unicode(2) "11"
+unicode(2) "12"
+unicode(2) "13"
+unicode(2) "14"
+unicode(2) "15"
+unicode(2) "16"
+unicode(2) "17"
+unicode(2) "18"
+unicode(2) "19"
+unicode(2) "20"
+unicode(2) "21"
+unicode(2) "22"
+unicode(2) "23"
+unicode(2) "24"
+unicode(2) "25"
+unicode(2) "26"
+unicode(2) "27"
+unicode(2) "28"
+unicode(2) "29"
+unicode(2) "30"
+unicode(2) "31"
+unicode(2) "32"
+unicode(2) "33"
+unicode(2) "34"
+unicode(2) "35"
+unicode(2) "36"
+unicode(2) "37"
+unicode(2) "38"
+unicode(2) "39"
+unicode(2) "40"
+unicode(2) "41"
+unicode(2) "42"
+unicode(2) "43"
+unicode(2) "44"
+unicode(2) "45"
+unicode(2) "46"
+unicode(2) "47"
+unicode(2) "48"
+unicode(2) "49"
+unicode(2) "50"
+unicode(2) "51"
+unicode(2) "52"
+unicode(2) "53"
+unicode(2) "54"
+unicode(2) "55"
+unicode(2) "56"
+unicode(2) "57"
+unicode(2) "58"
+unicode(2) "59"
+unicode(2) "60"
+unicode(2) "61"
+unicode(2) "62"
+unicode(2) "63"
+unicode(2) "64"
+unicode(2) "65"
+unicode(2) "66"
+unicode(2) "67"
+unicode(2) "68"
+unicode(2) "69"
+unicode(2) "70"
+unicode(2) "71"
+unicode(2) "72"
+unicode(2) "73"
+unicode(2) "74"
+unicode(2) "75"
+unicode(2) "76"
+unicode(2) "77"
+unicode(2) "78"
+unicode(2) "79"
+unicode(2) "80"
+unicode(2) "81"
+unicode(2) "82"
+unicode(2) "83"
+unicode(2) "84"
+unicode(2) "85"
+unicode(2) "86"
+unicode(2) "87"
+unicode(2) "88"
+unicode(2) "89"
+unicode(2) "90"
+unicode(2) "91"
+unicode(2) "92"
+unicode(2) "93"
+unicode(2) "94"
+unicode(2) "95"
+unicode(2) "96"
+unicode(2) "97"
+unicode(2) "98"
+unicode(2) "99"
+unicode(3) "100"
+unicode(3) "101"
+unicode(3) "102"
+unicode(3) "103"
+unicode(3) "104"
+unicode(3) "105"
+unicode(3) "106"
+unicode(3) "107"
+unicode(3) "108"
+unicode(3) "109"
+unicode(3) "110"
+unicode(3) "111"
+unicode(3) "112"
+unicode(3) "113"
+unicode(3) "114"
+unicode(3) "115"
+unicode(3) "116"
+unicode(3) "117"
+unicode(3) "118"
+unicode(3) "119"
+unicode(3) "120"
+unicode(3) "121"
+unicode(3) "122"
+unicode(3) "123"
+unicode(3) "124"
+unicode(3) "125"
+unicode(3) "126"
+unicode(3) "127"
+unicode(3) "128"
+unicode(3) "129"
+unicode(3) "130"
+unicode(3) "131"
+unicode(3) "132"
+unicode(3) "133"
+unicode(3) "134"
+unicode(3) "135"
+unicode(3) "136"
+unicode(3) "137"
+unicode(3) "138"
+unicode(3) "139"
+unicode(3) "140"
+unicode(3) "141"
+unicode(3) "142"
+unicode(3) "143"
+unicode(3) "144"
+unicode(3) "145"
+unicode(3) "146"
+unicode(3) "147"
+unicode(3) "148"
+unicode(3) "149"
+unicode(3) "150"
+unicode(3) "151"
+unicode(3) "152"
+unicode(3) "153"
+unicode(3) "154"
+unicode(3) "155"
+unicode(3) "156"
+unicode(3) "157"
+unicode(3) "158"
+unicode(3) "159"
+unicode(3) "160"
+unicode(3) "161"
+unicode(3) "162"
+unicode(3) "163"
+unicode(3) "164"
+unicode(3) "165"
+unicode(3) "166"
+unicode(3) "167"
+unicode(3) "168"
+unicode(3) "169"
+unicode(3) "170"
+unicode(3) "171"
+unicode(3) "172"
+unicode(3) "173"
+unicode(3) "174"
+unicode(3) "175"
+unicode(3) "176"
+unicode(3) "177"
+unicode(3) "178"
+unicode(3) "179"
+unicode(3) "180"
+unicode(3) "181"
+unicode(3) "182"
+unicode(3) "183"
+unicode(3) "184"
+unicode(3) "185"
+unicode(3) "186"
+unicode(3) "187"
+unicode(3) "188"
+unicode(3) "189"
+unicode(3) "190"
+unicode(3) "191"
+unicode(3) "192"
+unicode(3) "193"
+unicode(3) "194"
+unicode(3) "195"
+unicode(3) "196"
+unicode(3) "197"
+unicode(3) "198"
+unicode(3) "199"
+Done
string(3) "198"
string(3) "199"
Done
+--UEXPECTF--
+unicode(1) "1"
+unicode(1) "2"
+unicode(1) "3"
+unicode(1) "4"
+unicode(1) "5"
+unicode(1) "6"
+unicode(1) "7"
+unicode(1) "8"
+unicode(1) "9"
+unicode(2) "10"
+unicode(2) "11"
+unicode(2) "12"
+unicode(2) "13"
+unicode(2) "14"
+unicode(2) "15"
+unicode(2) "16"
+unicode(2) "17"
+unicode(2) "18"
+unicode(2) "19"
+unicode(2) "20"
+unicode(2) "21"
+unicode(2) "22"
+unicode(2) "23"
+unicode(2) "24"
+unicode(2) "25"
+unicode(2) "26"
+unicode(2) "27"
+unicode(2) "28"
+unicode(2) "29"
+unicode(2) "30"
+unicode(2) "31"
+unicode(2) "32"
+unicode(2) "33"
+unicode(2) "34"
+unicode(2) "35"
+unicode(2) "36"
+unicode(2) "37"
+unicode(2) "38"
+unicode(2) "39"
+unicode(2) "40"
+unicode(2) "41"
+unicode(2) "42"
+unicode(2) "43"
+unicode(2) "44"
+unicode(2) "45"
+unicode(2) "46"
+unicode(2) "47"
+unicode(2) "48"
+unicode(2) "49"
+unicode(2) "50"
+unicode(2) "51"
+unicode(2) "52"
+unicode(2) "53"
+unicode(2) "54"
+unicode(2) "55"
+unicode(2) "56"
+unicode(2) "57"
+unicode(2) "58"
+unicode(2) "59"
+unicode(2) "60"
+unicode(2) "61"
+unicode(2) "62"
+unicode(2) "63"
+unicode(2) "64"
+unicode(2) "65"
+unicode(2) "66"
+unicode(2) "67"
+unicode(2) "68"
+unicode(2) "69"
+unicode(2) "70"
+unicode(2) "71"
+unicode(2) "72"
+unicode(2) "73"
+unicode(2) "74"
+unicode(2) "75"
+unicode(2) "76"
+unicode(2) "77"
+unicode(2) "78"
+unicode(2) "79"
+unicode(2) "80"
+unicode(2) "81"
+unicode(2) "82"
+unicode(2) "83"
+unicode(2) "84"
+unicode(2) "85"
+unicode(2) "86"
+unicode(2) "87"
+unicode(2) "88"
+unicode(2) "89"
+unicode(2) "90"
+unicode(2) "91"
+unicode(2) "92"
+unicode(2) "93"
+unicode(2) "94"
+unicode(2) "95"
+unicode(2) "96"
+unicode(2) "97"
+unicode(2) "98"
+unicode(2) "99"
+unicode(3) "100"
+unicode(3) "101"
+unicode(3) "102"
+unicode(3) "103"
+unicode(3) "104"
+unicode(3) "105"
+unicode(3) "106"
+unicode(3) "107"
+unicode(3) "108"
+unicode(3) "109"
+unicode(3) "110"
+unicode(3) "111"
+unicode(3) "112"
+unicode(3) "113"
+unicode(3) "114"
+unicode(3) "115"
+unicode(3) "116"
+unicode(3) "117"
+unicode(3) "118"
+unicode(3) "119"
+unicode(3) "120"
+unicode(3) "121"
+unicode(3) "122"
+unicode(3) "123"
+unicode(3) "124"
+unicode(3) "125"
+unicode(3) "126"
+unicode(3) "127"
+unicode(3) "128"
+unicode(3) "129"
+unicode(3) "130"
+unicode(3) "131"
+unicode(3) "132"
+unicode(3) "133"
+unicode(3) "134"
+unicode(3) "135"
+unicode(3) "136"
+unicode(3) "137"
+unicode(3) "138"
+unicode(3) "139"
+unicode(3) "140"
+unicode(3) "141"
+unicode(3) "142"
+unicode(3) "143"
+unicode(3) "144"
+unicode(3) "145"
+unicode(3) "146"
+unicode(3) "147"
+unicode(3) "148"
+unicode(3) "149"
+unicode(3) "150"
+unicode(3) "151"
+unicode(3) "152"
+unicode(3) "153"
+unicode(3) "154"
+unicode(3) "155"
+unicode(3) "156"
+unicode(3) "157"
+unicode(3) "158"
+unicode(3) "159"
+unicode(3) "160"
+unicode(3) "161"
+unicode(3) "162"
+unicode(3) "163"
+unicode(3) "164"
+unicode(3) "165"
+unicode(3) "166"
+unicode(3) "167"
+unicode(3) "168"
+unicode(3) "169"
+unicode(3) "170"
+unicode(3) "171"
+unicode(3) "172"
+unicode(3) "173"
+unicode(3) "174"
+unicode(3) "175"
+unicode(3) "176"
+unicode(3) "177"
+unicode(3) "178"
+unicode(3) "179"
+unicode(3) "180"
+unicode(3) "181"
+unicode(3) "182"
+unicode(3) "183"
+unicode(3) "184"
+unicode(3) "185"
+unicode(3) "186"
+unicode(3) "187"
+unicode(3) "188"
+unicode(3) "189"
+unicode(3) "190"
+unicode(3) "191"
+unicode(3) "192"
+unicode(3) "193"
+unicode(3) "194"
+unicode(3) "195"
+unicode(3) "196"
+unicode(3) "197"
+unicode(3) "198"
+unicode(3) "199"
+Done
string(3) "198"
string(3) "199"
Done
+--UEXPECTF--
+unicode(1) "1"
+unicode(1) "2"
+unicode(1) "3"
+unicode(1) "4"
+unicode(1) "5"
+unicode(1) "6"
+unicode(1) "7"
+unicode(1) "8"
+unicode(1) "9"
+unicode(2) "10"
+unicode(2) "11"
+unicode(2) "12"
+unicode(2) "13"
+unicode(2) "14"
+unicode(2) "15"
+unicode(2) "16"
+unicode(2) "17"
+unicode(2) "18"
+unicode(2) "19"
+unicode(2) "20"
+unicode(2) "21"
+unicode(2) "22"
+unicode(2) "23"
+unicode(2) "24"
+unicode(2) "25"
+unicode(2) "26"
+unicode(2) "27"
+unicode(2) "28"
+unicode(2) "29"
+unicode(2) "30"
+unicode(2) "31"
+unicode(2) "32"
+unicode(2) "33"
+unicode(2) "34"
+unicode(2) "35"
+unicode(2) "36"
+unicode(2) "37"
+unicode(2) "38"
+unicode(2) "39"
+unicode(2) "40"
+unicode(2) "41"
+unicode(2) "42"
+unicode(2) "43"
+unicode(2) "44"
+unicode(2) "45"
+unicode(2) "46"
+unicode(2) "47"
+unicode(2) "48"
+unicode(2) "49"
+unicode(2) "50"
+unicode(2) "51"
+unicode(2) "52"
+unicode(2) "53"
+unicode(2) "54"
+unicode(2) "55"
+unicode(2) "56"
+unicode(2) "57"
+unicode(2) "58"
+unicode(2) "59"
+unicode(2) "60"
+unicode(2) "61"
+unicode(2) "62"
+unicode(2) "63"
+unicode(2) "64"
+unicode(2) "65"
+unicode(2) "66"
+unicode(2) "67"
+unicode(2) "68"
+unicode(2) "69"
+unicode(2) "70"
+unicode(2) "71"
+unicode(2) "72"
+unicode(2) "73"
+unicode(2) "74"
+unicode(2) "75"
+unicode(2) "76"
+unicode(2) "77"
+unicode(2) "78"
+unicode(2) "79"
+unicode(2) "80"
+unicode(2) "81"
+unicode(2) "82"
+unicode(2) "83"
+unicode(2) "84"
+unicode(2) "85"
+unicode(2) "86"
+unicode(2) "87"
+unicode(2) "88"
+unicode(2) "89"
+unicode(2) "90"
+unicode(2) "91"
+unicode(2) "92"
+unicode(2) "93"
+unicode(2) "94"
+unicode(2) "95"
+unicode(2) "96"
+unicode(2) "97"
+unicode(2) "98"
+unicode(2) "99"
+unicode(3) "100"
+unicode(3) "101"
+unicode(3) "102"
+unicode(3) "103"
+unicode(3) "104"
+unicode(3) "105"
+unicode(3) "106"
+unicode(3) "107"
+unicode(3) "108"
+unicode(3) "109"
+unicode(3) "110"
+unicode(3) "111"
+unicode(3) "112"
+unicode(3) "113"
+unicode(3) "114"
+unicode(3) "115"
+unicode(3) "116"
+unicode(3) "117"
+unicode(3) "118"
+unicode(3) "119"
+unicode(3) "120"
+unicode(3) "121"
+unicode(3) "122"
+unicode(3) "123"
+unicode(3) "124"
+unicode(3) "125"
+unicode(3) "126"
+unicode(3) "127"
+unicode(3) "128"
+unicode(3) "129"
+unicode(3) "130"
+unicode(3) "131"
+unicode(3) "132"
+unicode(3) "133"
+unicode(3) "134"
+unicode(3) "135"
+unicode(3) "136"
+unicode(3) "137"
+unicode(3) "138"
+unicode(3) "139"
+unicode(3) "140"
+unicode(3) "141"
+unicode(3) "142"
+unicode(3) "143"
+unicode(3) "144"
+unicode(3) "145"
+unicode(3) "146"
+unicode(3) "147"
+unicode(3) "148"
+unicode(3) "149"
+unicode(3) "150"
+unicode(3) "151"
+unicode(3) "152"
+unicode(3) "153"
+unicode(3) "154"
+unicode(3) "155"
+unicode(3) "156"
+unicode(3) "157"
+unicode(3) "158"
+unicode(3) "159"
+unicode(3) "160"
+unicode(3) "161"
+unicode(3) "162"
+unicode(3) "163"
+unicode(3) "164"
+unicode(3) "165"
+unicode(3) "166"
+unicode(3) "167"
+unicode(3) "168"
+unicode(3) "169"
+unicode(3) "170"
+unicode(3) "171"
+unicode(3) "172"
+unicode(3) "173"
+unicode(3) "174"
+unicode(3) "175"
+unicode(3) "176"
+unicode(3) "177"
+unicode(3) "178"
+unicode(3) "179"
+unicode(3) "180"
+unicode(3) "181"
+unicode(3) "182"
+unicode(3) "183"
+unicode(3) "184"
+unicode(3) "185"
+unicode(3) "186"
+unicode(3) "187"
+unicode(3) "188"
+unicode(3) "189"
+unicode(3) "190"
+unicode(3) "191"
+unicode(3) "192"
+unicode(3) "193"
+unicode(3) "194"
+unicode(3) "195"
+unicode(3) "196"
+unicode(3) "197"
+unicode(3) "198"
+unicode(3) "199"
+Done
string(%d) "%s5"
string(%d) "%sa"
Done
+--UEXPECTF--
+array(1) {
+ [u"NC"]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+unicode(%d) "%s5"
+unicode(%d) "%sa"
+Done
string(5) "'ABC'"
string(4) "CHAR"
Done
+--UEXPECT--
+bool(false)
+bool(false)
+unicode(5) "'ABC'"
+unicode(4) "CHAR"
+Done
bool(true)
string(6) "string"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+bool(true)
+unicode(6) "string"
+Done
bool(true)
string(6) "string"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+bool(true)
+unicode(6) "string"
+Done
bool(true)
string(9) "28-JUL-05"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "28-JUL-05"
+Done
bool(true)
string(9) "28-JUL-05"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "28-JUL-05"
+Done
bool(true)
string(9) "01-JAN-05"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "01-JAN-05"
+Done
bool(true)
string(9) "01-JAN-05"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(9) "01-JAN-05"
+Done
bool(true)
string(4) "blah"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(4) "blah"
+Done
bool(true)
string(4) "blah"
Done
+--UEXPECT--
+bool(true)
+bool(true)
+unicode(4) "blah"
+Done
[u"ID"]=>
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
[3]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"VALUE"]=>
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
[3]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"BLOB"]=>
array(4) {
[u"ID"]=>
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
[3]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"VALUE"]=>
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
[3]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"BLOB"]=>
array(4) {
}
bool(false)
Done
+--UEXPECT--
+array(2) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+}
+array(2) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+}
+array(2) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+}
+bool(false)
+Done
--UEXPECTF--
array(5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
--UEXPECTF--
array(2) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
bool(true)
Warning: ocifetchinto(): ORA-01002: fetch out of sequence in %s on line %d
array(2) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
bool(true)
Done
--EXPECT--
string(4) "some"
Done
+--UEXPECT--
+unicode(4) "some"
+Done
NULL
string(4) "some"
Done
+--UEXPECTF--
+bool(true)
+bool(false)
+
+Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d
+bool(false)
+
+Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
+NULL
+unicode(4) "some"
+Done
--EXPECT--
string(4) "some"
Done
+--UEXPECT--
+unicode(4) "some"
+Done
Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d
bool(false)
array(4) {
- [u"code"]=>
+ ["code"]=>
int(900)
- [u"message"]=>
- string(32) "ORA-00900: invalid SQL statement"
- [u"offset"]=>
+ ["message"]=>
+ unicode(32) "ORA-00900: invalid SQL statement"
+ ["offset"]=>
int(0)
- [u"sqltext"]=>
- string(12) "WRONG SYNTAX"
+ ["sqltext"]=>
+ unicode(12) "WRONG SYNTAX"
}
Done
string(0) ""
}
Done
---UEXPECTF--
-Warning: oci_connect(): ORA-12154: TNS:could not resolve service name in %s on line %d
-bool(false)
-array(4) {
- [u"code"]=>
- int(12154)
- [u"message"]=>
- string(45) "ORA-12154: TNS:could not resolve service name"
- [u"offset"]=>
- int(0)
- [u"sqltext"]=>
- string(0) ""
-}
-Done
Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d
bool(false)
array(4) {
- [u"code"]=>
+ ["code"]=>
int(900)
- [u"message"]=>
- string(32) "ORA-00900: invalid SQL statement"
- [u"offset"]=>
+ ["message"]=>
+ unicode(32) "ORA-00900: invalid SQL statement"
+ ["offset"]=>
int(0)
- [u"sqltext"]=>
- string(12) "WRONG SYNTAX"
+ ["sqltext"]=>
+ unicode(12) "WRONG SYNTAX"
}
Done
string(1) "1"
string(1) "1"
Done
+--UEXPECT--
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+unicode(1) "1"
+Done
[u"ID"]=>
array(3) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"VALUE"]=>
array(3) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"BLOB"]=>
array(3) {
[u"ID"]=>
array(3) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"VALUE"]=>
array(3) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
- string(1) "1"
+ unicode(1) "1"
}
[u"BLOB"]=>
array(3) {
--UEXPECT--
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
}
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
}
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
}
array(2) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
}
array(2) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
}
array(2) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
}
array(2) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(2) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(2) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
}
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
}
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
--UEXPECT--
array(5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
}
array(5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
}
array(5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
int(5)
array(2) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
}
int(5)
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
int(5)
array(2) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
}
int(5)
array(2) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
int(5)
array(5) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[3]=>
int(5)
array(2) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
}
int(5)
array(4) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
}
int(5)
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
int(5)
array(10) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[u"BLOB"]=>
int(5)
array(5) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[3]=>
int(5)
array(5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
int(5)
array(5) {
[0]=>
- string(1) "1"
+ unicode(1) "1"
[1]=>
- string(1) "1"
+ unicode(1) "1"
[2]=>
NULL
[3]=>
string(1) "1"
}
Done
+--UEXPECTF--
+Warning: ocifetchinto() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Notice: Undefined variable: all in %s on line %d
+NULL
+
+Warning: ocifetchinto() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+NULL
+
+Warning: ocifetchinto(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+NULL
+int(5)
+array(2) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+}
+Done
--UEXPECTF--
object(stdClass)#%d (5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
}
object(stdClass)#%d (5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
}
object(stdClass)#%d (5) {
[u"ID"]=>
- string(1) "1"
+ unicode(1) "1"
[u"VALUE"]=>
- string(1) "1"
+ unicode(1) "1"
[u"BLOB"]=>
NULL
[u"CLOB"]=>
NULL
}
Done
+--UEXPECT--
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+Done
int(0)
int(10)
Done
+--UEXPECTF--
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+bool(false)
+unicode(2) "ID"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(false)
+unicode(5) "VALUE"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(true)
+unicode(4) "BLOB"
+unicode(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(4) "CLOB"
+unicode(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(6) "STRING"
+unicode(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d
bool(false)
Done
+--UEXPECTF--
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+
+Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): Invalid column index "-1" in %s on line %d
+bool(false)
+
+Warning: oci_field_is_null(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): Invalid column name "none" in %s on line %d
+bool(false)
+
+Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+
+Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_name(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_type(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_type_raw(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_scale(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_precision(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_size(): Invalid column index "0" in %s on line %d
+bool(false)
+
+Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+Done
int(0)
int(10)
Done
+--UEXPECTF--
+array(5) {
+ [0]=>
+ unicode(1) "1"
+ [1]=>
+ unicode(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+bool(false)
+unicode(2) "ID"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(false)
+unicode(5) "VALUE"
+unicode(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(true)
+unicode(4) "BLOB"
+unicode(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(4) "CLOB"
+unicode(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+unicode(6) "STRING"
+unicode(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
var_dump($blob);
-var_dump($blob->write("test", -1));
-var_dump($blob->write("test", "str"));
-var_dump($blob->write("test", 1000000));
-var_dump($blob->write(str_repeat("test", 10000), 1000000));
+var_dump($blob->write(b"test", -1));
+var_dump($blob->write(b"test", "str"));
+var_dump($blob->write(b"test", 1000000));
+var_dump($blob->write((binary)str_repeat("test", 10000), 1000000));
var_dump($blob->tell());
-var_dump($blob->seek("str", -5));
+var_dump($blob->seek(b"str", -5));
var_dump($blob->flush());
oci_commit($c);
int(40000)
int(40004)
-Warning: OCI-Lob::seek() expects parameter 1 to be long, Unicode string given in %s on line %d
+Warning: OCI-Lob::seek() expects parameter 1 to be long, binary string given in %s on line %d
NULL
bool(false)
int(40004)
var_dump($blob);
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump($blob->rewind());
-var_dump($blob->write("str"));
+var_dump($blob->write(b"str"));
var_dump($blob->seek(10, OCI_SEEK_SET));
oci_commit($c);
var_dump($blob);
var_dump($blob->size());
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
var_dump($blob->size());
oci_commit($c);
var_dump($blob);
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
oci_commit($c);
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
-var_dump($blob->save("string"));
-var_dump($blob->save("string", 3));
+var_dump($blob->save(b"string"));
+var_dump($blob->save(b"string", 3));
oci_commit($c);
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
-var_dump($blob->write("some string here. string, I said"));
+var_dump($blob->write(b"some string here. string, I said"));
oci_commit($c);
$ora_sql = "INSERT INTO
$blob;
-var_dump($blob->write("test string is here\nnew string"));
+var_dump($blob->write(b"test string is here\nnew string"));
oci_commit($c);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump($blob->getBuffering());
var_dump($blob->setBuffering(true));
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump($blob->getBuffering());
var_dump($blob->flush());
$blob;
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump($blob->close());
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump($blob->free());
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
oci_commit($c);
$row = oci_fetch_assoc($statement);
-$row['LOB_1']->write("first");
-$row['LOB_2']->write("second");
+$row['LOB_1']->write(b"first");
+$row['LOB_2']->write(b"second");
unset($row);
$row = oci_fetch_assoc($statement);
-$row['LOB_1']->write("first");
-$row['LOB_2']->write("second");
+$row['LOB_1']->write(b"first");
+$row['LOB_2']->write(b"second");
unset($row);
string(9) "long data"
string(4) "data"
Done
+--UEXPECTF--
+unicode(4) "data"
+unicode(9) "long data"
+unicode(9) "long data"
+unicode(4) "data"
+Done
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
-$blob;
-
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump($blob->close());
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump(oci_free_descriptor($blob));
-var_dump($blob->write("test"));
+var_dump($blob->write(b"test"));
var_dump(oci_free_descriptor($blob));
var_dump(oci_free_descriptor(new stdclass));
string(9) "long data"
string(4) "data"
Done
+--UEXPECTF--
+Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d
+
+Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d
+
+Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d
+
+Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d
+unicode(4) "data"
+unicode(9) "long data"
+unicode(9) "long data"
+unicode(4) "data"
+Done
test lob_009.phpt
"
Done
+--UEXPECTF--
+object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+bool(true)
+bool(true)
+
+Warning: OCI-Lob::import() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_import() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+bool(true)
+
+Warning: oci_lob_import(): Unable to find descriptor property in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ [u"BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(43) "this
+is
+a
+test
+file for
+test lob_009.phpt
+"
+Done
var_dump($blob);
var_dump($blob->size());
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
var_dump($blob->size());
oci_commit($c);
Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d
bool(false)
Done
+--UEXPECTF--
+object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+int(0)
+int(7000)
+int(7000)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ [u"BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+int(7000)
+int(7000)
+
+Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d
+bool(false)
+Done
oci_execute($statement, OCI_DEFAULT);
var_dump($blob->size());
-var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->write((binary)str_repeat("string.", 1000)));
var_dump($blob->size());
oci_commit($c);
Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d
bool(false)
Done
+--UEXPECTF--
+int(0)
+int(7000)
+int(7000)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ [u"BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(2) "st"
+
+Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+bool(false)
+
+Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_read(): Unable to find descriptor property in %s on line %d
+bool(false)
+
+Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d
+bool(false)
+Done
var_dump($blob);
-var_dump(oci_lob_write($blob, "test"));
+var_dump(oci_lob_write($blob, b"test"));
var_dump(oci_lob_rewind());
var_dump(oci_lob_rewind($blob));
-var_dump(oci_lob_write($blob, "str"));
+var_dump(oci_lob_write($blob, b"str"));
var_dump(oci_lob_seek(10, OCI_SEEK_SET));
var_dump(oci_lob_seek($blob, 10, OCI_SEEK_SET));
string(4) "strt"
string(8) "strtstrt"
Done
+--UEXPECTF--
+object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+int(4)
+
+Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+bool(true)
+int(3)
+
+Warning: oci_lob_seek() expects parameter 1 to be OCI-Lob, integer given in %s on line %d
+NULL
+bool(true)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ [u"BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ [u"descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+
+Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_append() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+bool(true)
+
+Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+string(4) "strt"
+string(8) "strtstrt"
+Done
bool(true)
string(2) "te"
Done
+--UEXPECTF--
+bool(true)
+unicode(4) "test"
+bool(true)
+unicode(2) "te"
+bool(true)
+unicode(4) "test"
+bool(true)
+unicode(2) "te"
+Done
string(4) "test"
bool(true)
Done
+--UEXPECTF--
+bool(true)
+unicode(4) "test"
+bool(true)
+bool(true)
+unicode(4) "test"
+bool(true)
+Done
string(19) "1234567890111111111"
}
Done
+--UEXPECT--
+array(2) {
+ [u"L1"]=>
+ unicode(19) "1234567890111111111"
+ [u"L2"]=>
+ unicode(9) "987654321"
+}
+array(2) {
+ [u"L1"]=>
+ unicode(15) "122222222222222"
+ [u"L2"]=>
+ unicode(9) "123456789"
+}
+array(2) {
+ [u"L1"]=>
+ unicode(30) "985456745674567654567654567654"
+ [u"L2"]=>
+ unicode(30) "985456745674567654567654567654"
+}
+array(2) {
+ [u"L1"]=>
+ unicode(9) "123456789"
+ [u"L2"]=>
+ unicode(15) "122222222222222"
+}
+array(2) {
+ [u"L1"]=>
+ unicode(9) "987654321"
+ [u"L2"]=>
+ unicode(19) "1234567890111111111"
+}
+Done
string(%d) "%s"
string(%d) "%s"
Done
+--UEXPECTF--
+resource(%d) of type (oci8 connection)
+unicode(%d) "%s"
+unicode(%d) "%s"
+Done
--UEXPECTF--
array(2) {
[0]=>
- string(1) "4"
+ unicode(1) "4"
[u"1+3"]=>
- string(1) "4"
+ unicode(1) "4"
}
array(2) {
[0]=>
- string(1) "4"
+ unicode(1) "4"
[u"1+3"]=>
- string(1) "4"
+ unicode(1) "4"
}
Done