function _query($sql, $inputarr = false)
 {
     if (is_array($inputarr)) {
         $i = 0;
         if (is_array($sql)) {
             foreach ($inputarr as $v) {
                 $arr['bind' . $i++] = $v;
             }
         } else {
             // Need to identify if the ? is inside a quoted string, and if
             // so not use it as a bind variable
             preg_match_all('/".*\\??"|\'.*\\?.*?\'/', $sql, $matches);
             foreach ($matches[0] as $qmMatch) {
                 $qmReplace = str_replace('?', '-QUESTIONMARK-', $qmMatch);
                 $sql = str_replace($qmMatch, $qmReplace, $sql);
             }
             $sqlarr = explode('?', $sql);
             $sql = $sqlarr[0];
             foreach ($inputarr as $k => $v) {
                 $sql .= ":{$k}" . $sqlarr[++$i];
             }
             $sql = str_replace('-QUESTIONMARK-', '?', $sql);
         }
     }
     return ADODB_oci8::_query($sql, $inputarr);
 }
 function _query($sql, $inputarr = false)
 {
     if (is_array($inputarr)) {
         $i = 0;
         if (is_array($sql)) {
             foreach ($inputarr as $v) {
                 $arr['bind' . $i++] = $v;
             }
         } else {
             $sqlarr = explode('?', $sql);
             $sql = $sqlarr[0];
             foreach ($inputarr as $k => $v) {
                 $sql .= ":{$k}" . $sqlarr[++$i];
             }
         }
     }
     return ADODB_oci8::_query($sql, $inputarr);
 }
示例#3
0
 function _query($sql, $inputarr)
 {
     if (is_array($inputarr)) {
         $i = 0;
         $sqlarr = explode('?', $sql);
         $sql = $sqlarr[0];
         foreach ($inputarr as $v) {
             $name = 'bind' . $i++;
             $arr[$name] = $v;
             $sql .= ":{$name}" . $sqlarr[$i];
         }
         //print $sql;
         //print_r($arr);
     } else {
         $arr = false;
     }
     return ADODB_oci8::_query($sql, $arr);
 }
 function _query($sql, $inputarr)
 {
     if (is_array($inputarr)) {
         $i = 0;
         if (is_array($sql)) {
             foreach ($inputarr as $v) {
                 $arr['bind' . $i++] = $v;
             }
         } else {
             /* PSU mod.  DO NOT use ? syntax for bind variables...this breaks our world 
             			   and binding on question marks assumes ALL question marks are bind variables...
             			$sqlarr = explode('?',$sql);
             			$sql = $sqlarr[0];
             			foreach($inputarr as $k => $v) {
             				$sql .=  ":$k" . $sqlarr[++$i];
             			}
             			*/
         }
     }
     return ADODB_oci8::_query($sql, $inputarr);
 }
	function ExecuteCursor($sql,$cursorName='rs',$params=false)
	{
		if (is_array($sql)) $stmt = $sql;
		else $stmt = ADODB_oci8::Prepare($sql,true); # true to allocate OCINewCursor

		if (is_array($stmt) && sizeof($stmt) >= 5) {
			$hasref = true;
			$ignoreCur = false;
			$this->Parameter($stmt, $ignoreCur, $cursorName, false, -1, OCI_B_CURSOR);
			if ($params) {
				foreach($params as $k => $v) {
					$this->Parameter($stmt,$params[$k], $k);
				}
			}
		} else
			$hasref = false;

		$rs = $this->Execute($stmt);
		if ($rs) {
			if ($rs->databaseType == 'array') OCIFreeCursor($stmt[4]);
			elseif ($hasref) $rs->_refcursor = $stmt[4];
		}
		return $rs;
	}
 function &ExecuteCursor($sql, $cursorName = 'rs', $params = false)
 {
     $stmt = ADODB_oci8::Prepare($sql, true);
     # true to allocate OCINewCursor
     if (is_array($stmt) && sizeof($stmt) >= 5) {
         $this->Parameter($stmt, $ignoreCur, $cursorName, false, -1, OCI_B_CURSOR);
         if ($params) {
             foreach ($params as $k => $v) {
                 $this->Parameter($stmt, $params[$k], $k);
             }
         }
     }
     return $this->Execute($stmt);
 }
 function __construct()
 {
     parent::__construct();
 }
示例#8
0
 function &ExecuteCursor($sql, $cursorName = 'rs', $params = false)
 {
     $stmt = ADODB_oci8::Prepare($sql);
     if (is_array($stmt) && sizeof($stmt) >= 5) {
         $this->Parameter($stmt, $ignoreCur, $cursorName, false, -1, OCI_B_CURSOR);
         if ($params) {
             reset($params);
             while (list($k, $v) = each($params)) {
                 $this->Parameter($stmt, $params[$k], $k);
             }
         }
     }
     return $this->Execute($stmt);
 }
示例#9
0
 function &ExecuteServicior($sql, $serviciorName = 'rs', $params = false)
 {
     if (is_array($sql)) {
         $stmt = $sql;
     } else {
         $stmt = ADODB_oci8::Prepare($sql, true);
     }
     # true to allocate OCINewServicior
     if (is_array($stmt) && sizeof($stmt) >= 5) {
         $hasref = true;
         $this->Parameter($stmt, $ignoreCur, $serviciorName, false, -1, OCI_B_SERVICIOR);
         if ($params) {
             foreach ($params as $k => $v) {
                 $this->Parameter($stmt, $params[$k], $k);
             }
         }
     } else {
         $hasref = false;
     }
     $rs =& $this->Execute($stmt);
     if ($rs) {
         if ($rs->databaseType == 'array') {
             OCIFreeServicior($stmt[4]);
         } else {
             if ($hasref) {
                 $rs->_refservicior = $stmt[4];
             }
         }
     }
     return $rs;
 }
 function &ExecuteCursor($sql, $cursorName = 'rs')
 {
     $stmt = ADODB_oci8::Prepare($sql);
     if (is_array($stmt) && sizeof($stmt) >= 5) {
         $this->Parameter($stmt, $ignoreCur, $cursorName, false, -1, OCI_B_CURSOR);
     }
     return $this->Execute($stmt);
 }
示例#11
0
 /**
  * Usage:  store file pointed to by $var in a blob
  */
 function UpdateBlobFile($table, $column, $val, $where, $blobtype = 'BLOB')
 {
     switch (strtoupper($blobtype)) {
         default:
             print "<b>UpdateBlob</b>: Unknown blobtype={$blobtype}<br>";
             return false;
         case 'BLOB':
             $type = OCI_B_BLOB;
             break;
         case 'CLOB':
             $type = OCI_B_CLOB;
             break;
     }
     if ($this->databaseType == 'oci8po') {
         $sql = "UPDATE {$table} set {$column}=EMPTY_{$blobtype}() WHERE {$where} RETURNING {$column} INTO ?";
     } else {
         $sql = "UPDATE {$table} set {$column}=EMPTY_{$blobtype}() WHERE {$where} RETURNING {$column} INTO :blob";
     }
     $desc = OCINewDescriptor($this->_connectionID, OCI_D_LOB);
     $arr['blob'] = array($desc, -1, $type);
     $this->BeginTrans();
     $rs = ADODB_oci8::Execute($sql, $arr);
     $rez = !empty($rs);
     $desc->savefile($val);
     $desc->free();
     $this->CommitTrans();
     if ($rez) {
         $rs->Close();
     }
     return $rez;
 }