PG_AFFECTED_ROWS(3)PG_AFFECTED_ROWS(3)pg_affected_rows - Returns number of affected records (tuples)SYNOPSIS
int pg_affected_rows (resource $result)
DESCRIPTION pg_affected_rows(3) returns the number of tuples (instances/records/rows) affected by INSERT, UPDATE, and DELETE queries.
Since PostgreSQL 9.0 and above, the server returns the number of SELECTed rows. Older PostgreSQL return 0 for SELECT.
Note
This function used to be called pg_cmdtuples(3).
PARAMETERS
o $result
- PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
RETURN VALUES
The number of rows affected by the query. If no tuple is affected, it will return 0.
EXAMPLES
Example #1
pg_affected_rows(3) example
<?php
$result = pg_query($conn, "INSERT INTO authors VALUES ('Orwell', 2002, 'Animal Farm')");
$cmdtuples = pg_affected_rows($result);
echo $cmdtuples . " tuples are affected.
";
?>
The above example will output:
1 tuples are affected.
SEE ALSO pg_query(3), pg_query_params(3), pg_execute(3), pg_num_rows(3).
PHP Documentation Group PG_AFFECTED_ROWS(3)
Check Out this Related Man Page
PG_NUM_FIELDS(3)PG_NUM_FIELDS(3)pg_num_fields - Returns the number of fields in a resultSYNOPSIS
int pg_num_fields (resource $result)
DESCRIPTION pg_num_fields(3) returns the number of fields (columns) in a PostgreSQL result resource.
Note
This function used to be called pg_numfields(3).
PARAMETERS
o $result
- PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others).
RETURN VALUES
The number of fields (columns) in the result. On error, -1 is returned.
EXAMPLES
Example #1
pg_num_fields(3) example
<?php
$result = pg_query($conn, "SELECT 1, 2");
$num = pg_num_fields($result);
echo $num . " field(s) returned.
";
?>
The above example will output:
2 field(s) returned.
SEE ALSO pg_num_rows(3), pg_affected_rows(3).
PHP Documentation Group PG_NUM_FIELDS(3)
Hi.
I need to output a 4 queries result into another application using
result=`sqlplus -s ${3}/${4}@${2} << EOF
...
query1
query2
query3
query4
....
echo "$metrics1"
and returning those individual values into another app.
(query1 and 3compute one value, query 2 and 4 compute 4... (3 Replies)
isql output comes as below,
(0 rows affected)
(1 row affected)
(7 rows affected)
How to extract the resultset number alone from the particular line ??
such as
0
1
7 (3 Replies)
Hi,
Need to delete all the records prior to pattern (INSERT/UPDATE/DELETE). If ' is available, then need to retain it.
Input
======================
l_s := ' INSERT INTO TEST'
l_P PD := ' UPDATE INTO TEST'
l_D := ' DELETE INTO TEST'
This is test
Input
======================... (1 Reply)
Hi,
Need to delete all the records prior to pattern (INSERT/UPDATE/DELETE). If ' is available, then need to retain it.
Input
======================
l_s := ' INSERT INTO TEST'
l_P PD := ' UPDATE INTO TEST'
l_D := ' DELETE INTO TEST'
This is test
Output
======================... (1 Reply)