[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * $Id: DBSybase.php 286 2005-11-25 17:12:29Z hans $ 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 * This is used to connect to a Sybase database using Sybase's 27 * Creole driver. 28 * 29 * <B>NOTE:</B><I>Currently JConnect does not implement the required 30 * methods for ResultSetMetaData, and therefore the village API's may 31 * not function. For connection pooling, everything works.</I> 32 * 33 * @author Hans Lellelid <hans@xmpl.org> (Propel) 34 * @author Jeff Brekke <ekkerbj@netscape.net> (Torque) 35 * @version $Revision: 286 $ 36 * @package propel.adapter 37 */ 38 class DBSybase extends DBAdapter { 39 40 /** 41 * This method is used to ignore case. 42 * 43 * @param in The string to transform to upper case. 44 * @return The upper case string. 45 */ 46 public function toUpperCase($in) 47 { 48 return "UPPER(" . $in . ")"; 49 } 50 51 /** 52 * This method is used to ignore case. 53 * 54 * @param in The string whose case to ignore. 55 * @return The string in a case that can be ignored. 56 */ 57 public function ignoreCase($in) 58 { 59 return "UPPER(" . $in . ")"; 60 } 61 62 /** 63 * Returns SQL which concatenates the second string to the first. 64 * 65 * @param string String to concatenate. 66 * @param string String to append. 67 * @return string 68 */ 69 public function concatString($s1, $s2) 70 { 71 return "($s1 + $s2)"; 72 } 73 74 /** 75 * Returns SQL which extracts a substring. 76 * 77 * @param string String to extract from. 78 * @param int Offset to start from. 79 * @param int Number of characters to extract. 80 * @return string 81 */ 82 public function subString($s, $pos, $len) 83 { 84 return "SUBSTRING($s, $pos, $len)"; 85 } 86 87 /** 88 * Returns SQL which calculates the length (in chars) of a string. 89 * 90 * @param string String to calculate length of. 91 * @return string 92 */ 93 public function strLength($s) 94 { 95 return "LEN($s)"; 96 } 97 98 /** 99 * Locks the specified table. 100 * 101 * @param Connection $con The Creole connection to use. 102 * @param string $table The name of the table to lock. 103 * @throws SQLException No Statement could be created or executed. 104 */ 105 public function lockTable(Connection $con, $table) 106 { 107 $statement = $con->createStatement(); 108 $sql = "SELECT next_id FROM " . $table . " FOR UPDATE"; 109 $statement->executeQuery($sql); 110 } 111 112 /** 113 * Unlocks the specified table. 114 * 115 * @param Connection $con The Creole connection to use. 116 * @param string $table The name of the table to unlock. 117 * @throws SQLException No Statement could be created or executed. 118 */ 119 public function unlockTable(Connection $con, $table) 120 { 121 // Tables in Sybase are unlocked when a commit is issued. The 122 // user may have issued a commit but do it here to be sure. 123 $con->commit(); 124 } 125 126 /** 127 * @see DBAdapter::quoteIdentifier() 128 */ 129 public function quoteIdentifier($text) 130 { 131 return '[' . $text . ']'; 132 } 133 }
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 |