Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Jan 9, 2025

I have a follow-up PR that removes the FCI struct for fetch.cls.

pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch function specified");
return false;
}
fetch_function_param_num = stmt->column_count; /* probably less */
Copy link
Member

@kamil-tekiela kamil-tekiela Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this variable redundant now? You set it to 0 after the call and then use it as idx was before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the follow-up PR, I'm getting rid of idx as it only serves for a check with the SERIALIZE flag

ZVAL_COPY_VALUE(return_value, &retval);
}
}
zend_call_known_fcc(&stmt->fetch.func.fcc, return_value, fetch_function_param_num, fetch_function_params, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the difference is, so someone else will have to check if you're using this correctly. Maybe @nielsdos would like to take a look?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is just that we no longer store an fci, but that we construct it on the fly. This reduces the memory usage a bit overall.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder what happens if the callback returns a reference, but that would be a pre-existing problem I suppose...

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't spot any obvious mistakes, please see my comments

pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch function specified");
return false;
}
/* We can probably infer items than stmt->column_count for some cases */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't understand this sentence. Something gramatically makes this difficult for me to understand, I guess the "than" is out of place?

ZVAL_COPY_VALUE(return_value, &retval);
}
}
zend_call_known_fcc(&stmt->fetch.func.fcc, return_value, fetch_function_param_num, fetch_function_params, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is just that we no longer store an fci, but that we construct it on the fly. This reduces the memory usage a bit overall.

ZVAL_COPY_VALUE(return_value, &retval);
}
}
zend_call_known_fcc(&stmt->fetch.func.fcc, return_value, fetch_function_param_num, fetch_function_params, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder what happens if the callback returns a reference, but that would be a pre-existing problem I suppose...

@Girgias Girgias merged commit 8d79ed6 into php:master Jan 9, 2025
1 check passed
@Girgias Girgias deleted the pdo-function-no-fci branch January 9, 2025 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants