|
Adodb Dokumentation
V5.14 8 Sept 2011
|

Öffentliche Methoden | |
| ADODB_oci8 () | |
| MetaColumns ($table, $normalize=true) | |
| Time () | |
| _connect ($argHostname, $argUsername, $argPassword, $argDatabasename, $mode=0) | |
| ServerInfo () | |
| _pconnect ($argHostname, $argUsername, $argPassword, $argDatabasename) | |
| _nconnect ($argHostname, $argUsername, $argPassword, $argDatabasename) | |
| _affectedrows () | |
| IfNull ($field, $ifNull) | |
| DBDate ($d, $isfld=false) | |
| BindDate ($d) | |
| BindTimeStamp ($ts) | |
| DBTimeStamp ($ts, $isfld=false) | |
| RowLock ($tables, $where, $col='1 as adodbignore') | |
| MetaTables ($ttype=false, $showSchema=false, $mask=false) | |
| MetaIndexes ($table, $primary=FALSE, $owner=false) | |
| BeginTrans () | |
| CommitTrans ($ok=true) | |
| RollbackTrans () | |
| SelectDB ($dbName) | |
| ErrorMsg () | |
| ErrorNo () | |
| SQLDate ($fmt, $col=false) | |
| GetRandRow ($sql, $arr=false) | |
| SelectLimit ($sql, $nrows=-1, $offset=-1, $inputarr=false, $secs2cache=0) | |
| UpdateBlob ($table, $column, $val, $where, $blobtype='BLOB') | |
| UpdateBlobFile ($table, $column, $val, $where, $blobtype='BLOB') | |
| Execute ($sql, $inputarr=false) | |
| Prepare ($sql, $cursor=false) | |
| ExecuteCursor ($sql, $cursorName='rs', $params=false) | |
| Bind (&$stmt, &$var, $size=4000, $type=false, $name=false, $isOutput=false) | |
| Param ($name, $type=false) | |
| Parameter (&$stmt, &$var, $name, $isOutput=false, $maxLen=4000, $type=false) | |
| _query ($sql, $inputarr=false) | |
| IsConnectionError ($err) | |
| _close () | |
| MetaPrimaryKeys ($table, $owner=false, $internalKey=false) | |
| MetaForeignKeys ($table, $owner=false) | |
| CharMax () | |
| TextMax () | |
| qstr ($s, $magic_quotes=false) | |
Datenfelder | |
| $databaseType = 'oci8' | |
| $dataProvider = 'oci8' | |
| $replaceQuote = "''" | |
| $concat_operator = '||' | |
| $sysDate = "TRUNC(SYSDATE)" | |
| $sysTimeStamp = 'SYSDATE' | |
| $metaDatabasesSQL = "SELECT USERNAME FROM ALL_USERS WHERE USERNAME NOT IN ('SYS','SYSTEM','DBSNMP','OUTLN') ORDER BY 1" | |
| $_stmt | |
| $_commit = OCI_COMMIT_ON_SUCCESS | |
| $_initdate = true | |
| $metaTablesSQL = "select table_name,table_type from cat where table_type in ('TABLE','VIEW') and table_name not like 'BIN\$%'" | |
| $metaColumnsSQL = "select cname,coltype,width, SCALE, PRECISION, NULLS, DEFAULTVAL from col where tname='%s' order by colno" | |
| $metaColumnsSQL2 | |
| $_bindInputArray = true | |
| $hasGenID = true | |
| $_genIDSQL = "SELECT (%s.nextval) FROM DUAL" | |
| $_genSeqSQL | |
| $_dropSeqSQL = "DROP SEQUENCE %s" | |
| $hasAffectedRows = true | |
| $random = "abs(mod(DBMS_RANDOM.RANDOM,10000001)/10000000)" | |
| $noNullStrings = false | |
| $connectSID = false | |
| $_bind = false | |
| $_nestedSQL = true | |
| $_hasOCIFetchStatement = false | |
| $_getarray = false | |
| $leftOuter = '' | |
| $session_sharing_force_blob = false | |
| $firstrows = true | |
| $selectOffsetAlg1 = 1000 | |
| $NLS_DATE_FORMAT = 'YYYY-MM-DD' | |
| $dateformat = 'YYYY-MM-DD' | |
| $useDBDateFormatForTextInput = false | |
| $datetime = false | |
| $_refLOBs = array() | |
Definiert in Zeile 55 der Datei adodb-oci8.inc.php.
| Execute | ( | $ | sql, |
| $ | inputarr = false |
||
| ) |
Execute SQL
| sql | SQL statement to execute, or possibly an array holding prepared statement ($sql[0] will hold sql text) |
| [inputarr] | holds the input data to bind to. Null elements will be set to null. |
Erneute Implementation in ADODB_oci8po.
Definiert in Zeile 791 der Datei adodb-oci8.inc.php.
{
if ($this->fnExecute) {
$fn = $this->fnExecute;
$ret = $fn($this,$sql,$inputarr);
if (isset($ret)) return $ret;
}
if ($inputarr) {
#if (!is_array($inputarr)) $inputarr = array($inputarr);
$element0 = reset($inputarr);
$array2d = $this->bulkBind && is_array($element0) && !is_object(reset($element0));
# see http://phplens.com/lens/lensforum/msgs.php?id=18786
if ($array2d || !$this->_bindInputArray) {
# is_object check because oci8 descriptors can be passed in
if ($array2d && $this->_bindInputArray) {
if (is_string($sql))
$stmt = $this->Prepare($sql);
else
$stmt = $sql;
foreach($inputarr as $arr) {
$ret = $this->_Execute($stmt,$arr);
if (!$ret) return $ret;
}
return $ret;
} else {
$sqlarr = explode(':',$sql);
$sql = '';
$lastnomatch = -2;
#var_dump($sqlarr);echo "<hr>";var_dump($inputarr);echo"<hr>";
foreach($sqlarr as $k => $str) {
if ($k == 0) { $sql = $str; continue; }
// we need $lastnomatch because of the following datetime,
// eg. '10:10:01', which causes code to think that there is bind param :10 and :1
$ok = preg_match('/^([0-9]*)/', $str, $arr);
if (!$ok) $sql .= $str;
else {
$at = $arr[1];
if (isset($inputarr[$at]) || is_null($inputarr[$at])) {
if ((strlen($at) == strlen($str) && $k < sizeof($arr)-1)) {
$sql .= ':'.$str;
$lastnomatch = $k;
} else if ($lastnomatch == $k-1) {
$sql .= ':'.$str;
} else {
if (is_null($inputarr[$at])) $sql .= 'null';
else $sql .= $this->qstr($inputarr[$at]);
$sql .= substr($str, strlen($at));
}
} else {
$sql .= ':'.$str;
}
}
}
$inputarr = false;
}
}
$ret = $this->_Execute($sql,$inputarr);
} else {
$ret = $this->_Execute($sql,false);
}
return $ret;
}


| qstr | ( | $ | s, |
| $ | magic_quotes = false |
||
| ) |
Quotes a string. An example is $db->qstr("Don't bother",magic_quotes_runtime());
| s | the string to quote |
| [magic_quotes] | if $s is GET/POST var, set to get_magic_quotes_gpc(). This undoes the stupidity of magic quotes for GPC. |
Definiert in Zeile 1311 der Datei adodb-oci8.inc.php.
{
//$nofixquotes=false;
if ($this->noNullStrings && strlen($s)==0)$s = ' ';
if (!$magic_quotes) {
if ($this->replaceQuote[0] == '\\'){
$s = str_replace('\\','\\\\',$s);
}
return "'".str_replace("'",$this->replaceQuote,$s)."'";
}
// undo magic quotes for " unless sybase is on
if (!ini_get('magic_quotes_sybase')) {
$s = str_replace('\\"','"',$s);
$s = str_replace('\\\\','\\',$s);
return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
} else {
return "'".$s."'";
}
}

| UpdateBlob | ( | $ | table, |
| $ | column, | ||
| $ | val, | ||
| $ | where, | ||
| $ | blobtype = 'BLOB' |
||
| ) |
Usage: Store BLOBs and CLOBs
Example: to store $var in a blob
$conn->Execute('insert into TABLE (id,ablob) values(12,empty_blob())'); $conn->UpdateBlob('TABLE', 'ablob', $varHoldingBlob, 'ID=12', 'BLOB');
$blobtype supports 'BLOB' and 'CLOB', but you need to change to 'empty_clob()'.
to get length of LOB: select DBMS_LOB.GETLENGTH(ablob) from TABLE
If you are using CURSOR_SHARING = force, it appears this will case a segfault under oracle 8.1.7.0. Run: $db->Execute('ALTER SESSION SET CURSOR_SHARING=EXACT'); before UpdateBlob() then...
Definiert in Zeile 724 der Datei adodb-oci8.inc.php.
{
//if (strlen($val) < 4000) return $this->Execute("UPDATE $table SET $column=:blob WHERE $where",array('blob'=>$val)) != false;
switch(strtoupper($blobtype)) {
default: ADOConnection::outp("<b>UpdateBlob</b>: Unknown blobtype=$blobtype"); 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);
if ($this->session_sharing_force_blob) $this->Execute('ALTER SESSION SET CURSOR_SHARING=EXACT');
$commit = $this->autoCommit;
if ($commit) $this->BeginTrans();
$rs = $this->_Execute($sql,$arr);
if ($rez = !empty($rs)) $desc->save($val);
$desc->free();
if ($commit) $this->CommitTrans();
if ($this->session_sharing_force_blob) $this->Execute('ALTER SESSION SET CURSOR_SHARING=FORCE');
if ($rez) $rs->Close();
return $rez;
}

| UpdateBlobFile | ( | $ | table, |
| $ | column, | ||
| $ | val, | ||
| $ | where, | ||
| $ | blobtype = 'BLOB' |
||
| ) |
Usage: store file pointed to by $val in a blob
Definiert in Zeile 758 der Datei adodb-oci8.inc.php.
{
switch(strtoupper($blobtype)) {
default: ADOConnection::outp( "<b>UpdateBlob</b>: Unknown blobtype=$blobtype"); 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);
if ($rez = !empty($rs)) $desc->savefile($val);
$desc->free();
$this->CommitTrans();
if ($rez) $rs->Close();
return $rez;
}

| $_genSeqSQL |
" DECLARE PRAGMA AUTONOMOUS_TRANSACTION; BEGIN execute immediate 'CREATE SEQUENCE %s START WITH %s'; END; "
Definiert in Zeile 76 der Datei adodb-oci8.inc.php.
| $metaColumnsSQL2 |
"select column_name,data_type,data_length, data_scale, data_precision, case when nullable = 'Y' then 'NULL' else 'NOT NULL' end as nulls, data_default from all_tab_cols where owner='%s' and table_name='%s' order by column_id"
Definiert in Zeile 68 der Datei adodb-oci8.inc.php.