Hi,
I have a TEST.dat file. As a clean up process, I have to delete the TEST.dat file if it is empty. Basically, I don't want to delete TEST.dat if it contains anything in it but want to delete TEST.dat if it contains any spaces or nothing in it.
Is there a command to check if the file... (2 Replies)
hi
how can I determine, if a file is empty or not?I am using read line clause.
The script should be like:
while read line
do
if(file is empty) then;
......
done < $blacklist (1 Reply)
I have a program that takes a file in which I use a sed to remove some data that is not needed. If all of the data is removed. I want to grep for that in the file and print that there is no data left in the file. When I use sed, I replace a word with nothing but it still seems to leave a return... (5 Replies)
Hi All,
I have a piece of perl code in which I DON'T want to delete a file rather empty out the contents, here is the code -
if ( unlink("$opt_b") == 1 ) {
print_log( "$opt_b deleted", 1 );
}else {
print_log( "Could not delete $opt_b:$!", 1 );
... (5 Replies)
Hi there,
I'm just starting out with shell scripting and I'm trying to make a test where the script will basically run yum check-update to find out if the server has any available and if it does it e-mails me but if not it will just stop there.
I have it working if there are actually... (7 Replies)
when I run the following command in AIX (bash),
find ./*
I get the following error.
find: bad status-- ./*
Thats becasuse, its an empty directory. The same works, when there the directory is not empty. Even though the find deesnt have to rerun any result.
My full find command would look... (4 Replies)
Discussion started by: deepakwins
4 Replies
LEARN ABOUT PHP
pdo.errorinfo
PDO.ERRORINFO(3) 1 PDO.ERRORINFO(3)PDO ::errorInfo - Fetch extended error information associated with the last operation on the database handle
SYNOPSIS
public array PDO::errorInfo (void )
DESCRIPTION RETURN VALUES PDO.errorInfo(3) returns an array of error information about the last operation performed by this database handle. The array consists of
the following fields:
+--------+---------------------------------------------------+
|Element | |
| | |
| | Information |
| | |
+--------+---------------------------------------------------+
| 0 | |
| | |
| | SQLSTATE error code (a five characters alphanu- |
| | meric identifier defined in the ANSI SQL stan- |
| | dard). |
| | |
| 1 | |
| | |
| | Driver-specific error code. |
| | |
| 2 | |
| | |
| | Driver-specific error message. |
| | |
+--------+---------------------------------------------------+
Note
If the SQLSTATE error code is not set or there is no driver-specific error, the elements following element 0 will be set to NULL.
PDO.errorInfo(3) only retrieves error information for operations performed directly on the database handle. If you create a PDOStatement
object through PDO.prepare(3) or PDO.query(3) and invoke an error on the statement handle, PDO.errorInfo(3) will not reflect the error from
the statement handle. You must call PDOStatement.errorInfo(3) to return the error information for an operation performed on a particular
statement handle.
EXAMPLES
Example #1
Displaying errorInfo() fields for a PDO_ODBC connection to a DB2 database
<?php
/* Provoke an error -- bogus SQL syntax */
$stmt = $dbh->prepare('bogus sql');
if (!$stmt) {
echo "
PDO::errorInfo():
";
print_r($dbh->errorInfo());
}
?>
The above example will output:
PDO::errorInfo():
Array
(
[0] => HY000
[1] => 1
[2] => near "bogus": syntax error
)
SEE ALSO PDO.errorCode(3), PDOStatement.errorCode(3), PDOStatement.errorInfo(3).
PHP Documentation Group PDO.ERRORINFO(3)