[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * $Id: DBOracle.php 64 2005-05-13 02:43:56Z root $ 5 * 6 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 7 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 8 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 9 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 10 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 11 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 12 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 13 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 14 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 16 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 * 18 * This software consists of voluntary contributions made by many individuals 19 * and is licensed under the LGPL. For more information please see 20 * <http://propel.phpdb.org>. 21 */ 22 23 require_once 'propel/adapter/DBAdapter.php'; 24 25 /** 26 * Oracle adapter. 27 * 28 * @author David Giffin <david@giffin.org> (Propel) 29 * @author Hans Lellelid <hans@xmpl.org> (Propel) 30 * @author Jon S. Stevens <jon@clearink.com> (Torque) 31 * @author Brett McLaughlin <bmclaugh@algx.net> (Torque) 32 * @author Bill Schneider <bschneider@vecna.com> (Torque) 33 * @author Daniel Rall <dlr@finemaltcoding.com> (Torque) 34 * @version $Revision: 64 $ 35 * @package propel.adapter 36 */ 37 class DBOracle extends DBAdapter { 38 39 /** 40 * This method is used to ignore case. 41 * 42 * @param string $in The string to transform to upper case. 43 * @return string The upper case string. 44 */ 45 public function toUpperCase($in) 46 { 47 return "UPPER(" . $in . ")"; 48 } 49 50 /** 51 * This method is used to ignore case. 52 * 53 * @param string $in The string whose case to ignore. 54 * @return string The string in a case that can be ignored. 55 */ 56 public function ignoreCase($in) 57 { 58 return "UPPER(" . $in . ")"; 59 } 60 61 /** 62 * Returns SQL which concatenates the second string to the first. 63 * 64 * @param string String to concatenate. 65 * @param string String to append. 66 * @return string 67 */ 68 public function concatString($s1, $s2) 69 { 70 return "CONCAT($s1, $s2)"; 71 } 72 73 /** 74 * Returns SQL which extracts a substring. 75 * 76 * @param string String to extract from. 77 * @param int Offset to start from. 78 * @param int Number of characters to extract. 79 * @return string 80 */ 81 public function subString($s, $pos, $len) 82 { 83 return "SUBSTR($s, $pos, $len)"; 84 } 85 86 /** 87 * Returns SQL which calculates the length (in chars) of a string. 88 * 89 * @param string String to calculate length of. 90 * @return string 91 */ 92 public function strLength($s) 93 { 94 return "LENGTH($s)"; 95 } 96 97 /** 98 * Locks the specified table. 99 * 100 * @param Connection $con The Creole connection to use. 101 * @param string $table The name of the table to lock. 102 * @throws SQLException No Statement could be created or executed. 103 */ 104 public function lockTable(Connection $con, $table) 105 { 106 $statement = $con->createStatement(); 107 $statement->executeQuery("SELECT next_id FROM " . $table ." FOR UPDATE"); 108 } 109 110 /** 111 * Unlocks the specified table. 112 * 113 * @param Connection $con The Creole connection to use. 114 * @param string $table The name of the table to unlock. 115 * @throws SQLException - No Statement could be created or executed. 116 */ 117 public function unlockTable(Connection $con, $table) 118 { 119 // Tables in Oracle are unlocked when a commit is issued. The 120 // user may have issued a commit but do it here to be sure. 121 $con->commit(); 122 } 123 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |