本文整理汇总了PHP中oci_execute函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_execute函数的具体用法?PHP oci_execute怎么用?PHP oci_execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_execute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sql_query
function sql_query($sqltype, $query, $con)
{
if ($sqltype == 'mysql') {
if (class_exists('mysqli')) {
return $con->query($query);
} elseif (function_exists('mysql_query')) {
return mysql_query($query);
}
} elseif ($sqltype == 'mssql') {
if (function_exists('sqlsrv_query')) {
return sqlsrv_query($con, $query);
} elseif (function_exists('mssql_query')) {
return mssql_query($query);
}
} elseif ($sqltype == 'pgsql') {
return pg_query($query);
} elseif ($sqltype == 'oracle') {
return oci_execute(oci_parse($con, $query));
} elseif ($sqltype == 'sqlite3') {
return $con->query($query);
} elseif ($sqltype == 'sqlite') {
return sqlite_query($con, $query);
} elseif ($sqltype == 'odbc') {
return odbc_exec($con, $query);
} elseif ($sqltype == 'pdo') {
return $con->query($query);
}
}
示例2: readCursor
public function readCursor($storedProcedure, $binds)
{
//
// This function needs two parameters:
//
// $storedProcedure - the name of the stored procedure to call a chamar. Ex:
// my_schema.my_package.my_proc(:param)
//
// $binds - receives an array of associative arrays with: parameter names,
// values and sizes
//
// WARNING: The first parameter must be consistent with the second one
$conn = oci_connect('SECMAN', 'SECMAN', '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.10.24)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = cisqa)))');
if ($conn) {
// Create the statement and bind the variables (parameter, value, size)
$stid = oci_parse($conn, 'begin :cursor := ' . $storedProcedure . '; end;');
foreach ($binds as $variable) {
oci_bind_by_name($stid, $variable["parameter"], $variable["value"], $variable["size"]);
}
// Create the cursor and bind it
$p_cursor = oci_new_cursor($conn);
oci_bind_by_name($stid, ':cursor', $p_cursor, -1, OCI_B_CURSOR);
// Execute the Statement and fetch the data
oci_execute($stid);
oci_execute($p_cursor, OCI_DEFAULT);
oci_fetch_all($p_cursor, $data, null, null, OCI_FETCHSTATEMENT_BY_ROW);
// Return the data
return $data;
}
}
示例3: insertImage
function insertImage($conn, $photo_id, $owner_name, $descriptive_info, $thumbnail, $photo)
{
$photo_blob = oci_new_descriptor($conn, OCI_D_LOB);
$thumbnail_blob = oci_new_descriptor($conn, OCI_D_LOB);
$subject = $descriptive_info[0];
$place = $descriptive_info[1];
$date_time = $descriptive_info[2];
$description = $descriptive_info[3];
$permitted = $descriptive_info[4];
$sql = 'INSERT INTO images (photo_id, owner_name, permitted, subject, place,
timing, description, thumbnail, photo) VALUES (:photoid, :ownername,
:permitted, :subject, :place, TO_DATE(:datetime, \'MM/DD/YYYY\'), :description, empty_blob(),
empty_blob()) returning thumbnail, photo into :thumbnail, :photo';
$stid = oci_parse($conn, $sql);
oci_bind_by_name($stid, ':photoid', $photo_id);
oci_bind_by_name($stid, ':ownername', $owner_name);
oci_bind_by_name($stid, ':permitted', $permitted);
oci_bind_by_name($stid, ':subject', $subject);
oci_bind_by_name($stid, ':place', $place);
oci_bind_by_name($stid, ':datetime', $date_time);
oci_bind_by_name($stid, ':description', $description);
oci_bind_by_name($stid, ':thumbnail', $thumbnail_blob, -1, OCI_B_BLOB);
oci_bind_by_name($stid, ':photo', $photo_blob, -1, OCI_B_BLOB);
$res = oci_execute($stid, OCI_DEFAULT);
if ($thumbnail_blob->save($thumbnail) && $photo_blob->save($photo)) {
oci_commit($conn);
} else {
oci_rollback($conn);
}
oci_free_statement($stid);
$photo_blob->free();
$thumbnail_blob->free();
}
示例4: _execute
protected function _execute($sql)
{
$this->stmt_id = FALSE;
$this->_set_stmt_id($sql);
oci_set_prefetch($this->stmt_id, 1000);
return @oci_execute($this->stmt_id, $this->_commit);
}
示例5: get_list
function get_list($data)
{
$results = array();
$games = array();
$conn = oci_connect('malz', '1Qaz2wsx', '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=db1.chpc.ndsu.nodak.edu)(Port=1521)))(CONNECT_DATA=(SID=cs)))');
//Select customer with last name from field
$userQuery = 'select userName from Account where listId = :data';
$listQuery = 'select * from ListGame, Game where listId = :data and ListGame.gameId = Game.gameId';
$stid = oci_parse($conn, $userQuery);
$stid2 = oci_parse($conn, $listQuery);
oci_bind_by_name($stid, ':data', $data);
oci_bind_by_name($stid2, ':data', $data);
oci_execute($stid, OCI_DEFAULT);
//iterate through each row
while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
$results[] = $row;
}
oci_execute($stid2, OCI_DEFAULT);
while ($row = oci_fetch_array($stid2, OCI_ASSOC)) {
$games[] = $row;
}
$results[] = $games;
echo json_encode($results);
oci_free_statement($stid);
oci_free_statement($stid2);
oci_close($conn);
}
示例6: obtain_roadnet_xml_all
function obtain_roadnet_xml_all()
{
$sql = "select * from node_info";
$r = oci_parse($dbconn, $query);
oci_execute($r, OCI_DEFAULT);
return get_Roadnet_xml($r);
}
示例7: crearActividad
public function crearActividad($actividad)
{
session_start();
$sqltxt = "insert into s_actividad values(14,'" . $actividad->getNombre_actividad() . "','" . $actividad->getDescripcion() . "')";
$stid = oci_parse($_SESSION['sesion_logueado'], $sqltxt);
oci_execute($stid);
}
示例8: get_filteredGames
function get_filteredGames($data)
{
// The connection string is loooooooong. It's easiest to copy/paste this line. Remember to replace 'username' and 'password'!
$conn = oci_connect('malz', '1Qaz2wsx', '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=db1.chpc.ndsu.nodak.edu)(Port=1521)))(CONNECT_DATA=(SID=cs)))');
if ($data === 'all') {
$results = array();
$query = 'select * from Game';
$stid = oci_parse($conn, $query);
oci_bind_by_name($stid, ':data', $data);
oci_execute($stid);
//iterate through each row
while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
$results[] = $row;
}
echo json_encode($results);
oci_free_statement($stid);
oci_close($conn);
} else {
$results = array();
$data = $data . '%';
$query = 'select * from Game where gameName like :data';
$stid = oci_parse($conn, $query);
oci_bind_by_name($stid, ':data', $data);
oci_execute($stid);
//iterate through each row
while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
$results[] = $row;
}
echo json_encode($results);
oci_free_statement($stid);
oci_close($conn);
}
}
示例9: afficher_produit
function afficher_produit($is_fruit)
{
if ($is_fruit) {
$requete = "SELECT * FROM Produits WHERE `fruit`=1";
} else {
$requete = "SELECT * FROM Produits WHERE `fruit`=0";
}
$idcom = connex("Myparam");
$stmt = oci_parse($idcom, $requete);
$result = oci_execute($result, OCI_DEFAULT);
if (!$result) {
echo "Lecture impossible";
} else {
echo "<table cellspacing='0' cellpadding='5'>";
echo "<tr>";
echo "<th>Produit</th><th>Description</th><th>Stock</th><th>Prix</th><th>Quantité</th><th></th>";
echo "</tr>";
while ($ligne = oci_fetch_assoc($result)) {
echo "<tr id='" . $ligne[0] . "'>";
echo "<td>" . $ligne[1] . "</td>";
echo "<td>" . $ligne[2] . "</td>";
echo "<td>" . $ligne[3] . "</td>";
echo "<td>" . $ligne[4] . "</td>";
echo "<td><select name='qte_v[]'>";
for ($i = 1; $i <= $ligne[3]; $i++) {
echo "<option>" . $i . "</option>";
}
echo "</select></td>";
echo '<td><button onclick="addProduit($(this));" class=bouton_produit>Ajouter au panier</button></td>';
echo "</tr>";
}
echo "</table>";
}
}
示例10: cargarArray
function cargarArray($sentencia)
{
include dirname(__FILE__) . '/conectar_ORACLE.php';
$array = array();
$sentenciaExec = oci_parse($c, $sentencia);
oci_execute($sentenciaExec);
$error = 0;
$k = 0;
$ncols = oci_num_fields($sentenciaExec);
for ($i = 1; $i <= $ncols; ++$i) {
$colname = oci_field_name($sentenciaExec, $i);
$array[0][$k] = $colname;
$k++;
}
$cont = 0;
$j = 1;
$k = 0;
while ($row = oci_fetch_array($sentenciaExec, OCI_BOTH + OCI_RETURN_NULLS)) {
while ($cont < $ncols) {
$array[$j][$cont] = $row[$cont];
$cont++;
}
$cont = 0;
$k = 0;
$j++;
}
if (oci_num_rows($sentenciaExec) == 0) {
oci_free_statement($sentenciaExec);
return false;
} else {
oci_free_statement($sentenciaExec);
return $array;
}
}
示例11: asignarDiaSolicitud
public function asignarDiaSolicitud($iddia, $idsolicitud)
{
$dia = new DiaSolicitud();
$sqltxt = "insert into s_diasolicitud values(" . $idsolicitud . "," . $iddia . ")";
$stid = oci_parse($_SESSION['sesion_logueado'], $sqltxt);
oci_execute($stid);
}
示例12: dispCart
function dispCart()
{
$cartLen = count($_SESSION['cart']);
if ($cartLen < 1) {
echo 'You have no items in your cart.<br><a href="main.php">Keep shopping</a><br>';
die;
}
//for loop to iterate through cart items
for ($i = 0; $i < $cartLen; $i++) {
if ($cartLen > 0) {
$newconn = conndb();
//sql
$s = oci_parse($newconn, "select * from PRODUCT where PRODUCTID=:pid_prefix");
$plook = $_SESSION['cart'][$i]['productid'];
oci_bind_by_name($s, ':pid_prefix', $plook);
oci_execute($s);
//fetch a single row depending on product id
$res = oci_fetch_assoc($s);
echo "Product name: ", $res['PRODUCTNAME'], " Price: ", $res['PRODUCTPRICE'];
echo '<a href="cart.php?del=' . $i . '"> Remove item</a><br>';
}
}
if ($cartLen > 0) {
echo '<a href="checkout.php">Proceed to checkout</a><br>';
}
}
示例13: consultar
public function consultar()
{
//$prub = Conexion::getInstancia("system", "admin");
//$p=new Persona();
$persina = new PersonaDAO();
$aa = new ConexionDB("apoyo_alimentario", "apoyo_alimentario");
if ($aa->conectarDB()) {
$sesion = $aa->getConn();
$facultades = array();
$i = 0;
$sqltxt = "select * from facultad";
$stid = oci_parse($sesion, $sqltxt);
oci_execute($stid);
while (oci_fetch($stid)) {
$facultad = new Facultad();
$facultad->setIdfacultad(oci_result($stid, 'ID_FACULTAD'));
$facultad->setNombre_facultad(oci_result($stid, 'NOMBRE_FACULTAD'));
$facultades[$i] = $facultad;
$i += 1;
}
return $facultades;
//oci_parse($a, $sql_text);
//echo $a;
}
}
示例14: getUserObjectData
public function getUserObjectData()
{
$sql = "SELECT object_name, object_type, TO_CHAR(created, 'DD/MM/YYYY') AS created, TO_CHAR(last_ddl_time, 'DD/MM/YYYY') AS last_ddl_time, status FROM user_objects WHERE object_name = UPPER(:v_obj_name) AND object_type = UPPER(:v_obj_type)";
$stmt = oci_parse($this->getConnection(), $sql);
oci_bind_by_name($stmt, ":v_obj_name", $this->objectName);
oci_bind_by_name($stmt, ":v_obj_type", $this->objectType);
if (!@oci_execute($stmt)) {
$e = oci_error($stmt);
$this->setMensaje("Error al obtener los datos del objeto '{$this->objectName}' de la tabla user_objects - {$e['message']}");
return false;
}
$row = @oci_fetch_array($stmt, OCI_ASSOC | OCI_RETURN_NULLS);
if (empty($row)) {
$this->setMensaje("No se pudo encontrar el objeto '{$this->objectName}' en la tabla user_objects");
return false;
}
$this->fechaCreacion = $row['CREATED'];
$this->fechaModificacion = $row['LAST_DDL_TIME'];
$this->oracleStatus = $row['STATUS'];
if ($this->oracleStatus != 'VALID') {
$this->setMensaje("El objeto '{$this->objectName}' tiene el estado '{$this->oracleStatus}' en la tabla user_objects");
return false;
}
return true;
}
示例15: execute
public function execute($mode = OCI_COMMIT_ON_SUCCESS)
{
set_error_handler(static::getErrorHandler());
$isSuccess = oci_execute($this->resource, $mode);
restore_error_handler();
return $isSuccess;
}