Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLHelpers.php |
— | — | @@ -61,12 +61,12 @@ |
62 | 62 | * @param DatabaseBase or Database $db |
63 | 63 | * @param $reportTo Object to report back to. |
64 | 64 | */ |
65 | | - public static function setupTable( $tableName, array $fields, $db, $reportTo = null ) { |
66 | | - $tableName = $db->tableName( $tableName ); |
| 65 | + public static function setupTable( $rawTableName, array $fields, $db, $reportTo = null ) { |
| 66 | + $tableName = $db->tableName( $rawTableName ); |
67 | 67 | |
68 | 68 | self::reportProgress( "Checking table $tableName ...\n", $reportTo ); |
69 | 69 | |
70 | | - if ( $db->tableExists( $tableName ) === false ) { // create new table |
| 70 | + if ( $db->tableExists( $rawTableName ) === false ) { // create new table |
71 | 71 | self::reportProgress( " Table not found, now creating...\n", $reportTo ); |
72 | 72 | self::createTable( $tableName, $fields, $db, $reportTo ); |
73 | 73 | self::reportProgress( " ... done.\n", $reportTo ); |
— | — | @@ -163,6 +163,7 @@ |
164 | 164 | global $wgDBtype; |
165 | 165 | |
166 | 166 | if ( $wgDBtype == 'postgres' ) { |
| 167 | + $tableName = str_replace( '"', '', $tableName ); |
167 | 168 | // Use the data dictionary in postgresql to get an output comparable to DESCRIBE. |
168 | 169 | $sql = <<<EOT |
169 | 170 | SELECT |
— | — | @@ -193,9 +194,9 @@ |
194 | 195 | |
195 | 196 | foreach ( $res as $row ) { |
196 | 197 | $type = strtoupper( $row->Type ); |
197 | | - |
| 198 | + |
198 | 199 | if ( $wgDBtype == 'postgres' ) { // postgresql |
199 | | - if ( eregi( '^nextval\\(.+\\)$', $row->Extra ) ) { |
| 200 | + if ( preg_match( '/^nextval\\(.+\\)/i', $row->Extra ) ) { |
200 | 201 | $type = 'SERIAL NOT NULL'; |
201 | 202 | } elseif ( $row->Null != 'YES' ) { |
202 | 203 | $type .= ' NOT NULL'; |
— | — | @@ -220,7 +221,7 @@ |
221 | 222 | |
222 | 223 | $curfields[$row->Field] = $type; |
223 | 224 | } |
224 | | - |
| 225 | + |
225 | 226 | return $curfields; |
226 | 227 | } |
227 | 228 | |