On Sun, 2003-03-23 at 18:26, Sander Roobol wrote: > On Sun, Mar 23, 2003 at 03:37:03PM +0100, Timm Friebe wrote: > > On Sun, 2003-03-23 at 11:48, Sander Roobol wrote: > > > If you supply a unified diff, I'll commit it. > > > > OK. Attached is a unified diff - the three new files which need to be > > added can be found at: > > I've applied your patch, but I didn't add those three files since they > already exist. Your files seem to have some improvements, so I suggest > you merge your changes into the current version. Please do so and send a > new unified diff.
After looking into it: * sybase-fetch-assoc.xml is OK the way it is * Added some examples to sybase-set-message-handler.xml * Corrected the statement "will fail" to "will produce a warning" and added an example to sybase-unbuffered-query.xml Unified diff is attached. HTH: Timm
Index: sybase-set-message-handler.xml =================================================================== RCS file: /repository/phpdoc/en/reference/sybase/functions/sybase-set-message-handler.xml,v retrieving revision 1.1 diff -u -r1.1 sybase-set-message-handler.xml --- sybase-set-message-handler.xml 8 Feb 2003 00:57:14 -0000 1.1 +++ sybase-set-message-handler.xml 26 Mar 2003 10:59:32 -0000 @@ -26,6 +26,55 @@ <para> &return.success; </para> + <example> + <title><function>sybase_set_message_handler</function> callback function</title> + <programlisting role="php"> +<![CDATA[ +<?php + function msg_handler($msgnumber, $severity, $state, $line, $text) { + var_dump($msgnumber, $severity, $state, $line, $text); + } + + sybase_set_message_handler('msg_handler'); +?> +]]> + </programlisting> + </example> + <example> + <title><function>sybase_set_message_handler</function> callback to a class</title> + <programlisting role="php"> +<![CDATA[ +<?php + class Sybase { + function handler($msgnumber, $severity, $state, $line, $text) { + var_dump($msgnumber, $severity, $state, $line, $text); + } + } + + $sybase= new Sybase(); + sybase_set_message_handler(array($sybase, 'handler')); +?> +]]> + </programlisting> + </example> + <example> + <title><function>sybase_set_message_handler</function> unhandled messages</title> + <programlisting role="php"> +<![CDATA[ +<?php + // Return FALSE from this function to indicate you can't handle + // this. The error is printed out as a warning, the way you're used + // to it if there is no handler installed. + function msg_handler($msgnumber, $severity, $state, $line, $text) { + if (257 == $msgnumber) return FALSE; + var_dump($msgnumber, $severity, $state, $line, $text); + } + + sybase_set_message_handler('msg_handler'); +?> +]]> + </programlisting> + </example> </refsect1> </refentry> Index: sybase-unbuffered-query.xml =================================================================== RCS file: /repository/phpdoc/en/reference/sybase/functions/sybase-unbuffered-query.xml,v retrieving revision 1.1 diff -u -r1.1 sybase-unbuffered-query.xml --- sybase-unbuffered-query.xml 8 Feb 2003 00:57:14 -0000 1.1 +++ sybase-unbuffered-query.xml 26 Mar 2003 10:59:32 -0000 @@ -36,13 +36,36 @@ of rows if all result sets have been read. To Sybase, the number of rows is not known and is therefore computed by the client implementation. </para> - <para> - It is not possible to fire up another query directly after starting an - unbuffered query and only if all rows have been read or the - remainding rows have been cancelled. This can be acheived by using - <function>sybase_free_result</function> on the return value of - <function>sybase_unbuffered_query</function>. + <note> + <para> If you do'nt read all of the resultsets prior to executing the next query, + PHP will raise a warning and cancel all of the pending results. To get rid of + this, use <function>sybase_free_result</function> which will cancel pending + results of an unbuffered query. + </para> + </note> + <para> The optional <parameter>store_result</parameter> can be FALSE to indicate + the resultsets should'nt be fetched into memory, thus minimizing memory usage + which is particularily interesting with very large resultsets. </para> + <example> + <title><function>sybase_unbuffered_query</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbh= sybase_connect('SYBASE', '', ''); + $q= sybase_unbuffered_query('select firstname, lastname from huge_table', $dbh, FALSE); + sybase_data_seek($q, 10000); + $i= 0; + while ($row= sybase_fetch_row($q)) { + echo $row[0].' '.$row[0]; + if ($i++ > 40000) break; + } + sybase_free_result($q); + sybase_close($dbh); +?> +]]> + </programlisting> + </example> </refsect1> </refentry>
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php