TYPO3 CMS  TYPO3_7-6
ADODB_oci8 Class Reference
Inheritance diagram for ADODB_oci8:
ADODB_oci805 ADODB_oci8po ADODB_oci8quercus

Public Member Functions

 __construct ()
 
 MetaColumns ($table, $normalize=true)
 
 Time ()
 
 _connect ($argHostname, $argUsername, $argPassword, $argDatabasename=null, $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='C')
 
 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, $upper=false)
 
 CharMax ()
 
 TextMax ()
 
 qstr ($s, $magic_quotes=false)
 

Public Attributes

 $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 = 32
 
 $_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()
 

Detailed Description

Definition at line 56 of file adodb-oci8.inc.php.

Constructor & Destructor Documentation

◆ __construct()

ADODB_oci8::__construct ( )

Definition at line 106 of file adodb-oci8.inc.php.

Member Function Documentation

◆ _affectedrows()

ADODB_oci8::_affectedrows ( )

Definition at line 298 of file adodb-oci8.inc.php.

◆ _close()

ADODB_oci8::_close ( )

Definition at line 1375 of file adodb-oci8.inc.php.

◆ _connect()

ADODB_oci8::_connect (   $argHostname,
  $argUsername,
  $argPassword,
  $argDatabasename = null,
  $mode = 0 
)

Multiple modes of connection are supported:

a. Local Database $conn->Connect(false,'scott','tiger');

b. From tnsnames.ora $conn->Connect($tnsname,'scott','tiger'); $conn->Connect(false,'scott','tiger',$tnsname);

c. Server + service name $conn->Connect($serveraddress,'scott,'tiger',$service_name);

d. Server + SID $conn->connectSID = true; $conn->Connect($serveraddress,'scott,'tiger',$SID);

Parameters
string | false$argHostnameDB server hostname or TNS name
string$argUsername
string$argPassword
string$argDatabasenameService name, SID (defaults to null)
int$modeConnection mode, defaults to 0 (0 = non-persistent, 1 = persistent, 2 = force new connection)
Returns
bool

Definition at line 210 of file adodb-oci8.inc.php.

References Execute().

Referenced by _nconnect(), and _pconnect().

◆ _nconnect()

ADODB_oci8::_nconnect (   $argHostname,
  $argUsername,
  $argPassword,
  $argDatabasename 
)

Definition at line 293 of file adodb-oci8.inc.php.

References _connect().

◆ _pconnect()

ADODB_oci8::_pconnect (   $argHostname,
  $argUsername,
  $argPassword,
  $argDatabasename 
)

Definition at line 287 of file adodb-oci8.inc.php.

References _connect().

◆ _query()

ADODB_oci8::_query (   $sql,
  $inputarr = false 
)

returns query ID if successful, otherwise false this version supports:

  1. $db->execute('select * from table');
  2. $db->prepare('insert into table (a,b,c) values (:0,:1,:2)'); $db->execute($prepared_statement, array(1,2,3));
  3. $db->execute('insert into table (a,b,c) values (:a,:b,:c)',array('a'=>1,'b'=>2,'c'=>3));
  4. $db->prepare('insert into table (a,b,c) values (:0,:1,:2)'); $db->bind($stmt,1); $db->bind($stmt,2); $db->bind($stmt,3); $db->execute($stmt);

Definition at line 1225 of file adodb-oci8.inc.php.

References $sql, and debug().

Referenced by ADODB_oci8po\_query().

◆ BeginTrans()

ADODB_oci8::BeginTrans ( )

Definition at line 491 of file adodb-oci8.inc.php.

References Execute().

Referenced by RowLock(), UpdateBlob(), and UpdateBlobFile().

◆ Bind()

ADODB_oci8::Bind ( $stmt,
$var,
  $size = 4000,
  $type = false,
  $name = false,
  $isOutput = false 
)

Bind a variable – very, very fast for executing repeated statements in oracle.

Better than using for ($i = 0; $i < $max; $i++) { $p1 = ?; $p2 = ?; $p3 = ?; $this->Execute("insert into table (col0, col1, col2) values (:0, :1, :2)", array($p1,$p2,$p3)); }

Usage: $stmt = $DB->Prepare("insert into table (col0, col1, col2) values (:0, :1, :2)"); $DB->Bind($stmt, $p1); $DB->Bind($stmt, $p2); $DB->Bind($stmt, $p3); for ($i = 0; $i < $max; $i++) { $p1 = ?; $p2 = ?; $p3 = ?; $DB->Execute($stmt); }

Some timings to insert 1000 records, test table has 3 cols, and 1 index.

  • Time 0.6081s (1644.60 inserts/sec) with direct oci_parse/oci_execute
  • Time 0.6341s (1577.16 inserts/sec) with ADOdb Prepare/Bind/Execute
  • Time 1.5533s ( 643.77 inserts/sec) with pure SQL using Execute

Now if PHP only had batch/bulk updating like Java or PL/SQL...

Note that the order of parameters differs from oci_bind_by_name, because we default the names to :0, :1, :2

Definition at line 1118 of file adodb-oci8.inc.php.

References debug(), and oci_lob_desc().

Referenced by Parameter().

◆ BindDate()

ADODB_oci8::BindDate (   $d)

Definition at line 337 of file adodb-oci8.inc.php.

◆ BindTimeStamp()

ADODB_oci8::BindTimeStamp (   $ts)

Definition at line 347 of file adodb-oci8.inc.php.

References adodb_date().

◆ CharMax()

ADODB_oci8::CharMax ( )

Definition at line 1483 of file adodb-oci8.inc.php.

◆ CommitTrans()

ADODB_oci8::CommitTrans (   $ok = true)

Definition at line 510 of file adodb-oci8.inc.php.

References RollbackTrans().

Referenced by UpdateBlob(), and UpdateBlobFile().

◆ DBDate()

ADODB_oci8::DBDate (   $d,
  $isfld = false 
)

Definition at line 312 of file adodb-oci8.inc.php.

References adodb_date().

◆ DBTimeStamp()

ADODB_oci8::DBTimeStamp (   $ts,
  $isfld = false 
)

Definition at line 367 of file adodb-oci8.inc.php.

◆ ErrorMsg()

ADODB_oci8::ErrorMsg ( )

Definition at line 548 of file adodb-oci8.inc.php.

◆ ErrorNo()

ADODB_oci8::ErrorNo ( )

Definition at line 573 of file adodb-oci8.inc.php.

◆ Execute()

ADODB_oci8::Execute (   $sql,
  $inputarr = false 
)

Execute SQL

Parameters
sqlSQL 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.
Returns
RecordSet or false

Definition at line 927 of file adodb-oci8.inc.php.

References $sql, Prepare(), and qstr().

Referenced by _connect(), BeginTrans(), ExecuteCursor(), MetaColumns(), MetaIndexes(), MetaPrimaryKeys(), SelectLimit(), Time(), UpdateBlob(), and UpdateBlobFile().

◆ ExecuteCursor()

ADODB_oci8::ExecuteCursor (   $sql,
  $cursorName = 'rs',
  $params = false 
)

Definition at line 1058 of file adodb-oci8.inc.php.

References $params, $rs, $sql, Execute(), Parameter(), and Prepare().

◆ GetRandRow()

ADODB_oci8::GetRandRow (   $sql,
  $arr = false 
)

Definition at line 684 of file adodb-oci8.inc.php.

References $sql.

◆ IfNull()

ADODB_oci8::IfNull (   $field,
  $ifNull 
)

Definition at line 306 of file adodb-oci8.inc.php.

◆ IsConnectionError()

ADODB_oci8::IsConnectionError (   $err)

Definition at line 1349 of file adodb-oci8.inc.php.

◆ MetaColumns()

ADODB_oci8::MetaColumns (   $table,
  $normalize = true 
)

Definition at line 115 of file adodb-oci8.inc.php.

References $rs, and Execute().

◆ MetaForeignKeys()

ADODB_oci8::MetaForeignKeys (   $table,
  $owner = false,
  $upper = false 
)

returns assoc array where keys are tables, and values are foreign keys

Parameters
str$table
str$owner[optional][default=NULL]
bool$upper[optional][discarded]
Returns
mixed[] Array of foreign key information

http://gis.mit.edu/classes/11.521/sqlnotes/referential_integrity.html

Definition at line 1443 of file adodb-oci8.inc.php.

References $sql, and qstr().

◆ MetaIndexes()

ADODB_oci8::MetaIndexes (   $table,
  $primary = FALSE,
  $owner = false 
)

Definition at line 413 of file adodb-oci8.inc.php.

References $rs, and Execute().

◆ MetaPrimaryKeys()

ADODB_oci8::MetaPrimaryKeys (   $table,
  $owner = false,
  $internalKey = false 
)

Definition at line 1397 of file adodb-oci8.inc.php.

References $a, $rs, $sql, and Execute().

◆ MetaTables()

ADODB_oci8::MetaTables (   $ttype = false,
  $showSchema = false,
  $mask = false 
)

Definition at line 397 of file adodb-oci8.inc.php.

References $metaTablesSQL, and qstr().

◆ Param()

ADODB_oci8::Param (   $name,
  $type = 'C' 
)

Definition at line 1179 of file adodb-oci8.inc.php.

◆ Parameter()

ADODB_oci8::Parameter ( $stmt,
$var,
  $name,
  $isOutput = false,
  $maxLen = 4000,
  $type = false 
)

Usage: $stmt = $db->Prepare('select * from table where id =:myid and group=:group'); $db->Parameter($stmt,$id,'myid'); $db->Parameter($stmt,$group,'group'); $db->Execute($stmt);

Parameters
$stmtStatement returned by Prepare() or PrepareSP().
$varPHP variable to bind to
$nameName of stored procedure variable name to bind to.
[$isOutput]Indicates direction of parameter 0/false=IN 1=OUT 2= IN/OUT. This is ignored in oci8.
[$maxLen]Holds an maximum length of the variable.
[$type]The data type of $var. Legal values depend on driver.

http://php.net/oci_bind_by_name

Definition at line 1200 of file adodb-oci8.inc.php.

References Bind(), and debug().

Referenced by ExecuteCursor().

◆ Prepare()

ADODB_oci8::Prepare (   $sql,
  $cursor = false 
)

Definition at line 1016 of file adodb-oci8.inc.php.

References $sql.

Referenced by Execute(), ExecuteCursor(), ADODB_oci8po\Prepare(), and SelectLimit().

◆ qstr()

ADODB_oci8::qstr (   $s,
  $magic_quotes = false 
)

Quotes a string. An example is $db->qstr("Don't bother",magic_quotes_runtime());

Parameters
string$sthe string to quote
bool$magic_quotesif $s is GET/POST var, set to get_magic_quotes_gpc(). This undoes the stupidity of magic quotes for GPC.
Returns
string quoted string to be sent back to database

Definition at line 1503 of file adodb-oci8.inc.php.

Referenced by Execute(), MetaForeignKeys(), and MetaTables().

◆ RollbackTrans()

ADODB_oci8::RollbackTrans ( )

Definition at line 528 of file adodb-oci8.inc.php.

Referenced by CommitTrans().

◆ RowLock()

ADODB_oci8::RowLock (   $tables,
  $where,
  $col = '1 as adodbignore' 
)

Definition at line 389 of file adodb-oci8.inc.php.

References BeginTrans().

◆ SelectDB()

ADODB_oci8::SelectDB (   $dbName)

Definition at line 543 of file adodb-oci8.inc.php.

◆ SelectLimit()

ADODB_oci8::SelectLimit (   $sql,
  $nrows = -1,
  $offset = -1,
  $inputarr = false,
  $secs2cache = 0 
)

This algorithm makes use of

a. FIRST_ROWS hint The FIRST_ROWS hint explicitly chooses the approach to optimize response time, that is, minimum resource usage to return the first row. Results will be returned as soon as they are identified.

b. Uses rownum tricks to obtain only the required rows from a given offset. As this uses complicated sql statements, we only use this if $offset >= 100. This idea by Tomas V V Cox.

This implementation does not appear to work with oracle 8.0.5 or earlier. Comment out this function then, and the slower SelectLimit() in the base class will be used.

Definition at line 707 of file adodb-oci8.inc.php.

References $rs, $sql, Execute(), and Prepare().

◆ ServerInfo()

ADODB_oci8::ServerInfo ( )

Definition at line 279 of file adodb-oci8.inc.php.

◆ SQLDate()

ADODB_oci8::SQLDate (   $fmt,
  $col = false 
)

Format date column in sql string given an input format that understands Y M D

Definition at line 601 of file adodb-oci8.inc.php.

References $sysTimeStamp.

◆ TextMax()

ADODB_oci8::TextMax ( )

Definition at line 1488 of file adodb-oci8.inc.php.

◆ Time()

ADODB_oci8::Time ( )

Definition at line 174 of file adodb-oci8.inc.php.

References $rs, and Execute().

◆ UpdateBlob()

ADODB_oci8::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...

Definition at line 844 of file adodb-oci8.inc.php.

References $rs, $sql, BeginTrans(), CommitTrans(), and Execute().

◆ UpdateBlobFile()

ADODB_oci8::UpdateBlobFile (   $table,
  $column,
  $val,
  $where,
  $blobtype = 'BLOB' 
)

Usage: store file pointed to by $val in a blob

Definition at line 890 of file adodb-oci8.inc.php.

References $rs, $sql, BeginTrans(), CommitTrans(), and Execute().

Member Data Documentation

◆ $_bind

ADODB_oci8::$_bind = false

Definition at line 90 of file adodb-oci8.inc.php.

◆ $_bindInputArray

ADODB_oci8::$_bindInputArray = true

Definition at line 74 of file adodb-oci8.inc.php.

◆ $_commit

ADODB_oci8::$_commit = 32

Definition at line 65 of file adodb-oci8.inc.php.

◆ $_dropSeqSQL

ADODB_oci8::$_dropSeqSQL = "DROP SEQUENCE %s"

Definition at line 85 of file adodb-oci8.inc.php.

◆ $_genIDSQL

ADODB_oci8::$_genIDSQL = "SELECT (%s.nextval) FROM DUAL"

Definition at line 76 of file adodb-oci8.inc.php.

◆ $_genSeqSQL

ADODB_oci8::$_genSeqSQL
Initial value:
= "
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
execute immediate 'CREATE SEQUENCE %s START WITH %s';
END;
"

Definition at line 77 of file adodb-oci8.inc.php.

◆ $_getarray

ADODB_oci8::$_getarray = false

Definition at line 93 of file adodb-oci8.inc.php.

◆ $_hasOciFetchStatement

ADODB_oci8::$_hasOciFetchStatement = false

Definition at line 92 of file adodb-oci8.inc.php.

◆ $_initdate

ADODB_oci8::$_initdate = true

Definition at line 66 of file adodb-oci8.inc.php.

◆ $_nestedSQL

ADODB_oci8::$_nestedSQL = true

Definition at line 91 of file adodb-oci8.inc.php.

◆ $_refLOBs

ADODB_oci8::$_refLOBs = array()

Definition at line 102 of file adodb-oci8.inc.php.

◆ $_stmt

ADODB_oci8::$_stmt

Definition at line 64 of file adodb-oci8.inc.php.

◆ $concat_operator

ADODB_oci8::$concat_operator ='||'

Definition at line 60 of file adodb-oci8.inc.php.

◆ $connectSID

ADODB_oci8::$connectSID = false

Definition at line 89 of file adodb-oci8.inc.php.

◆ $databaseType

ADODB_oci8::$databaseType = 'oci8'

Definition at line 57 of file adodb-oci8.inc.php.

◆ $dataProvider

ADODB_oci8::$dataProvider = 'oci8'

Definition at line 58 of file adodb-oci8.inc.php.

◆ $dateformat

ADODB_oci8::$dateformat = 'YYYY-MM-DD'

Definition at line 99 of file adodb-oci8.inc.php.

◆ $datetime

ADODB_oci8::$datetime = false

Definition at line 101 of file adodb-oci8.inc.php.

◆ $firstrows

ADODB_oci8::$firstrows = true

Definition at line 96 of file adodb-oci8.inc.php.

◆ $hasAffectedRows

ADODB_oci8::$hasAffectedRows = true

Definition at line 86 of file adodb-oci8.inc.php.

◆ $hasGenID

ADODB_oci8::$hasGenID = true

Definition at line 75 of file adodb-oci8.inc.php.

◆ $leftOuter

ADODB_oci8::$leftOuter = ''

Definition at line 94 of file adodb-oci8.inc.php.

◆ $metaColumnsSQL

ADODB_oci8::$metaColumnsSQL = "select cname,coltype,width, SCALE, PRECISION, NULLS, DEFAULTVAL from col where tname='%s' order by colno"

Definition at line 68 of file adodb-oci8.inc.php.

◆ $metaColumnsSQL2

ADODB_oci8::$metaColumnsSQL2
Initial value:
= "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"

Definition at line 69 of file adodb-oci8.inc.php.

◆ $metaDatabasesSQL

ADODB_oci8::$metaDatabasesSQL = "SELECT USERNAME FROM ALL_USERS WHERE USERNAME NOT IN ('SYS','SYSTEM','DBSNMP','OUTLN') ORDER BY 1"

Definition at line 63 of file adodb-oci8.inc.php.

◆ $metaTablesSQL

ADODB_oci8::$metaTablesSQL = "select table_name,table_type from cat where table_type in ('TABLE','VIEW') and table_name not like 'BIN\$%'"

Definition at line 67 of file adodb-oci8.inc.php.

Referenced by MetaTables().

◆ $NLS_DATE_FORMAT

ADODB_oci8::$NLS_DATE_FORMAT = 'YYYY-MM-DD'

Definition at line 98 of file adodb-oci8.inc.php.

◆ $noNullStrings

ADODB_oci8::$noNullStrings = false

Definition at line 88 of file adodb-oci8.inc.php.

◆ $random

ADODB_oci8::$random = "abs(mod(DBMS_RANDOM.RANDOM,10000001)/10000000)"

Definition at line 87 of file adodb-oci8.inc.php.

◆ $replaceQuote

ADODB_oci8::$replaceQuote = "''"

Definition at line 59 of file adodb-oci8.inc.php.

◆ $selectOffsetAlg1

ADODB_oci8::$selectOffsetAlg1 = 1000

Definition at line 97 of file adodb-oci8.inc.php.

◆ $session_sharing_force_blob

ADODB_oci8::$session_sharing_force_blob = false

Definition at line 95 of file adodb-oci8.inc.php.

◆ $sysDate

ADODB_oci8::$sysDate = "TRUNC(SYSDATE)"

Definition at line 61 of file adodb-oci8.inc.php.

◆ $sysTimeStamp

ADODB_oci8::$sysTimeStamp = 'SYSDATE'

Definition at line 62 of file adodb-oci8.inc.php.

Referenced by SQLDate().

◆ $useDBDateFormatForTextInput

ADODB_oci8::$useDBDateFormatForTextInput =false

Definition at line 100 of file adodb-oci8.inc.php.