Changeset 429284
- Timestamp:
- 08/27/2011 12:35:29 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postgresql-for-wordpress/trunk/pg4wp/driver_pgsql_install.php
r429283 r429284 81 81 $sql = $newq; 82 82 } 83 $pattern = '/ALTER TABLE\s+(\w+)\s+ADD COLUMN\s+([^\s]+)\s+([^ ]+)( unsigned|)\s+(NOT NULL|)\s*(default (.+)|)/'; 84 if( 1 === preg_match( $pattern, $sql, $matches)) 85 { 86 $table = $matches[1]; 87 $col = $matches[2]; 88 $type = $matches[3]; 89 if( isset($GLOBALS['pg4wp_ttr'][$type])) 90 $type = $GLOBALS['pg4wp_ttr'][$type]; 91 $unsigned = $matches[4]; 92 $notnull = $matches[5]; 93 $default = $matches[6]; 94 $defval = $matches[7]; 95 if( isset($GLOBALS['pg4wp_ttr'][$defval])) 96 $defval = $GLOBALS['pg4wp_ttr'][$defval]; 97 $newq = "ALTER TABLE $table ADD COLUMN $col $type"; 98 if( !empty($default)) 99 $newq .= " DEFAULT $defval"; 100 if( !empty($notnull)) 101 $newq .= " NOT NULL"; 102 $sql = $newq; 103 } 83 104 $pattern = '/ALTER TABLE\s+(\w+)\s+ADD (UNIQUE |)KEY\s+([^\s]+)\s+\(([^\)]+)\)/'; 84 105 if( 1 === preg_match( $pattern, $sql, $matches))
Note: See TracChangeset
for help on using the changeset viewer.