Good evening, i need your help please
I will try to describe the scenario briefly: In a Telecom Production system application receives a certain files called CDRs(call detail records) to be processed by doing some operating systems operations and then database operations like creating indexes... (4 Replies)
Gents,
I did the below code to get an output (report) ,.. the code works fine but I believe it can be more shorted using better method.
Please if you can help, to generate same output improving the code , will be great.
here my code.
# get diff in time
awk '{$9=$8-prev8;prev8=$8;print... (8 Replies)
Thank you for taking the time to look at this and provide input.
To start, I am not a linux/unix expert but I muddle through the best I can.
I am also in no way shape or form a programmer. Please keep that in mind as you read this script.
This script is designed to find all files in a given... (8 Replies)
I'm obviously very new to this. I'm trying to write a simple for loop that will read the directory names in /Users and then copy a file into the same subdir in each user directory.
I have this, and it works but it isn't great.
#!/bin/bash
HOMEDIRS=/Users/*
for dirs in $HOMEDIRS; do
if ];... (5 Replies)
Hi guys, I use this function which was provided to me by someone at this site. It works perfectly for validating a users input option against allowed options..
example:
validateInput "1" "1 3 4 5" would return 0 (success)
function validateInput {
input=$1
allowedInput=$2
for... (4 Replies)
I found a way to make a numeric variable persistent for a script :
#!/bin/bash
function Persist() { # 1:Expression like VARIABLE=Value (numeric)
local V=${1%=*}
eval "$1"
sed -i "s/^$V=*/$1/" $(which $(basename $0)) || return 1
}And how to use itAA=12
read -p "Enter a... (2 Replies)
Hi;
I want to access our customer database to retreive all clients that have as language index 2 or 3 and take their client number.
My input is a file containing all client numbers.
i access the data base using a function call "scpshow". The total number of clients i want to scan is 400 000... (6 Replies)
OCI_CLOSE(3)OCI_CLOSE(3)oci_close - Closes an Oracle connectionSYNOPSIS
bool oci_close (resource $connection)
DESCRIPTION
Unsets $connection. The underlying database connection is closed if no other resources are using it and if it was created with oci_con-
nect(3) or oci_new_connect(3).
It is recommended to close connections that are no longer needed because this makes database resources available for other users.
PARAMETERS
o $connection
- An Oracle connection identifier returned by oci_connect(3), oci_pconnect(3), or oci_new_connect(3).
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Closing a connection
Resources associated with a connection should be closed to ensure the underlying database connection is properly terminated and the
database resources are released.
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT * FROM departments');
$r = oci_execute($stid);
oci_fetch_all($stid, $res);
var_dump($res);
// Free the statement identifier when closing the connection
oci_free_statement($stid);
oci_close($conn);
?>
Example #2
Database connections are not closed until all references are closed
The internal refcount of a connection identifier must be zero before the underlying connection to the database is closed.
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT * FROM departments'); // this increases the refcount on $conn
oci_execute($stid);
oci_fetch_all($stid, $res);
var_dump($res);
oci_close($conn);
// $conn is no longer usable in the script but the underlying database
// connection is still held open until $stid is freed.
var_dump($conn); // prints NULL
// While PHP sleeps, querying the Oracle V$SESSION view in a
// terminal window will show that the database user is still connected.
sleep(10);
// When $stid is freed, the database connection is physically closed
oci_free_statement($stid);
// While PHP sleeps, querying the Oracle V$SESSION view in a
// terminal window will show that the database user has disconnected.
sleep(10);
?>
Example #3
Closing a connection opened more than once
When database credentials are reused, both connections must be closed before the underlying database connection is closed.
<?php
$conn1 = oci_connect('hr', 'welcome', 'localhost/XE');
// Using the same credentials reuses the same underlying database connection
// Any uncommitted changes done on $conn1 will be visible in $conn2
$conn2 = oci_connect('hr', 'welcome', 'localhost/XE');
// While PHP sleeps, querying the Oracle V$SESSION view in a
// terminal window will show that only one database user is connected.
sleep(10);
oci_close($conn1); // doesn't close the underlying database connection
var_dump($conn1); // prints NULL because the variable $conn1 is no longer usable
var_dump($conn2); // displays that $conn2 is still a valid connection resource
?>
Example #4
Connections are closed when variables go out of scope
When all variables referencing a connection go out of scope and are freed by PHP, a rollback occurs (if necessary) and the underly-
ing connection to the database is closed.
<?php
function myfunc() {
$conn = oci_connect('hr', 'hrpwd', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'UPDATE mytab SET id = 100');
oci_execute($stid, OCI_NO_AUTO_COMMIT);
return "Finished";
}
$r = myfunc();
// At this point a rollback occurred and the underlying database connection was released.
print $r; // displays the function return value "Finished"
?>
NOTES
Note
Variables that have a dependency on the connection identifier, such as statement identifiers returned by oci_parse(3), must also be
freed before the underlying database connection is closed.
Note
Prior to version PHP 5.1.2 (PECL OCI8 1.1) oci_close(3) was a no-op. In more recent versions it correctly closes the Oracle connec-
tion. Use oci8.old_oci_close_semantics option to restore old behavior of this function.
Note
The oci_close(3) function does not close the underlying database connections created with oci_pconnect(3).
SEE ALSO oci_connect(3), oci_free_statement(3).
PHP Documentation Group OCI_CLOSE(3)