当前位置: 首页>>代码示例>>PHP>>正文


PHP OCIStatementType函数代码示例

本文整理汇总了PHP中OCIStatementType函数的典型用法代码示例。如果您正苦于以下问题:PHP OCIStatementType函数的具体用法?PHP OCIStatementType怎么用?PHP OCIStatementType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OCIStatementType函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _query

	function _query($sql,$inputarr)
	{
		if (is_array($sql)) { // is prepared sql
			$stmt = $sql[1];

			// we try to bind to permanent array, so that OCIBindByName is persistent
			// and carried out once only - note that max array element size is 4000 chars
			if (is_array($inputarr)) {
				$bindpos = $sql[3];
				if (isset($this->_bind[$bindpos])) {
				// all tied up already
					$bindarr = $this->_bind[$bindpos];
				} else {
				// one statement to bind them all
					$bindarr = array();
					foreach($inputarr as $k => $v) {
						$bindarr[$k] = $v;
						OCIBindByName($stmt,":$k",$bindarr[$k],is_string($v) && strlen($v)>4000 ? -1 : 4000);
					}
					$this->_bind[$bindpos] = $bindarr;
				}
			}
		} else {
			$stmt=OCIParse($this->_connectionID,$sql);
		}

		$this->_stmt = $stmt;
		if (!$stmt) return false;

		if (defined('ADODB_PREFETCH_ROWS')) @OCISetPrefetch($stmt,ADODB_PREFETCH_ROWS);

		if (is_array($inputarr)) {
			foreach($inputarr as $k => $v) {
				if (is_array($v)) {
					if (sizeof($v) == 2) // suggested by g.giunta@libero.
						OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]);
					else
						OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);

					if ($this->debug==99) {
						if (is_object($v[0]))
							echo "name=:$k",' len='.$v[1],' type='.$v[2],'<br>';
						else
							echo "name=:$k",' var='.$inputarr[$k][0],' len='.$v[1],' type='.$v[2],'<br>';

					}
				} else {
					$len = -1;
					if ($v === ' ') $len = 1;
					if (isset($bindarr)) {	// is prepared sql, so no need to ocibindbyname again
						$bindarr[$k] = $v;
					} else { 				// dynamic sql, so rebind every time
						OCIBindByName($stmt,":$k",$inputarr[$k],$len);
					}
				}
			}
		}

        $this->_errorMsg = false;
		$this->_errorCode = false;
		if (OCIExecute($stmt,$this->_commit)) {
//OCIInternalDebug(1);
			if (count($this -> _refLOBs) > 0) {

				foreach ($this -> _refLOBs as $key => $value) {
					if ($this -> _refLOBs[$key]['TYPE'] == true) {
						$tmp = $this -> _refLOBs[$key]['LOB'] -> load();
						if ($this -> debug) {
							ADOConnection::outp("<b>OUT LOB</b>: LOB has been loaded. <br>");
						}
						//$_GLOBALS[$this -> _refLOBs[$key]['VAR']] = $tmp;
						$this -> _refLOBs[$key]['VAR'] = $tmp;
					} else {
                        $this->_refLOBs[$key]['LOB']->save($this->_refLOBs[$key]['VAR']);
						$this -> _refLOBs[$key]['LOB']->free();
						unset($this -> _refLOBs[$key]);
                        if ($this->debug) {
							ADOConnection::outp("<b>IN LOB</b>: LOB has been saved. <br>");
						}
                    }
				}
			}

            switch (@OCIStatementType($stmt)) {
                case "SELECT":
					return $stmt;

				case 'DECLARE':
                case "BEGIN":
                    if (is_array($sql) && !empty($sql[4])) {
						$cursor = $sql[4];
						if (is_resource($cursor)) {
							$ok = OCIExecute($cursor);
	                        return $cursor;
						}
						return $stmt;
                    } else {
						if (is_resource($stmt)) {
							OCIFreeStatement($stmt);
							return true;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:101,代码来源:adodb-oci8.old.inc.php

示例2: _query

 function _query($sql, $inputarr)
 {
     if (is_array($sql)) {
         // is prepared sql
         $stmt = $sql[1];
         // we try to bind to permanent array, so that OCIBindByName is persistent
         // and carried out once only - note that max array element size is 4000 chars
         if (is_array($inputarr)) {
             $bindpos = $sql[3];
             if (isset($this->_bind[$bindpos])) {
                 // all tied up already
                 $bindarr =& $this->_bind[$bindpos];
             } else {
                 // one statement to bind them all
                 $bindarr = array();
                 foreach ($inputarr as $k => $v) {
                     $bindarr[$k] = $v;
                     OCIBindByName($stmt, ":{$k}", $bindarr[$k], 4000);
                 }
                 $this->_bind[$bindpos] =& $bindarr;
             }
         }
     } else {
         $stmt = OCIParse($this->_connectionID, $sql);
     }
     $this->_stmt = $stmt;
     if (!$stmt) {
         return false;
     }
     if (defined('ADODB_PREFETCH_ROWS')) {
         @OCISetPrefetch($stmt, ADODB_PREFETCH_ROWS);
     }
     if (is_array($inputarr)) {
         foreach ($inputarr as $k => $v) {
             if (is_array($v)) {
                 if (sizeof($v) == 2) {
                     // suggested by g.giunta@libero.
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1]);
                 } else {
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1], $v[2]);
                 }
                 if ($this->debug == 99) {
                     echo "name=:{$k}", ' var=' . $inputarr[$k][0], ' len=' . $v[1], ' type=' . $v[2], '<br>';
                 }
             } else {
                 $len = -1;
                 if ($v === ' ') {
                     $len = 1;
                 }
                 if (isset($bindarr)) {
                     // is prepared sql, so no need to ocibindbyname again
                     $bindarr[$k] = $v;
                 } else {
                     // dynamic sql, so rebind every time
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k], $len);
                 }
             }
         }
     }
     $this->_errorMsg = false;
     $this->_errorCode = false;
     if (OCIExecute($stmt, $this->_commit)) {
         switch (@OCIStatementType($stmt)) {
             case "SELECT":
                 return $stmt;
             case "BEGIN":
                 if (is_array($sql) && !empty($sql[4])) {
                     $cursor = $sql[4];
                     if (is_resource($cursor)) {
                         $ok = OCIExecute($cursor);
                         return $cursor;
                     }
                     return $stmt;
                 } else {
                     if (is_resource($stmt)) {
                         OCIFreeStatement($stmt);
                         return true;
                     }
                     return $stmt;
                 }
                 break;
             default:
                 // ociclose -- no because it could be used in a LOB?
                 return true;
         }
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:facturaphp-svn,代码行数:88,代码来源:adodb-oci8.inc.php

示例3: _doQuery


//.........这里部分代码省略.........
     }
     if (!MDB::isError($success)) {
         if ($statement = @OCIParse($this->connection, $query)) {
             if ($lobs) {
                 for (reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, next($this->clobs[$prepared_query])) {
                     $position = key($this->clobs[$prepared_query]);
                     if (!@OCIBindByName($statement, ':clob' . $position, $descriptors[$position], -1, OCI_B_CLOB)) {
                         $success = $this->oci8RaiseError(NULL, 'Do query: Could not bind clob upload descriptor');
                         break;
                     }
                 }
                 if (!MDB::isError($success)) {
                     for (reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, next($this->blobs[$prepared_query])) {
                         $position = key($this->blobs[$prepared_query]);
                         if (!@OCIBindByName($statement, ':blob' . $position, $descriptors[$position], -1, OCI_B_BLOB)) {
                             $success = $this->oci8RaiseError(NULL, 'Do query: Could not bind blob upload descriptor');
                             break;
                         }
                     }
                 }
             }
             if (!MDB::isError($success)) {
                 if ($result = @OCIExecute($statement, $lobs == 0 && $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
                     if ($lobs) {
                         for (reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, next($this->clobs[$prepared_query])) {
                             $position = key($this->clobs[$prepared_query]);
                             $clob_stream = $this->prepared_queries[$prepared_query - 1]['Values'][$position - 1];
                             for ($value = ''; !$this->endOfLOB($clob_stream);) {
                                 if ($this->readLOB($clob_stream, $data, $this->getOption('lob_buffer_length')) < 0) {
                                     $success = $this->raiseError();
                                     break;
                                 }
                                 $value .= $data;
                             }
                             if (!MDB::isError($success) && !$descriptors[$position]->save($value)) {
                                 $success = $this->oci8RaiseError(NULL, 'Do query: Could not upload clob data');
                             }
                         }
                         if (!MDB::isError($success)) {
                             for (reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, next($this->blobs[$prepared_query])) {
                                 $position = key($this->blobs[$prepared_query]);
                                 $blob_stream = $this->prepared_queries[$prepared_query - 1]['Values'][$position - 1];
                                 for ($value = ''; !$this->endOfLOB($blob_stream);) {
                                     if ($this->readLOB($blob_stream, $data, $this->getOption('lob_buffer_length')) < 0) {
                                         $success = $this->raiseError();
                                         break;
                                     }
                                     $value .= $data;
                                 }
                                 if (!MDB::isError($success) && !$descriptors[$position]->save($value)) {
                                     $success = $this->oci8RaiseError(NULL, 'Do query: Could not upload blob data');
                                 }
                             }
                         }
                     }
                     if ($this->auto_commit) {
                         if ($lobs) {
                             if (MDB::isError($success)) {
                                 if (!@OCIRollback($this->connection)) {
                                     $success = $this->oci8RaiseError(NULL, 'Do query: ' . $success->getUserinfo() . ' and then could not rollback LOB updating transaction');
                                 }
                             } else {
                                 if (!@OCICommit($this->connection)) {
                                     $success = $this->oci8RaiseError(NULL, 'Do query: Could not commit pending LOB updating transaction');
                                 }
                             }
                         }
                     } else {
                         $this->uncommitedqueries++;
                     }
                     if (!MDB::isError($success)) {
                         switch (@OCIStatementType($statement)) {
                             case 'SELECT':
                                 $result_value = intval($statement);
                                 $this->current_row[$result_value] = -1;
                                 if ($limit > 0) {
                                     $this->limits[$result_value] = array($first, $limit, 0);
                                 }
                                 $this->highest_fetched_row[$result_value] = -1;
                                 break;
                             default:
                                 $this->affected_rows = @OCIRowCount($statement);
                                 @OCIFreeCursor($statement);
                                 break;
                         }
                         $result = $statement;
                     }
                 } else {
                     return $this->oci8RaiseError($statement, 'Do query: Could not execute query');
                 }
             }
         } else {
             return $this->oci8RaiseError(NULL, 'Do query: Could not parse query');
         }
     }
     for (reset($descriptors), $descriptor = 0; $descriptor < count($descriptors); $descriptor++, next($descriptors)) {
         @OCIFreeDesc($descriptors[key($descriptors)]);
     }
     return $result;
 }
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:101,代码来源:oci8.php

示例4: _query

 function _query($sql, $inputarr)
 {
     if (is_array($sql)) {
         // is prepared sql
         $stmt = $sql[1];
         // we try to bind to permanent array, so that OCIBindByName is persistent
         // and carried out once only - note that max array element size is 4000 chars
         if (is_array($inputarr)) {
             $bindpos = $sql[3];
             if (isset($this->_bind[$bindpos])) {
                 // all tied up already
                 $bindarr =& $this->_bind[$bindpos];
             } else {
                 // one statement to bind them all
                 $bindarr = array();
                 foreach ($inputarr as $k => $v) {
                     $bindarr[$k] = $v;
                     OCIBindByName($stmt, ":{$k}", $bindarr[$k], 4000);
                 }
                 $this->_bind[$bindpos] =& $bindarr;
             }
         }
     } else {
         $stmt = @OCIParse($this->_connectionID, $sql);
     }
     $this->_stmt = $stmt;
     if (!$stmt) {
         return false;
     }
     if (defined('ADODB_PREFETCH_ROWS')) {
         @OCISetPrefetch($stmt, ADODB_PREFETCH_ROWS);
     }
     if (is_array($inputarr)) {
         foreach ($inputarr as $k => $v) {
             if (is_array($v)) {
                 if (sizeof($v) == 2) {
                     // suggested by g.giunta@libero.
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1]);
                 } else {
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k][0], $v[1], $v[2]);
                 }
             } else {
                 $len = -1;
                 if ($v === ' ') {
                     $len = 1;
                 }
                 if (isset($bindarr)) {
                     // is prepared sql, so no need to ocibindbyname again
                     $bindarr[$k] = $v;
                 } else {
                     // dynamic sql, so rebind every time
                     OCIBindByName($stmt, ":{$k}", $inputarr[$k], $len);
                 }
             }
         }
     }
     if (OCIExecute($stmt, $this->_commit)) {
         switch (@OCIStatementType($stmt)) {
             case "SELECT":
                 return $stmt;
             case "BEGIN":
                 if (isset($sql[4])) {
                     // jlim
                     $cursor = $sql[4];
                     // jlim
                     OCIExecute($cursor);
                     return $cursor;
                 } else {
                     return $stmt;
                 }
                 break;
             default:
                 return true;
         }
         /* Now this could be an Update/Insert or Delete */
         //if (@OCIStatementType($stmt) != 'SELECT') return true;
         //return $stmt;
     }
     return false;
 }
开发者ID:cbsistem,项目名称:bansos-dev,代码行数:80,代码来源:adodb-oci8.inc.php

示例5: DoQuery


//.........这里部分代码省略.........
                         $this->SetOCIError("Do query", "Could not bind clob upload descriptor", OCIError($statement));
                         $success = 0;
                         break;
                     }
                 }
                 if ($success) {
                     for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
                         $position = Key($this->blobs[$prepared_query]);
                         if (!OCIBindByName($statement, ":blob" . $position, $descriptors[$position], -1, OCI_B_BLOB)) {
                             $this->SetOCIError("Do query", "Could not bind blob upload descriptor", OCIError($statement));
                             $success = 0;
                             break;
                         }
                     }
                 }
             }
             if ($success) {
                 if ($result = @OCIExecute($statement, $lobs == 0 && $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
                     if ($lobs) {
                         for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
                             $position = Key($this->clobs[$prepared_query]);
                             $clob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
                             for ($value = ""; !MetabaseEndOfLOB($clob_stream);) {
                                 if (MetabaseReadLOB($clob_stream, $data, $this->lob_buffer_length) < 0) {
                                     $this->SetError("Do query", MetabaseLOBError($clob));
                                     $success = 0;
                                     break;
                                 }
                                 $value .= $data;
                             }
                             if ($success && !$descriptors[$position]->save($value)) {
                                 $this->SetOCIError("Do query", "Could not upload clob data", OCIError($statement));
                                 $success = 0;
                             }
                         }
                         if ($success) {
                             for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
                                 $position = Key($this->blobs[$prepared_query]);
                                 $blob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
                                 for ($value = ""; !MetabaseEndOfLOB($blob_stream);) {
                                     if (MetabaseReadLOB($blob_stream, $data, $this->lob_buffer_length) < 0) {
                                         $this->SetError("Do query", MetabaseLOBError($blob));
                                         $success = 0;
                                         break;
                                     }
                                     $value .= $data;
                                 }
                                 if ($success && !$descriptors[$position]->save($value)) {
                                     $this->SetOCIError("Do query", "Could not upload blob data", OCIError($statement));
                                     $success = 0;
                                 }
                             }
                         }
                     }
                     if ($this->auto_commit) {
                         if ($lobs) {
                             if ($success) {
                                 if (!OCICommit($this->connection)) {
                                     $this->SetOCIError("Do query", "Could not commit pending LOB updating transaction", OCIError());
                                     $success = 0;
                                 }
                             } else {
                                 if (!OCIRollback($this->connection)) {
                                     $this->SetOCIError("Do query", $this->Error() . " and then could not rollback LOB updating transaction", OCIError());
                                 }
                             }
                         }
                     } else {
                         $this->uncommitedqueries++;
                     }
                     if ($success) {
                         switch (OCIStatementType($statement)) {
                             case "SELECT":
                                 $result_value = intval($statement);
                                 $this->current_row[$result_value] = -1;
                                 if ($limit > 0) {
                                     $this->limits[$result_value] = array($first, $limit, 0);
                                 }
                                 $this->highest_fetched_row[$result_value] = -1;
                                 break;
                             default:
                                 $this->affected_rows = OCIRowCount($statement);
                                 OCIFreeCursor($statement);
                                 break;
                         }
                         $result = $statement;
                     }
                 } else {
                     $this->SetOCIError("Do query", "Could not execute query", OCIError($statement));
                 }
             }
         } else {
             $this->SetOCIError("Do query", "Could not parse query", OCIError($statement));
         }
     }
     for (Reset($descriptors), $descriptor = 0; $descriptor < count($descriptors); $descriptor++, Next($descriptors)) {
         @OCIFreeDesc($descriptors[Key($descriptors)]);
     }
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:101,代码来源:metabase_oci.php

示例6: execute_request


//.........这里部分代码省略.........
                             break;
                     }
                 }
             }
             mssql_close($conn);
             break;
         case "ORACLE":
             //echo "oracle";
             // Connexion
             // eko ($value_config);
             //      $conn = @OCILogon ( $value_config['login'], $value_config['password'], $value_config['db'] ) ;
             $conn = @oci_pconnect($value_config['login'], $value_config['password'], $value_config['db']);
             //global $conn ;
             $conn_error = ocierror();
             // Problème à la connexion
             if ($conn_error) {
                 $INDIC_SVC[0] = $conn_error['code'];
                 $INDIC_SVC[1] = $conn_error['message'];
                 // pas de problème de connexion
             } else {
                 // print $requete;
                 // execution de la raquete
                 $stmt = OCIParse($conn, $requete);
                 // print ( $requete ) ;
                 if (DEBUGSQL and function_exists('eko')) {
                     eko($requete);
                 }
                 OCIExecute($stmt);
                 $INDIC_SVC[0] = $conn_error['code'];
                 $INDIC_SVC[1] = $conn_error['message'];
                 // pas de problème à l'execution de la requete
                 if (!$INDIC_SVC[0]) {
                     // Analyse du type de requete
                     $qry_type = OCIStatementType($stmt);
                     switch ($qry_type) {
                         case "SELECT":
                             $nrows = OCIFetchStatement($stmt, $results);
                             // eko ( "<P>There are $nrows records containing your criteria. ($requete)</P>" ) ;
                             if ($nrows) {
                                 // le nom des colonnes a ramener n'a pas été spécifié ou est *
                                 if (!isset($tab_cols)) {
                                     $ncols = OCINumCols($stmt);
                                     for ($k = 1; $k <= $ncols; $k++) {
                                         $tab_cols[] = OCIColumnName($stmt, $k);
                                     }
                                 }
                                 for ($j = 0; $j < $nrows; $j++) {
                                     if (isset($tab_cols) and is_array($tab_cols)) {
                                         while (list($key, $val) = each($tab_cols)) {
                                             if (isset(${$val})) {
                                                 ${$val} .= $results[$val][$j] . "§";
                                             } else {
                                                 ${$val} = $results[$val][$j] . "§";
                                             }
                                         }
                                     }
                                     reset($tab_cols);
                                 }
                             }
                             //Construction des tableaux de colonnes
                             if (isset($tab_cols) and is_array($tab_cols)) {
                                 while (list($key, $val) = each($tab_cols)) {
                                     // on retire le dernier |
                                     ${$val} = substr(${$val}, 0, strlen(${$val}) - 1);
                                     $resultats[$val] = explode("§", ${$val});
                                 }
开发者ID:jeromecc,项目名称:tuv2,代码行数:67,代码来源:clResultQuery.php


注:本文中的OCIStatementType函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。