Inserted a few extra initialisations, just in case. Had some problems in a

different module, this solved it there, hance the added insurance. (Mc)
This commit is contained in:
Marc Boeren 2001-04-02 08:51:35 +00:00
parent 4fa9c7477b
commit cbdd711312
3 changed files with 12 additions and 0 deletions

View File

@ -293,6 +293,7 @@ ZEND_FUNCTION(dbx_close)
}
MAKE_STD_ZVAL(rv_success);
ZVAL_LONG(rv_success, 0);
result = switch_dbx_close(&rv_success, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
@ -359,6 +360,7 @@ ZEND_FUNCTION(dbx_query)
/ / }
/*/
MAKE_STD_ZVAL(rv_result_handle);
ZVAL_LONG(rv_result_handle, 0);
convert_to_string_ex(arguments[1]);
result = switch_dbx_query(&rv_result_handle, dbx_handle, arguments[1], INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
/*/ boolean return value means either failure for any query or success for queries that don't return anything /*/
@ -398,6 +400,7 @@ ZEND_FUNCTION(dbx_query)
zend_hash_update(return_value->value.obj.properties, "data", 5, (void *)&(data), sizeof(zval *), NULL);
/*/ get columncount and add to returnvalue as property /*/
MAKE_STD_ZVAL(rv_column_count);
ZVAL_LONG(rv_column_count, 0);
result = switch_dbx_getcolumncount(&rv_column_count, &rv_result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
if (!result) {
zend_error(E_ERROR, "dbx_query: get column_count failed...");
@ -417,6 +420,7 @@ ZEND_FUNCTION(dbx_query)
for (col_index=0; col_index<rv_column_count->value.lval; ++col_index) {
zval * rv_column_name;
MAKE_STD_ZVAL(rv_column_name);
ZVAL_LONG(rv_column_name, 0);
result = switch_dbx_getcolumnname(&rv_column_name, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
if (result) {
zend_hash_index_update(info_row->value.ht, col_index, (void *)&(rv_column_name), sizeof(zval *), NULL);
@ -439,6 +443,7 @@ ZEND_FUNCTION(dbx_query)
for (col_index=0; col_index<rv_column_count->value.lval; ++col_index) {
zval * rv_column_type;
MAKE_STD_ZVAL(rv_column_type);
ZVAL_LONG(rv_column_type, 0);
result = switch_dbx_getcolumntype(&rv_column_type, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
if (result) {
zend_hash_index_update(info_row->value.ht, col_index, (void *)&(rv_column_type), sizeof(zval *), NULL);
@ -455,6 +460,7 @@ ZEND_FUNCTION(dbx_query)
while (result) {
zval * rv_row;
MAKE_STD_ZVAL(rv_row);
ZVAL_LONG(rv_row, 0);
result = switch_dbx_getrow(&rv_row, &rv_result_handle, row_count, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
if (result) {
/*/ if (row_count>=result_row_offset && (result_row_count==-1 || row_count<result_row_offset+result_row_count)) { /*/
@ -513,6 +519,7 @@ ZEND_FUNCTION(dbx_error)
}
MAKE_STD_ZVAL(rv_errormsg);
ZVAL_LONG(rv_errormsg, 0);
result = switch_dbx_error(&rv_errormsg, NULL, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
if (!result) {
FREE_ZVAL(rv_errormsg);

View File

@ -94,6 +94,7 @@ int dbx_odbc_query(zval ** rv, zval ** dbx_handle, zval ** sql_statement, INTERN
return 0;
}
MAKE_STD_ZVAL(num_fields_zval);
ZVAL_LONG(num_fields_zval, 0);
if (!dbx_odbc_getcolumncount(&num_fields_zval, &queryresult_zval, INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
FREE_ZVAL(num_fields_zval);
if (queryresult_zval) zval_ptr_dtor(&queryresult_zval);
@ -187,6 +188,7 @@ int dbx_odbc_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL
/*/ get # fields /*/
MAKE_STD_ZVAL(num_fields_zval);
ZVAL_LONG(num_fields_zval, 0);
if (!dbx_odbc_getcolumncount(&num_fields_zval, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
return 0;
}
@ -215,6 +217,7 @@ int dbx_odbc_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL
return 0;
}
MAKE_STD_ZVAL(field_index_zval);
ZVAL_LONG(field_index_zval, 0);
number_of_arguments=2;
for (field_index=0; field_index<field_count; ++field_index) {
ZVAL_LONG(field_index_zval, field_index+1);

View File

@ -40,6 +40,7 @@ int dbx_pgsql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zv
zval *returned_zval=NULL;
MAKE_STD_ZVAL(conn_zval);
ZVAL_LONG(conn_zval, 0);
if (Z_STRLEN_PP(username)>0 && Z_STRLEN_PP(password)>0){
int len;
@ -85,6 +86,7 @@ int dbx_pgsql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, z
zval *returned_zval=NULL;
MAKE_STD_ZVAL(conn_zval);
ZVAL_LONG(conn_zval, 0);
if (Z_STRLEN_PP(username)>0 && Z_STRLEN_PP(password)>0){
int len;