PG_GET_RESULT(3)PG_GET_RESULT(3)pg_get_result - Get asynchronous query resultSYNOPSIS
resource pg_get_result ([resource $connection])
DESCRIPTION pg_get_result(3) gets the result resource from an asynchronous query executed by pg_send_query(3), pg_send_query_params(3) or pg_send_exe-
cute(3).
pg_send_query(3) and the other asynchronous query functions can send multiple queries to a PostgreSQL server and pg_get_result(3) is used
to get each query's results, one by one.
PARAMETERS
o $connection
- PostgreSQL database connection resource.
RETURN VALUES
The result resource, or FALSE if no more results are available.
EXAMPLES
Example #1
pg_get_result(3) example
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
}
$res1 = pg_get_result($dbconn);
echo "First call to pg_get_result(): $res1
";
$rows1 = pg_num_rows($res1);
echo "$res1 has $rows1 records
";
$res2 = pg_get_result($dbconn);
echo "Second call to pg_get_result(): $res2
";
$rows2 = pg_num_rows($res2);
echo "$res2 has $rows2 records
";
?>
The above example will output:
First call to pg_get_result(): Resource id #3
Resource id #3 has 3 records
Second call to pg_get_result(): Resource id #4
Resource id #4 has 1 records
SEE ALSO pg_send_query(3).
PHP Documentation Group PG_GET_RESULT(3)
Check Out this Related Man Page
PG_CANCEL_QUERY(3)PG_CANCEL_QUERY(3)pg_cancel_query - Cancel an asynchronous querySYNOPSIS
bool pg_cancel_query (resource $connection)
DESCRIPTION pg_cancel_query(3) cancels an asynchronous query sent with pg_send_query(3), pg_send_query_params(3) or pg_send_execute(3). You cannot can-
cel a query executed using pg_query(3).
PARAMETERS
o $connection
- PostgreSQL database connection resource.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
pg_cancel_query(3) example
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
}
$res1 = pg_get_result($dbconn);
echo "First call to pg_get_result(): $res1
";
$rows1 = pg_num_rows($res1);
echo "$res1 has $rows1 records
";
// Cancel the currently running query. Will be the second query if it is
// still running.
pg_cancel_query($dbconn);
?>
The above example will output:
First call to pg_get_result(): Resource id #3
Resource id #3 has 3 records
SEE ALSO pg_send_query(3), pg_connection_busy(3).
PHP Documentation Group PG_CANCEL_QUERY(3)
What I am trying to do is check if the database query returned any records.
If no records returned then output a message else output results to a file.
Right now if I take out the if and else statements the code runs fine and sends the email. If no records returned the email sends the column... (4 Replies)
below is the sample pro*c code.
i could print ParmKeyValue as ORG_PATH
and CountryCode as HK, but the below query returns 0 records,
but when i hard code the value, it records records
SELECT nvl(rtrim(value), ' ')
-- INTO :OrgFilepath
... (1 Reply)
Hi all,
I have a requirement where I need to read records one by one from a file. I have tried this below code:
while read mLine
do
echo 'Line = '${mLine}
done < input_file
--- But the problem here is im getting the records with removed spaces.
--Supposer if the record is like... (3 Replies)
Hi there, I have a table that stores multiple records for many different servers, each of which is timestamped ... I wanted to write a query that would enable me to only output the "latest" record (based on timestamp) for each "unique" server. So for example my main table looks like this
... (3 Replies)
Hi,
I have a requirement to monitor the HACMP Resource Groups. At present in my environment, if the Resource Groups fail over from preferred node to Secondary node we dont get notification.
Can some one help me in creating a scrript. I have more than one RG online. (Max 4 Resource Groups in... (2 Replies)
Hello:
I am new to shell script programming. Now I would like to select specific records block from a file. For example, current file "xyz.txt" is containing 1million records and want to select the block of records from line number 50000 to 100000 and save into a file. Can anyone suggest me how... (3 Replies)
Hi all
Thanks in advance...........
Please help me for this issue............
I have a file it has 11 records . I used the command like ....
>$ wc -l file
11 file
I'm getting output like 11 file (no.of records along with filename)
here my requirement is, I want to display only... (3 Replies)
Greetings,
Let's say I want to find files matching "*.out" in the current dir. I can do a echo *.out. However, the result is separated by a white space. Is there a way to have the results separated by a new line instead?
I know this can be done by using find -maxdepth 1 -name '*.out'. The... (5 Replies)
I need to connect a databas eusing sqlplus and i need to store the results of each query in separate file.
is it possible to achieve this usng single sqlplus?
i dont want to connect each time for each query.
thanks (3 Replies)
Hi All,
I have records in a file with name,SSO,openitems,manageremail with | delimited file.Now i want to group the records by SSO and openitems and send email to their manageremail.
kiran|1111|draft|aaa@gmail.com
guna|2222|reject|bbb@gmail.com
kiran|1111|submitter|aaa@gmail.com... (2 Replies)
In HA platforms, there is the concept of a "Scalable Resource Type, which included the sharedaddress" that is used in commonly Web Servers resource groups. The sharedaddress resource type is provided so a developer can use this Resource type to build their own scalable resource group. I see... (1 Reply)