Skip to content

[PHP 8.4] Add manual for pg_result_memory_size() #3972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions reference/pgsql/functions/pg-free-result.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ First field in the second row is: 2
<member><function>pg_query</function></member>
<member><function>pg_query_params</function></member>
<member><function>pg_execute</function></member>
<member><function>pg_result_memory_size</function></member>
</simplelist>
</para>
</refsect1>
Expand Down
98 changes: 98 additions & 0 deletions reference/pgsql/functions/pg-result-memory-size.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.pg-result-memory-size" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_result_memory_size</refname>
<refpurpose>Returns the amount of memory allocated for a query result</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>pg_result_memory_size</methodname>
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<simpara>
Returns the amount of memory, in bytes, allocated to the specified query result
<classname>PgSql\Result</classname> instance.
This value is the same amount that would be freed by <function>pg_free_result</function>.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
&pgsql.parameter.result;
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns the memory amount in bytes.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>pg_result_memory_size</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$db = pg_connect("dbname=users user=me");

$res = pg_query($db, 'SELECT 1');

$size = pg_result_memory_size($res);

var_dump($size);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
int(3288)
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_free_result</function></member>
</simplelist>
</para>
</refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
1 change: 1 addition & 0 deletions reference/pgsql/versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<function name="pg_query_params" from="PHP 5 &gt;= 5.1.0, PHP 7, PHP 8"/>
<function name="pg_result_error" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
<function name="pg_result_error_field" from="PHP 5 &gt;= 5.1.0, PHP 7, PHP 8"/>
<function name="pg_result_memory_size" from="PHP 8 &gt;= 8.4.0"/>
<function name="pg_result_seek" from="PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8"/>
<function name="pg_result_status" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
<function name="pg_select" from="PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8"/>
Expand Down