|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.262 2008/09/19 16:40:40 tgl Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.263 2008/09/19 20:06:13 tgl Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="libpq">
|
4 | 4 | <title><application>libpq</application> - C Library</title>
|
@@ -4592,17 +4592,58 @@ char *pg_encoding_to_char(int <replaceable>encoding_id</replaceable>);
|
4592 | 4592 | <parameter>conn</parameter> is not null and <parameter>status</>
|
4593 | 4593 | indicates an error, the current error message of the specified
|
4594 | 4594 | connection is copied into the <structname>PGresult</structname>.
|
4595 |
| - Also, if <parameter>conn</parameter> is not null, any event handlers |
| 4595 | + Also, if <parameter>conn</parameter> is not null, any event procedures |
4596 | 4596 | registered in the connection are copied into the
|
4597 |
| - <structname>PGresult</structname> (but they don't get |
4598 |
| - <literal>PGEVT_RESULTCREATE</> calls). |
| 4597 | + <structname>PGresult</structname>. (They do not get |
| 4598 | + <literal>PGEVT_RESULTCREATE</> calls, but see |
| 4599 | + <function>PQfireResultCreateEvents</function>.) |
4599 | 4600 | Note that <function>PQclear</function> should eventually be called
|
4600 | 4601 | on the object, just as with a <structname>PGresult</structname>
|
4601 | 4602 | returned by <application>libpq</application> itself.
|
4602 | 4603 | </para>
|
4603 | 4604 | </listitem>
|
4604 | 4605 | </varlistentry>
|
4605 | 4606 |
|
| 4607 | + <varlistentry> |
| 4608 | + <term> |
| 4609 | + <function>PQfireResultCreateEvents</function> |
| 4610 | + <indexterm> |
| 4611 | + <primary>PQfireResultCreateEvents</primary> |
| 4612 | + </indexterm> |
| 4613 | + </term> |
| 4614 | + <listitem> |
| 4615 | + <para> |
| 4616 | + Fires a <literal>PGEVT_RESULTCREATE</literal> event (see <xref |
| 4617 | + linkend="libpq-events">) for each event procedure registered in the |
| 4618 | + <structname>PGresult</structname> object. Returns non-zero for success, |
| 4619 | + zero if any event procedure fails. |
| 4620 | + |
| 4621 | + <synopsis> |
| 4622 | + int PQfireResultCreateEvents(PGconn *conn, PGresult *res); |
| 4623 | + </synopsis> |
| 4624 | + </para> |
| 4625 | + |
| 4626 | + <para> |
| 4627 | + The <literal>conn</> argument is passed through to event procedures |
| 4628 | + but not used directly. It can be <literal>NULL</> if the event |
| 4629 | + procedures won't use it. |
| 4630 | + </para> |
| 4631 | + |
| 4632 | + <para> |
| 4633 | + Event procedures that have already received a |
| 4634 | + <literal>PGEVT_RESULTCREATE</> or <literal>PGEVT_RESULTCOPY</> event |
| 4635 | + for this object are not fired again. |
| 4636 | + </para> |
| 4637 | + |
| 4638 | + <para> |
| 4639 | + The main reason that this function is separate from |
| 4640 | + <function>PQmakeEmptyPGResult</function> is that it is often appropriate |
| 4641 | + to create a <structname>PGresult</structname> and fill it with data |
| 4642 | + before invoking the event procedures. |
| 4643 | + </para> |
| 4644 | + </listitem> |
| 4645 | + </varlistentry> |
| 4646 | + |
4606 | 4647 | <varlistentry>
|
4607 | 4648 | <term>
|
4608 | 4649 | <function>PQcopyResult</function>
|
@@ -4904,7 +4945,7 @@ defaultNoticeProcessor(void *arg, const char *message)
|
4904 | 4945 | <synopsis>
|
4905 | 4946 | typedef struct
|
4906 | 4947 | {
|
4907 |
| - const PGconn *conn; |
| 4948 | + PGconn *conn; |
4908 | 4949 | } PGEventRegister;
|
4909 | 4950 | </synopsis>
|
4910 | 4951 |
|
@@ -4937,7 +4978,7 @@ typedef struct
|
4937 | 4978 | <synopsis>
|
4938 | 4979 | typedef struct
|
4939 | 4980 | {
|
4940 |
| - const PGconn *conn; |
| 4981 | + PGconn *conn; |
4941 | 4982 | } PGEventConnReset;
|
4942 | 4983 | </synopsis>
|
4943 | 4984 |
|
@@ -4967,7 +5008,7 @@ typedef struct
|
4967 | 5008 | <synopsis>
|
4968 | 5009 | typedef struct
|
4969 | 5010 | {
|
4970 |
| - const PGconn *conn; |
| 5011 | + PGconn *conn; |
4971 | 5012 | } PGEventConnDestroy;
|
4972 | 5013 | </synopsis>
|
4973 | 5014 |
|
@@ -4995,7 +5036,7 @@ typedef struct
|
4995 | 5036 | <synopsis>
|
4996 | 5037 | typedef struct
|
4997 | 5038 | {
|
4998 |
| - const PGconn *conn; |
| 5039 | + PGconn *conn; |
4999 | 5040 | PGresult *result;
|
5000 | 5041 | } PGEventResultCreate;
|
5001 | 5042 | </synopsis>
|
@@ -5063,7 +5104,7 @@ typedef struct
|
5063 | 5104 | <synopsis>
|
5064 | 5105 | typedef struct
|
5065 | 5106 | {
|
5066 |
| - const PGresult *result; |
| 5107 | + PGresult *result; |
5067 | 5108 | } PGEventResultDestroy;
|
5068 | 5109 | </synopsis>
|
5069 | 5110 |
|
|
0 commit comments