diff --git a/ibm_db2.c b/ibm_db2.c index 89be662..3f4740d 100644 --- a/ibm_db2.c +++ b/ibm_db2.c @@ -4350,6 +4350,7 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int /* something went very wrong with heap */ if (Z_STRVAL_P(*data) == NULL ) { + php_error_docref(NULL, E_WARNING, "Pointer to string data for binding padding is null"); return SQL_ERROR; } @@ -4516,6 +4517,7 @@ static int _php_db2_bind_data( stmt_handle *stmt_res, param_node *curr, zval **b break; default: + php_error_docref(NULL, E_WARNING, "Unknown SQL data type %d used for binding", curr->data_type); return SQL_ERROR; } @@ -4525,6 +4527,7 @@ static int _php_db2_bind_data( stmt_handle *stmt_res, param_node *curr, zval **b if ( curr->param_type == DB2_PARAM_FILE) { /* Only string types can be bound */ if ( ZEND_Z_TYPE_PP(bind_data) != IS_STRING) { + php_error_docref(NULL, E_WARNING, "Only string types can be bound, got %s", zend_zval_type_name(*bind_data)); return SQL_ERROR; } /* len = 0 */ @@ -4661,6 +4664,7 @@ static int _php_db2_bind_data( stmt_handle *stmt_res, param_node *curr, zval **b break; default: + php_error_docref(NULL, E_WARNING, "zval of type %s cannot be bound", zend_zval_type_name(curr->value)); return SQL_ERROR; } return rc; @@ -4695,7 +4699,7 @@ static int _php_db2_execute_helper(stmt_handle *stmt_res, zval **data, int bind_ if (_php_db2_hash_find_ind(curr->varname, strlen(curr->varname), &temp, &bind_data, &symbol_table_used) != FAILURE ) { rc = _php_db2_bind_data( stmt_res, curr, bind_data); if ( rc == SQL_ERROR ) { - php_error_docref(NULL, E_WARNING, "Binding Error 1"); + php_error_docref(NULL, E_WARNING, "Error binding $%s from cached parameters", curr->varname); return rc; } curr = curr->next; @@ -4729,7 +4733,7 @@ static int _php_db2_execute_helper(stmt_handle *stmt_res, zval **data, int bind_ rc = _php_db2_bind_data( stmt_res, curr, data); if ( rc == SQL_ERROR ) { - php_error_docref(NULL, E_WARNING, "Binding Error 2"); + php_error_docref(NULL, E_WARNING, "Error binding parameter number %d", param_no); return rc; } } else { @@ -4742,7 +4746,7 @@ static int _php_db2_execute_helper(stmt_handle *stmt_res, zval **data, int bind_ if ( curr != NULL ) { rc = _php_db2_bind_data( stmt_res, curr, data); if ( rc == SQL_ERROR ) { - php_error_docref(NULL, E_WARNING, "Binding Error 2"); + php_error_docref(NULL, E_WARNING, "Error binding head cache node"); return rc; } stmt_res->current_node = curr->next; @@ -4885,7 +4889,7 @@ PHP_FUNCTION(db2_execute) */ rc = _php_db2_execute_helper(stmt_res, data, 0, bind_params); if ( rc == SQL_ERROR) { - php_error_docref(NULL, E_WARNING, "Binding Error"); + php_error_docref(NULL, E_WARNING, "Error binding additional params in execute"); RETURN_FALSE; } /* Move array ptr forward */ @@ -4910,7 +4914,7 @@ PHP_FUNCTION(db2_execute) /* And bind sequentially */ rc = _php_db2_execute_helper(stmt_res, NULL, 1, 0); if ( rc == SQL_ERROR ) { - php_error_docref(NULL, E_WARNING, "Binding Error 3"); + php_error_docref(NULL, E_WARNING, "Error binding params in execute"); RETURN_FALSE; } } @@ -7847,7 +7851,7 @@ PHP_FUNCTION( db2_execute_many ) rc = SQLBindParameter(stmt_res->hstmt, curr->param_num, curr->param_type, valueType, curr->data_type, curr->param_size, curr->scale, (curr->value), 0, (SQLLEN *)&((curr->value)->value.lval)); } if ( rc == SQL_ERROR ) { - sprintf(error, "Binding Error1 : %s", IBM_DB2_G(__php_stmt_err_msg)); + sprintf(error, "Error binding params in execute many: %s", IBM_DB2_G(__php_stmt_err_msg)); _build_client_err_list(head_error_list, error); err_count++; break;