9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am looking for a shell script which serves the below purpose.
Please find below the algorithm for the same and any help on this would be highly appreciated.
1)set of strings need to be replaced among set of files(directory may contain different types of files)
2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies
2. Shell Programming and Scripting
Hi All,
I need to write one shell script. The requirement is as follows.
a) I am having list the employee names in a file stored in /tmp directory location as below
/tmp/emp.txt
b) and the contents are as below
cat emp.txt
ravi
raj
ram
arun
c) I need to connect to sybase... (1 Reply)
Discussion started by: Gowtham_giri
1 Replies
3. Shell Programming and Scripting
Hi all,
I want to use a variable inside my sql query and below is my script:
#!/bin/ksh
export b="abcd"
a=`sqlplus -s abc/def@ghi <<++
set heading off;
set feedback off;
select xxx from mytable where clmn_nm='$b';
exit;
++`
echo $a
But the output i get is below:
$>... (4 Replies)
Discussion started by: Jayaraman
4 Replies
4. Shell Programming and Scripting
ok, so I have a shell script that can be called using the first argument ($1) or not. This argument is a word (Tim for example) and not an actual flag (-x for example). If I call the script with an argument and call the same script without one, it believes that I provided an argument. Note here... (2 Replies)
Discussion started by: mrwatkin
2 Replies
5. Shell Programming and Scripting
hey guys,
I am trying to get some statistics from a DHCP server, like counting the number of DHCP Discovers from a specific MAC address. The script should count the number of DHCP Discovers and output it, otherwise if it cannot find any , it should output the MAC address and "0".
The first... (10 Replies)
Discussion started by: liviusbr
10 Replies
6. Shell Programming and Scripting
Hello,
I want to checkl whether my file has text in it or not.
if ; then
...
if ; then
...
But none of these work
Can someone help me?
---------- Post updated at 09:00 AM ---------- Previous update was at 08:55 AM ----------
The code-tags caused an displayerror,... (5 Replies)
Discussion started by: ABE2202
5 Replies
7. Shell Programming and Scripting
Hi,
Can anyone help me on how to set PATH using shell scripting..
Please find the shell script code here....
#!/bin/bash
PATH = $PATH:/opt/app/oracle/product/10.2.0/bin
export PATH
echo $PATH
exit
When i execute this script i get the following error
./backup.sh: line 2: PATH:... (0 Replies)
Discussion started by: srinivasj
0 Replies
8. Shell Programming and Scripting
I am running on AIX 5.3. I have a remote AIX server running on a generator. Many times the generator goes out and I only have a window of 15 mins with the network up and 30 mins the server is powered. I need help creating a script using ifconfig, where it goes out and checks the network every 5... (2 Replies)
Discussion started by: AIX25
2 Replies
9. Shell Programming and Scripting
Hi All
How can I set password in linux.It is OK if it display password in plain text in script.
manually i can set:
#passwd
Changing password for root
Enter new password:
Bad password: too weak.
Re-enter new password:
Password changed.
#
I want this to be done by script.Please let me... (2 Replies)
Discussion started by: tannu
2 Replies
MYSQL_AFFECTED_ROWS(3) 1 MYSQL_AFFECTED_ROWS(3)
mysql_affected_rows - Get number of affected rows in previous MySQL operation
SYNOPSIS
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should
be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
omysqli_affected_rows(3)
o PDOStatement::rowCount
int mysql_affected_rows ([resource $link_identifier = NULL])
DESCRIPTION
Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE query associated with $link_identifier.
o $
link_identifier -The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect(3) is
assumed. If no such link is found, it will try to create one as if mysql_connect(3) was called with no arguments. If no connection
is found or established, an E_WARNING level error is generated.
Returns the number of affected rows on success, and -1 if the last query failed.
If the last query was a DELETE query with no WHERE clause, all of the records will have been deleted from the table but this function will
return zero with MySQL versions prior to 4.1.2.
When using UPDATE, MySQL will not update columns where the new value is the same as the old value. This creates the possibility that
mysql_affected_rows(3) may not actually equal the number of rows matched, only the number of rows that were literally affected by the
query.
The REPLACE statement first deletes the record with the same primary key and then inserts the new record. This function returns the number
of deleted records plus the number of inserted records.
In the case of "INSERT ... ON DUPLICATE KEY UPDATE" queries, the return value will be 1 if an insert was performed, or 2 for an update of
an existing row.
Example #1
mysql_affected_rows(3) example
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');
/* this should return the correct numbers of deleted records */
mysql_query('DELETE FROM mytable WHERE id < 10');
printf("Records deleted: %d
", mysql_affected_rows());
/* with a where clause that is never true, it should return 0 */
mysql_query('DELETE FROM mytable WHERE 0');
printf("Records deleted: %d
", mysql_affected_rows());
?>
The above example will output something similar to:
Records deleted: 10
Records deleted: 0
Example #2
mysql_affected_rows(3) example using transactions
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');
/* Update records */
mysql_query("UPDATE mytable SET used=1 WHERE id < 10");
printf ("Updated records: %d
", mysql_affected_rows());
mysql_query("COMMIT");
?>
The above example will output something similar to:
Updated Records: 10
Note
Transactions
If you are using transactions, you need to call mysql_affected_rows(3) after your INSERT, UPDATE, or DELETE query, not after the
COMMIT.
Note
SELECT Statements
To retrieve the number of rows returned by a SELECT, it is possible to use mysql_num_rows(3).
Note
Cascaded Foreign Keys
mysql_affected_rows(3) does not count rows affected implicitly through the use of ON DELETE CASCADE and/or ON UPDATE CASCADE in for-
eign key constraints.
mysql_num_rows(3), mysql_info(3).
PHP Documentation Group MYSQL_AFFECTED_ROWS(3)