Source for file datadict-oci8.inc.php
Documentation is available at datadict-oci8.inc.php
V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Set tabs to 4 for best viewing.
var $dropTable =
"DROP TABLE %s CASCADE CONSTRAINTS";
$len =
$fieldobj->max_length;
if (isset
($this) &&
$len <=
$this->blobSize) return 'C';
if (isset
($this) &&
$len <=
$this->blobSize) return 'C2';
case 'C':
return 'VARCHAR';
case 'X':
return $this->typeX;
case 'XL':
return $this->typeXL;
case 'C2':
return 'NVARCHAR2';
case 'X2':
return 'NVARCHAR2(4000)';
case 'L':
return 'DECIMAL(1)';
case 'I1':
return 'DECIMAL(3)';
case 'I2':
return 'DECIMAL(5)';
case 'I4':
return 'DECIMAL(10)';
case 'I8':
return 'DECIMAL(20)';
case 'F':
return 'DECIMAL';
case 'N':
return 'DECIMAL';
$options =
$this->_Options($options);
$password = isset
($options['PASSWORD']) ?
$options['PASSWORD'] :
'tiger';
$tablespace = isset
($options["TABLESPACE"]) ?
" DEFAULT TABLESPACE ".
$options["TABLESPACE"] :
'';
$sql[] =
"CREATE USER ".
$dbname.
" IDENTIFIED BY ".
$password.
$tablespace;
$sql[] =
"GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO $dbname";
list
($lines,$pkey) =
$this->_GenFields($flds);
$s =
"ALTER TABLE $tabname ADD (";
list
($lines,$pkey) =
$this->_GenFields($flds);
$s =
"ALTER TABLE $tabname MODIFY(";
foreach ($flds as $k =>
$v) $flds[$k] =
$this->NameQuote($v);
$s =
"ALTER TABLE $tabname DROP(";
$s .=
implode(', ',$flds).
') CASCADE CONSTRAINTS';
if (strpos($t,'.') !==
false) {
return "drop sequence ".
$tarr[0].
".seq_".
$tarr[1];
return "drop sequence seq_".
$t;
// return string must begin with space
function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
if ($fdefault ==
"''" &&
$fnotnull) {// this is null in oracle
if ($this->debug) ADOConnection::outp("NOT NULL and DEFAULT='' illegal in Oracle");
if (strlen($fdefault)) $suffix .=
" DEFAULT $fdefault";
if ($fnotnull) $suffix .=
' NOT NULL';
if ($fautoinc) $this->seqField =
$fname;
if ($fconstraint) $suffix .=
' '.
$fconstraint;
CREATE or replace TRIGGER jaddress_insert
before insert on jaddress
select seqaddress.nextval into :new.A_ID from dual;
if ($t !==
false) $tab =
substr($tabname,$t+
1);
$seqname =
$this->schema.
'.'.
$this->seqPrefix.
$tab;
if (isset
($tableoptions['REPLACE'])) $sql[] =
"DROP SEQUENCE $seqname";
if (isset
($tableoptions['SEQUENCE_CACHE'])){$seqCache =
$tableoptions['SEQUENCE_CACHE'];}
if (isset
($tableoptions['SEQUENCE_INCREMENT'])){$seqIncr =
' INCREMENT BY '.
$tableoptions['SEQUENCE_INCREMENT'];}
if (isset
($tableoptions['SEQUENCE_START'])){$seqIncr =
' START WITH '.
$tableoptions['SEQUENCE_START'];}
$sql[] =
"CREATE SEQUENCE $seqname $seqStart $seqIncr $seqCache";
$sql[] =
"CREATE OR REPLACE TRIGGER $trigname BEFORE insert ON $tabname FOR EACH ROW WHEN (NEW.$this->seqField IS NULL OR NEW.$this->seqField = 0) BEGIN select $seqname.nextval into :new.$this->seqField from dual; END;";
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
[table_options] [select_statement]
col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
[PRIMARY KEY] [reference_definition]
or PRIMARY KEY (index_col_name,...)
or KEY [index_name] (index_col_name,...)
or INDEX [index_name] (index_col_name,...)
or UNIQUE [INDEX] [index_name] (index_col_name,...)
or FULLTEXT [INDEX] [index_name] (index_col_name,...)
or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
function _IndexSQL($idxname, $tabname, $flds,$idxoptions)
if ( isset
($idxoptions['REPLACE']) || isset
($idxoptions['DROP']) ) {
$sql[] =
sprintf ($this->dropIndex, $idxname, $tabname);
if ( isset
($idxoptions['DROP']) )
if (isset
($idxoptions['BITMAP'])) {
} elseif (isset
($idxoptions['UNIQUE'])) {
$s =
'CREATE' .
$unique .
' INDEX ' .
$idxname .
' ON ' .
$tabname .
' (' .
$flds .
')';
if ( isset
($idxoptions[$this->upperName]) )
$s .=
$idxoptions[$this->upperName];
if (isset
($idxoptions['oci8']))
$s .=
$idxoptions['oci8'];
$table =
$this->connection->qstr($table);
$col =
$this->connection->qstr($col);
return "select comments from USER_COL_COMMENTS where TABLE_NAME=$table and COLUMN_NAME=$col";
$cmt =
$this->connection->qstr($cmt);
return "COMMENT ON COLUMN $table.$col IS $cmt";
Documentation generated on Sun, 09 Mar 2008 23:51:33 -0300 by phpDocumentor 1.4.0