String of zero size, definitely can't be the next max_length.
Thus for NULL and zero-length we are quite efficient.
*/
- //??? if (Z_TYPE(current_row[i]) >= IS_STRING) {
if (Z_TYPE(current_row[i]) == IS_STRING) {
unsigned long len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
if (stmt->result_bind[i].bound == TRUE) {
DBG_INF_FMT("%u has refcount=%u", i,
Z_REFCOUNTED(stmt->result_bind[i].zv)? Z_REFCOUNT(stmt->result_bind[i].zv) : 0);
- /*
- We have to separate the actual zval value of the bound
- variable from our allocated zvals or we will face double-free
- */
- if (Z_REFCOUNTED(stmt->result_bind[i].zv) && Z_REFCOUNT(stmt->result_bind[i].zv) > 1) {
-#ifdef WE_DONT_COPY_IN_BUFFERED_AND_UNBUFFERED_BECAUSEOF_IS_REF
- Z_TRY_ADDREF_P(&stmt->result_bind[i].zv);
-#endif
- zval_ptr_dtor(&stmt->result_bind[i].zv);
- } else {
- /*
- If it is a string, what is pointed will be freed
- later in free_result(). We need to remove the variable to
- which the user has lost reference.
- */
-#ifdef WE_DONT_COPY_IN_BUFFERED_AND_UNBUFFERED_BECAUSEOF_IS_REF
- //??? ZVAL_NULL(&stmt->result_bind[i].zv);
-#endif
- zval_ptr_dtor(&stmt->result_bind[i].zv);
- }
+ zval_ptr_dtor(&stmt->result_bind[i].zv);
}
}
+
s->m->free_result_bind(s, stmt->result_bind TSRMLS_CC);
stmt->result_bind = NULL;
DBG_INF_FMT("%u has refcount=%u", param_no,
Z_REFCOUNTED(stmt->result_bind[param_no].zv)?
Z_REFCOUNT(stmt->result_bind[param_no].zv) : 0);
- /*
- We have to separate the actual zval value of the bound
- variable from our allocated zvals or we will face double-free
- */
- if (Z_REFCOUNTED(stmt->result_bind[param_no].zv) && Z_REFCOUNT(stmt->result_bind[param_no].zv) > 1) {
-#ifdef WE_DONT_COPY_IN_BUFFERED_AND_UNBUFFERED_BECAUSEOF_IS_REF
- Z_TRY_ADDREF_P(&stmt->result_bind[param_no].zv);
-#endif
- zval_ptr_dtor(&stmt->result_bind[param_no].zv);
- } else {
- /*
- If it is a string, what is pointed will be freed
- later in free_result(). We need to remove the variable to
- which the user has lost reference.
- */
-#ifdef WE_DONT_COPY_IN_BUFFERED_AND_UNBUFFERED_BECAUSEOF_IS_REF
- //???ZVAL_NULL(&stmt->result_bind[param_no].zv);
-#endif
- zval_ptr_dtor(&stmt->result_bind[param_no].zv);
- }
+ zval_ptr_dtor(&stmt->result_bind[param_no].zv);
}
DBG_VOID_RETURN;
String of zero size, definitely can't be the next max_length.
Thus for NULL and zero-length we are quite efficient.
*/
- //???? if (Z_TYPE_P(data_cursor[i]) >= IS_STRING) {
if (Z_TYPE(data_cursor[i]) == IS_STRING) {
unsigned long len = Z_STRLEN(data_cursor[i]);
if (meta->fields[i].max_length < len) {
String of zero size, definitely can't be the next max_length.
Thus for NULL and zero-length we are quite efficient.
*/
- //??? if (Z_TYPE(current_row[i]) >= IS_STRING) {
if (Z_TYPE(current_row[i]) == IS_STRING) {
unsigned long len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
/* }}} */
-#if 0
-/* {{{ mysqlnd_rset_zval_ptr_dtor */
-static void
-mysqlnd_rset_zval_ptr_dtor(zval *zv, enum_mysqlnd_res_type type, zend_bool * copy_ctor_called TSRMLS_DC)
-{
- DBG_ENTER("mysqlnd_rset_zval_ptr_dtor");
- DBG_INF_FMT("type=%u", type);
- if (!zv) {
- *copy_ctor_called = FALSE;
- DBG_ERR_FMT("zv was NULL");
- DBG_VOID_RETURN;
- }
- /*
- This zval is not from the cache block.
- Thus the refcount is -1 than of a zval from the cache,
- because the zvals from the cache are owned by it.
- */
- if (type == MYSQLND_RES_PS_BUF || type == MYSQLND_RES_PS_UNBUF) {
- *copy_ctor_called = FALSE;
- ; /* do nothing, zval_ptr_dtor will do the job*/
- } else if (Z_REFCOUNTED_P(zv) && Z_REFCOUNT_P(zv) > 1) {
- /*
- Not a prepared statement, then we have to
- call copy_ctor and then zval_ptr_dtor()
- */
- if (Z_TYPE_P(zv) == IS_STRING) {
- zval_copy_ctor(zv);
- }
- *copy_ctor_called = TRUE;
- } else {
- /*
- noone but us point to this, so we can safely ZVAL_NULL the zval,
- so Zend does not try to free what the zval points to - which is
- in result set buffers
- */
- *copy_ctor_called = FALSE;
- if (Z_TYPE_P(zv) == IS_STRING) {
- ZVAL_NULL(zv);
- }
- }
-
- DBG_INF_FMT("call the dtor on zval with refc %u", Z_REFCOUNTED_P(zv)? Z_REFCOUNT_P(zv) : 0);
- zval_ptr_dtor(zv);
- DBG_VOID_RETURN;
-}
-/* }}} */
-#endif
-
-
/* {{{ mysqlnd_result_unbuffered::free_last_data */
static void
MYSQLND_METHOD(mysqlnd_result_unbuffered, free_last_data)(MYSQLND_RES_UNBUFFERED * unbuf, MYSQLND_STATS * const global_stats TSRMLS_DC)
if (unbuf->last_row_data) {
unsigned int i;
for (i = 0; i < unbuf->field_count; i++) {
- //???mysqlnd_rset_zval_ptr_dtor(&(unbuf->last_row_data[i]), unbuf->ps ? MYSQLND_RES_PS_UNBUF : MYSQLND_RES_NORMAL, ©_ctor_called TSRMLS_CC);
zval_ptr_dtor(&(unbuf->last_row_data[i]));
}
String of zero size, definitely can't be the next max_length.
Thus for NULL and zero-length we are quite efficient.
*/
- //???? if (Z_TYPE(current_row[i]) >= IS_STRING) {
if (Z_TYPE(current_row[i]) == IS_STRING) {
unsigned long len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
String of zero size, definitely can't be the next max_length.
Thus for NULL and zero-length we are quite efficient.
*/
- //???? if (Z_TYPE_P(current_row[i]) >= IS_STRING) {
if (Z_TYPE(current_row[i]) == IS_STRING) {
unsigned long len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
String of zero size, definitely can't be the next max_length.
Thus for NULL and zero-length we are quite efficient.
*/
- //???? if (Z_TYPE(current_row[i]) >= IS_STRING) {
if (Z_TYPE(current_row[i]) == IS_STRING) {
unsigned long len = Z_STRLEN(current_row[i]);
if (meta->fields[i].max_length < len) {
zend_hash_internal_pointer_reset(Z_ARRVAL(row));
while (i++ < offset) {
zend_hash_move_forward(Z_ARRVAL(row));
- //???entry = zend_hash_get_current_data(Z_ARRVAL(row));
}
entry = zend_hash_get_current_data(Z_ARRVAL(row));
#error Need fix for this architecture
#endif /* SIZEOF */
{
- //???? ZVAL_STRINGL(current_field, (char *)p, len, 0);
ZVAL_STRINGL(current_field, (char *)p, len);
} else {
ZVAL_LONG(current_field, (long) v); /* the cast is safe */
p -= len;
if (Z_TYPE_P(current_field) == IS_LONG) {
bit_area += 1 + sprintf((char *)start, "%ld", Z_LVAL_P(current_field));
- //???? ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1, copy_data);
ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1);
} else if (Z_TYPE_P(current_field) == IS_STRING){
memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field));