本文整理汇总了PHP中OCINewCursor函数的典型用法代码示例。如果您正苦于以下问题:PHP OCINewCursor函数的具体用法?PHP OCINewCursor怎么用?PHP OCINewCursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OCINewCursor函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Prepare
function Prepare($sql, $cursor = false)
{
static $BINDNUM = 0;
$stmt = OCIParse($this->_connectionID, $sql);
if (!$stmt) {
return false;
}
$BINDNUM += 1;
$sttype = @OCIStatementType($stmt);
if ($sttype == 'BEGIN' || $sttype == 'DECLARE') {
return array($sql, $stmt, 0, $BINDNUM, $cursor ? OCINewCursor($this->_connectionID) : false);
}
return array($sql, $stmt, 0, $BINDNUM);
}
示例2: Prepare
function Prepare($sql,$cursor=false)
{
static $BINDNUM = 0;
$stmt = OCIParse($this->_connectionID,$sql);
if (!$stmt) {
$this->_errorMsg = false;
$this->_errorCode = false;
$arr = @OCIError($this->_connectionID);
if ($arr === false) return false;
$this->_errorMsg = $arr['message'];
$this->_errorCode = $arr['code'];
return false;
}
$BINDNUM += 1;
$sttype = @OCIStatementType($stmt);
if ($sttype == 'BEGIN' || $sttype == 'DECLARE') {
return array($sql,$stmt,0,$BINDNUM, ($cursor) ? OCINewCursor($this->_connectionID) : false);
}
return array($sql,$stmt,0,$BINDNUM);
}
示例3: Prepare
function Prepare($sql,$cursor=false)
{
static $BINDNUM = 0;
$stmt = OCIParse($this->_connectionID,$sql);
if (!$stmt) return false;
$BINDNUM += 1;
if (@OCIStatementType($stmt) == 'BEGIN') {
return array($sql,$stmt,0,$BINDNUM, ($cursor) ? OCINewCursor($this->_connectionID) : false);
}
return array($sql,$stmt,0,$BINDNUM);
}
示例4: query
function query($Query_String)
{
/* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "") {
/* The empty query string is passed on from the constructor,
* when calling the class without a query, e.g. in situations
* like these: '$db = new DB_Sql_Subclass;'
*/
return 0;
}
$this->connect();
$this->Query_ID = OCIParse($this->Link_ID, $Query_String);
if (!$this->Query_ID) {
$this->Error = OCIError($this->Query_ID);
$this->Halt($this->Error);
} else {
$old_error_reporting = error_reporting();
error_reporting($old_error_reporting & ~E_WARNING);
if (sizeof($this->Binds) > 0) {
foreach ($this->Binds as $parameter_name => $parameter_values) {
if ($parameter_values[2] == OCI_B_CURSOR) {
$this->Binds[$parameter_name][0] = OCINewCursor($this->Link_ID);
}
if ($parameter_values[2] == 0) {
OCIBindByName($this->Query_ID, ":" . $parameter_name, $this->Binds[$parameter_name][0], $parameter_values[1]);
} else {
OCIBindByName($this->Query_ID, ":" . $parameter_name, $this->Binds[$parameter_name][0], $parameter_values[1], $parameter_values[2]);
}
}
}
OCIExecute($this->Query_ID);
error_reporting($old_error_reporting);
$this->Error = OCIError($this->Query_ID);
}
$this->Row = 0;
if ($this->Debug) {
printf("Debug: query = %s<br>\n", $Query_String);
}
if ($this->Error["code"] != 0 && $this->sqoe) {
$this->Halt($this->Error);
}
#echo "<BR><FONT color=red><B>".$this->Error["message"]."<BR>Query :\"$Query_String\"</B></FONT>";
if (sizeof($this->Binds) > 0) {
$bi = 0;
foreach ($this->Binds as $parameter_name => $parameter_values) {
if ($parameter_values[2] == OCI_B_CURSOR) {
OCIExecute($this->Binds[$parameter_name][0]);
$this->Error = OCIError($this->Binds[$parameter_name][0]);
$this->Query_ID = $this->Binds[$parameter_name][0];
}
$this->Record[$parameter_name] = $parameter_values[0];
$this->Record[$bi++] = $parameter_values[0];
}
$this->Binds = array();
}
return $this->Query_ID;
}
示例5: Prepare
function Prepare($sql)
{
static $BINDNUM = 0;
$stmt = OCIParse($this->_connectionID, $sql);
if (!$stmt) {
return $sql;
}
// error in statement, let Execute() handle the error
$BINDNUM += 1;
if (@OCIStatementType($stmt) == 'BEGIN') {
return array($sql, $stmt, 0, $BINDNUM, OCINewCursor($this->_connectionID));
}
return array($sql, $stmt, 0, $BINDNUM);
}
示例6: _execute
//.........这里部分代码省略.........
// Test to see if descriptor has already been created for this
// variable (i.e. if it has been bound more than once):
if (!is_a($this->values[$parameter], "OCI-Lob")) {
$this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_FILE);
if (false === $this->values[$parameter]) {
$result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for BFILE in parameter: ' . $parameter, __FUNCTION__);
break;
}
}
if (!@OCIBindByName($this->statement, ':' . $parameter, $this->values[$parameter], -1, $type)) {
$result = $this->db->raiseError($this->statement, null, null, 'Could not bind BFILE parameter', __FUNCTION__);
break;
}
} else {
if ($type == OCI_B_ROWID) {
// Test to see if descriptor has already been created for this
// variable (i.e. if it has been bound more than once):
if (!is_a($this->values[$parameter], "OCI-Lob")) {
$this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_ROWID);
if (false === $this->values[$parameter]) {
$result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for ROWID in parameter: ' . $parameter, __FUNCTION__);
break;
}
}
if (!@OCIBindByName($this->statement, ':' . $parameter, $this->values[$parameter], -1, $type)) {
$result = $this->db->raiseError($this->statement, null, null, 'Could not bind ROWID parameter', __FUNCTION__);
break;
}
} else {
if ($type == OCI_B_CURSOR) {
// Test to see if cursor has already been allocated for this
// variable (i.e. if it has been bound more than once):
if (!is_resource($this->values[$parameter]) || !get_resource_type($this->values[$parameter]) == "oci8 statement") {
$this->values[$parameter] = @OCINewCursor($connection);
if (false === $this->values[$parameter]) {
$result = $this->db->raiseError(null, null, null, 'Unable to allocate cursor for parameter: ' . $parameter, __FUNCTION__);
break;
}
}
if (!@OCIBindByName($this->statement, ':' . $parameter, $this->values[$parameter], -1, $type)) {
$result = $this->db->raiseError($this->statement, null, null, 'Could not bind CURSOR parameter', __FUNCTION__);
break;
}
} else {
$maxlength = array_key_exists($parameter, $this->type_maxlengths) ? $this->type_maxlengths[$parameter] : -1;
$this->values[$parameter] = $this->db->quote($this->values[$parameter], $type, false);
$quoted_values[$i] =& $this->values[$parameter];
if (PEAR::isError($quoted_values[$i])) {
return $quoted_values[$i];
}
if (!@OCIBindByName($this->statement, ':' . $parameter, $quoted_values[$i], $maxlength)) {
$result = $this->db->raiseError($this->statement, null, null, 'could not bind non-abstract parameter', __FUNCTION__);
break;
}
}
}
}
}
++$i;
}
$lob_keys = array_keys($lobs);
if (!PEAR::isError($result)) {
$mode = !empty($lobs) || $this->db->in_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS;
if (!@OCIExecute($this->statement, $mode)) {
$err = $this->db->raiseError($this->statement, null, null, 'could not execute statement', __FUNCTION__);
return $err;
示例7: sqlCompile
function sqlCompile($Query_String)
{
$db = new clsDBdatabase();
$db->Provider->sqoe = 0;
$esto = array(chr(10), chr(9), chr(13));
$porEsto = array("\n", "\t", " ");
$parse = '
declare
c integer := dbms_sql.open_cursor();
begin
dbms_sql.parse(c, :STMT, dbms_sql.native);
dbms_sql.close_cursor(c);
end;
';
$plsql = trim(str_replace($esto, $porEsto, $Query_String));
#echo $plsql ;
#$Query_String = 'select a from dual';
$db->bind('STMT', $plsql, 4000, SQLT_CHR);
#$db->query('BEGIN '.trim(str_replace($esto, $porEsto, $parse)).' END;');
$db->Query_ID = OCIParse($db->Link_ID, 'BEGIN ' . trim(str_replace($esto, $porEsto, $parse)) . ' END;');
if (!$db->Query_ID) {
$db->Error = OCIError($db->Link_ID);
echo 'ERROR ' . OCIError($db->Link_ID);
}
if (sizeof($db->Provider->Binds) > 0) {
foreach ($db->Provider->Binds as $parameter_name => $parameter_values) {
if ($parameter_values[2] == OCI_B_CURSOR) {
$this->db[$parameter_name][0] = OCINewCursor($db->Link_ID);
}
if ($parameter_values[2] == 0) {
OCIBindByName($db->Query_ID, ":" . $parameter_name, $db->Provider->Binds[$parameter_name][0], $parameter_values[1]);
} else {
OCIBindByName($db->Query_ID, ":" . $parameter_name, $db->Provider->Binds[$parameter_name][0], $parameter_values[1], $parameter_values[2]);
}
}
}
@OCIExecute($db->Query_ID);
$db->Error = OCIError($db->Query_ID);
#var_dump($db->Error);
$SQLCODE = $db->Error['code'];
$SQLERRMSG = explode('ORA-06512', $db->Error['message']);
$SQLERRMSG = $SQLERRMSG[0];
$error = new stdClass();
$error->SQLCODE = !$SQLCODE ? 0 : $SQLCODE;
$error->SQLERRMSG = $SQLERRMSG;
return $error;
}