[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 3 /** 4 V4.50 6 July 2004 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 5 Released under both BSD license and Lesser GPL library license. 6 Whenever there is any discrepancy between the two licenses, 7 the BSD license will take precedence. 8 9 Set tabs to 4 for best viewing. 10 11 Modified from datadict-generic.inc.php for sapdb by RalfBecker-AT-outdoor-training.de 12 */ 13 14 // security - hide paths 15 if (!defined('ADODB_DIR')) die(); 16 17 class ADODB2_sapdb extends ADODB_DataDict { 18 19 var $databaseType = 'sapdb'; 20 var $seqField = false; 21 var $renameColumn = 'RENAME COLUMN %s.%s TO %s'; 22 23 function ActualType($meta) 24 { 25 switch($meta) { 26 case 'C': return 'VARCHAR'; 27 case 'XL': 28 case 'X': return 'LONG'; 29 30 case 'C2': return 'VARCHAR UNICODE'; 31 case 'X2': return 'LONG UNICODE'; 32 33 case 'B': return 'LONG'; 34 35 case 'D': return 'DATE'; 36 case 'T': return 'TIMESTAMP'; 37 38 case 'L': return 'BOOLEAN'; 39 case 'I': return 'INTEGER'; 40 case 'I1': return 'FIXED(3)'; 41 case 'I2': return 'SMALLINT'; 42 case 'I4': return 'INTEGER'; 43 case 'I8': return 'FIXED(20)'; 44 45 case 'F': return 'FLOAT(38)'; 46 case 'N': return 'FIXED'; 47 default: 48 return $meta; 49 } 50 } 51 52 function MetaType($t,$len=-1,$fieldobj=false) 53 { 54 if (is_object($t)) { 55 $fieldobj = $t; 56 $t = $fieldobj->type; 57 $len = $fieldobj->max_length; 58 } 59 static $maxdb_type2adodb = array( 60 'VARCHAR' => 'C', 61 'CHARACTER' => 'C', 62 'LONG' => 'X', // no way to differ between 'X' and 'B' :-( 63 'DATE' => 'D', 64 'TIMESTAMP' => 'T', 65 'BOOLEAN' => 'L', 66 'INTEGER' => 'I4', 67 'SMALLINT' => 'I2', 68 'FLOAT' => 'F', 69 'FIXED' => 'N', 70 ); 71 $type = isset($maxdb_type2adodb[$t]) ? $maxdb_type2adodb[$t] : 'C'; 72 73 // convert integer-types simulated with fixed back to integer 74 if ($t == 'FIXED' && !$fieldobj->scale && ($len == 20 || $len == 3)) { 75 $type = $len == 20 ? 'I8' : 'I1'; 76 } 77 if ($fieldobj->auto_increment) $type = 'R'; 78 79 return $type; 80 } 81 82 // return string must begin with space 83 function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) 84 { 85 $suffix = ''; 86 if ($funsigned) $suffix .= ' UNSIGNED'; 87 if ($fnotnull) $suffix .= ' NOT NULL'; 88 if ($fautoinc) $suffix .= ' DEFAULT SERIAL'; 89 elseif (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; 90 if ($fconstraint) $suffix .= ' '.$fconstraint; 91 return $suffix; 92 } 93 94 function AddColumnSQL($tabname, $flds) 95 { 96 $tabname = $this->TableName ($tabname); 97 $sql = array(); 98 list($lines,$pkey) = $this->_GenFields($flds); 99 return array( 'ALTER TABLE ' . $tabname . ' ADD (' . implode(', ',$lines) . ')' ); 100 } 101 102 function AlterColumnSQL($tabname, $flds) 103 { 104 $tabname = $this->TableName ($tabname); 105 $sql = array(); 106 list($lines,$pkey) = $this->_GenFields($flds); 107 return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(', ',$lines) . ')' ); 108 } 109 110 function DropColumnSQL($tabname, $flds) 111 { 112 $tabname = $this->TableName ($tabname); 113 if (!is_array($flds)) $flds = explode(',',$flds); 114 foreach($flds as $k => $v) { 115 $flds[$k] = $this->NameQuote($v); 116 } 117 return array( 'ALTER TABLE ' . $tabname . ' DROP (' . implode(', ',$flds) . ')' ); 118 } 119 } 120 121 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |