Christopher Kings-Lynne wrote:
> I'm trying to figure out what the parameters are, the docs seem to be
> way out of date...

> Specifically there appears to be a class name and class name length 
> parameter or something that isn't documented...

It's the best to read the sources. The proto is often in a comment
before the function definition but it's not always correct.
http://cvs.php.net/co.php/php-src/ext/pgsql/pgsql.c?r=1.322#2061 :
proto object pg_fetch_object(resource result [, int row [, string class_name [, 
NULL|array ctor_params]]])

This one is correct as you can confirm on the line 1879:
"r|zsz", &result, &zrow, &class_name, &class_name_len, &ctor_params
r means resource, | optional, z zval* (anything), s string, it's
explained at http://www.php.net/zend.arguments.retrieval .
In the next parameters, there will be stored values. Strings accept
two parameters - content and length as strings are 0-terminated in C.

I guess class_name is a class of the returned object. If not provided,
it will be stdClass.

History of parameters can be often read from CVS log, this one from
http://cvs.php.net/php-src/ext/pgsql/pgsql.c . Old result_type was
removed in revision 1.196, new parameters were added in 1.296. If you
want translate this to PHP version, you have to find the first newer
Tag - it's 4.3.0 for 1.196 and 5.0.0 for 1.296. Sometimes, changes are
backported to the old version, you can detect it by MFH (merge from
head) in the next commit, but this is not the case.

Hope that it helped you, it took me around a year to understand this
:-). Others may have another advices.

Jakub Vrana

Reply via email to