| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
class DBOracle extends DBAdapter { |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
* This method is used to ignore case. |
|---|
| 39 |
* |
|---|
| 40 |
* @param string $in The string to transform to upper case. |
|---|
| 41 |
* @return string The upper case string. |
|---|
| 42 |
*/ |
|---|
| 43 |
public function toUpperCase($in) |
|---|
| 44 |
{ |
|---|
| 45 |
return "UPPER(" . $in . ")"; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
* This method is used to ignore case. |
|---|
| 50 |
* |
|---|
| 51 |
* @param string $in The string whose case to ignore. |
|---|
| 52 |
* @return string The string in a case that can be ignored. |
|---|
| 53 |
*/ |
|---|
| 54 |
public function ignoreCase($in) |
|---|
| 55 |
{ |
|---|
| 56 |
return "UPPER(" . $in . ")"; |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
* Returns SQL which concatenates the second string to the first. |
|---|
| 61 |
* |
|---|
| 62 |
* @param string String to concatenate. |
|---|
| 63 |
* @param string String to append. |
|---|
| 64 |
* @return string |
|---|
| 65 |
*/ |
|---|
| 66 |
public function concatString($s1, $s2) |
|---|
| 67 |
{ |
|---|
| 68 |
return "CONCAT($s1, $s2)"; |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
* Returns SQL which extracts a substring. |
|---|
| 73 |
* |
|---|
| 74 |
* @param string String to extract from. |
|---|
| 75 |
* @param int Offset to start from. |
|---|
| 76 |
* @param int Number of characters to extract. |
|---|
| 77 |
* @return string |
|---|
| 78 |
*/ |
|---|
| 79 |
public function subString($s, $pos, $len) |
|---|
| 80 |
{ |
|---|
| 81 |
return "SUBSTR($s, $pos, $len)"; |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
* Returns SQL which calculates the length (in chars) of a string. |
|---|
| 86 |
* |
|---|
| 87 |
* @param string String to calculate length of. |
|---|
| 88 |
* @return string |
|---|
| 89 |
*/ |
|---|
| 90 |
public function strLength($s) |
|---|
| 91 |
{ |
|---|
| 92 |
return "LENGTH($s)"; |
|---|
| 93 |
} |
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
* @see DBAdapter::applyLimit() |
|---|
| 97 |
*/ |
|---|
| 98 |
public function applyLimit(&$sql, $offset, $limit) |
|---|
| 99 |
{ |
|---|
| 100 |
$sql = |
|---|
| 101 |
'SELECT B.* FROM ( ' |
|---|
| 102 |
. 'SELECT A.*, rownum AS PROPEL$ROWNUM FROM ( ' |
|---|
| 103 |
. $sql |
|---|
| 104 |
. ' ) A ' |
|---|
| 105 |
. ' ) B WHERE '; |
|---|
| 106 |
|
|---|
| 107 |
if ( $offset > 0 ) { |
|---|
| 108 |
$sql .= ' B.PROPEL$ROWNUM > ' . $offset; |
|---|
| 109 |
|
|---|
| 110 |
if ( $limit > 0 ) |
|---|
| 111 |
{ |
|---|
| 112 |
$sql .= ' AND B.PROPEL$ROWNUM <= ' |
|---|
| 113 |
. ( $offset + $limit ); |
|---|
| 114 |
} |
|---|
| 115 |
} else { |
|---|
| 116 |
$sql .= ' B.PROPEL$ROWNUM <= ' . $limit; |
|---|
| 117 |
} |
|---|
| 118 |
} |
|---|
| 119 |
|
|---|
| 120 |
protected function getIdMethod() |
|---|
| 121 |
{ |
|---|
| 122 |
return DBAdapter::ID_METHOD_SEQUENCE; |
|---|
| 123 |
} |
|---|
| 124 |
|
|---|
| 125 |
public function getId(PDO $con, $name = null) |
|---|
| 126 |
{ |
|---|
| 127 |
if ($name === null) { |
|---|
| 128 |
throw new PropelException("Unable to fetch next sequence ID without sequence name."); |
|---|
| 129 |
} |
|---|
| 130 |
|
|---|
| 131 |
$stmt = $con->query("SELECT " . $name . ".nextval FROM dual"); |
|---|
| 132 |
$row = $stmt->fetch(PDO::FETCH_NUM); |
|---|
| 133 |
|
|---|
| 134 |
return $row[0]; |
|---|
| 135 |
} |
|---|
| 136 |
|
|---|
| 137 |
public function random($seed=NULL) |
|---|
| 138 |
{ |
|---|
| 139 |
return 'dbms_random.value'; |
|---|
| 140 |
} |
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
} |
|---|
| 144 |
|
|---|