Changeset 34 for trunk/phpgwapi/inc/adodb/datadict/datadict-mysql.inc.php
- Timestamp:
- 06/29/07 15:17:46 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/adodb/datadict/datadict-mysql.inc.php
r2 r34 2 2 3 3 /** 4 V4. 51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.4 V4.94 23 Jan 2007 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 5 5 Released under both BSD license and Lesser GPL library license. 6 6 Whenever there is any discrepancy between the two licenses, … … 21 21 22 22 var $dropIndex = 'DROP INDEX %s ON %s'; 23 var $renameColumn = 'ALTER TABLE %s CHANGE COLUMN %s %s %s'; // needs column-definition! 23 24 24 25 function MetaType($t,$len=-1,$fieldobj=false) … … 29 30 $len = $fieldobj->max_length; 30 31 } 32 $is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->auto_increment; 31 33 32 34 $len = -1; // mysql max_length is not accurate … … 66 68 67 69 case 'INT': 68 case 'INTEGER': return (!empty($fieldobj->primary_key))? 'R' : 'I';69 case 'TINYINT': return (!empty($fieldobj->primary_key))? 'R' : 'I1';70 case 'SMALLINT': return (!empty($fieldobj->primary_key))? 'R' : 'I2';71 case 'MEDIUMINT': return (!empty($fieldobj->primary_key))? 'R' : 'I4';72 case 'BIGINT': return (!empty($fieldobj->primary_key))? 'R' : 'I8';70 case 'INTEGER': return $is_serial ? 'R' : 'I'; 71 case 'TINYINT': return $is_serial ? 'R' : 'I1'; 72 case 'SMALLINT': return $is_serial ? 'R' : 'I2'; 73 case 'MEDIUMINT': return $is_serial ? 'R' : 'I4'; 74 case 'BIGINT': return $is_serial ? 'R' : 'I8'; 73 75 default: return 'N'; 74 76 } … … 79 81 switch(strtoupper($meta)) { 80 82 case 'C': return 'VARCHAR'; 81 case 'XL': 82 case 'X': return ' LONGTEXT';83 case 'XL':return 'LONGTEXT'; 84 case 'X': return 'TEXT'; 83 85 84 86 case 'C2': return 'VARCHAR'; … … 92 94 93 95 case 'R': 96 case 'I4': 94 97 case 'I': return 'INTEGER'; 95 98 case 'I1': return 'TINYINT'; 96 99 case 'I2': return 'SMALLINT'; 97 case 'I4': return 'MEDIUMINT';98 100 case 'I8': return 'BIGINT'; 99 101
Note: See TracChangeset
for help on using the changeset viewer.