Changeset 429271
- Timestamp:
- 08/26/2011 11:12:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postgresql-for-wordpress/trunk/pg4wp/driver_pgsql.php
r429260 r429271 123 123 } 124 124 global $wpdb; 125 125 126 $logto = 'queries'; 126 127 // This is used to catch the number of rows returned by the last "SELECT" REQUEST … … 198 199 $sql = str_replace( 'post_date_gmt > 1970', 'post_date_gmt > to_timestamp (\'1970\')', $sql); 199 200 201 // Akismet sometimes doesn't write 'comment_ID' with 'ID' in capitals where needed ... 202 if( false !== strpos( $sql, $wpdb->comments)) 203 $sql = str_replace(' comment_id ', ' comment_ID ', $sql); 204 200 205 } // SELECT 201 206 elseif( 0 === strpos($sql, 'UPDATE')) … … 227 232 228 233 // Fix inserts into wp_categories 229 if( false !== strpos($sql, 'INSERT INTO '.$wpdb-> prefix.'categories'))234 if( false !== strpos($sql, 'INSERT INTO '.$wpdb->categories)) 230 235 { 231 236 $sql = str_replace('"cat_ID",', '', $sql); … … 237 242 238 243 // Multiple values group when calling INSERT INTO don't always work 239 if( false !== strpos( $sql, $wpdb-> prefix.'options') && false !== strpos( $sql, '), ('))244 if( false !== strpos( $sql, $wpdb->options) && false !== strpos( $sql, '), (')) 240 245 { 241 246 $pattern = '/INSERT INTO.+VALUES/'; … … 276 281 // This handles removal of duplicate entries in table options 277 282 if( false !== strpos( $sql, 'DELETE o1 FROM ')) 278 $sql = "DELETE FROM $ {table_prefix}options WHERE option_id IN " .279 "(SELECT o1.option_id FROM $ {table_prefix}options AS o1, ${table_prefix}options AS o2 " .283 $sql = "DELETE FROM $wpdb->options WHERE option_id IN " . 284 "(SELECT o1.option_id FROM $wpdb->options AS o1, $wpdb->options AS o2 " . 280 285 "WHERE o1.option_name = o2.option_name " . 281 286 "AND o1.option_id < o2.option_id)"; 287 288 // Akismet sometimes doesn't write 'comment_ID' with 'ID' in capitals where needed ... 289 if( false !== strpos( $sql, $wpdb->comments)) 290 $sql = str_replace(' comment_id ', ' comment_ID ', $sql); 282 291 } 283 292 // Fix tables listing … … 318 327 // Remove illegal characters 319 328 $sql = str_replace('`', '', $sql); 320 321 // Akismet sometimes doesn't write 'comment_ID' with 'ID' in capitals where needed ...322 if( false !== strpos( $sql, $wpdb->prefix.'comments'))323 $sql = str_replace(' comment_id ', ' comment_ID ', $sql);324 329 325 330 // Field names with CAPITALS need special handling … … 376 381 $GLOBALS['pg4wp_result'] = pg_query($sql); 377 382 if( (PG4WP_DEBUG || PG4WP_LOG_ERRORS) && $GLOBALS['pg4wp_result'] === false && $err = pg_last_error()) 378 if( false === strpos($err, 'relation "'.$wpdb-> prefix.'options"'))383 if( false === strpos($err, 'relation "'.$wpdb->options.'"')) 379 384 error_log("Error running :\n$initial\n---- converted to ----\n$sql\n----\n$err\n---------------------\n", 3, PG4WP_LOG.'pg4wp_errors.log'); 380 385
Note: See TracChangeset
for help on using the changeset viewer.