• My posts page displays “no posts found” while right above it, there is “All (1) | Published (1)” (it is a new installation). The post is also invisible on the live site, not only in the administration.

    I guess it might have something to do with my database which is SQL Server using WP Db Abstraction. So I installed debug bar and found this query:

    SELECT TOP 0 * FROM wp_posts WHERE 1=1 AND wp_posts.post_type LIKE ‘post’ AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_status LIKE ‘future’ OR wp_posts.post_status LIKE ‘draft’ OR wp_posts.post_status LIKE ‘pending’ OR wp_posts.post_status LIKE ‘private’) ORDER BY wp_posts.post_date DESC

    WP_Posts_List_Table->prepare_items, wp_edit_posts_query, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, pdo_wpdb->query, pdo_wpdb->_post_query

    SELECT TOP 0 looks suspicious to me, what would you say? If that’s indeed a bug, any suggestion on how to fix it?

    https://www.ads-software.com/extend/plugins/wordpress-database-abstraction/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi borekb

    I have had the same exact issue – I ran SQL Profiler and then refreshed my homepage and discovered the same SQL statement. Its very disappointing to find that I have wasted most of the day trying to get WordPress to run on SQL SERVER!

    As long as that bug stays there it makes this abstraction completely pointless.

    Hello

    I don’t know if you’ve already found the solution but I had found one.

    In the file wp-content\mu-plugins\wp-db-abstraction\translations\sqlsrv\translations.php at line 738 begins the section “Check for true offset.”
    I added the following condition because I realized that the number of elements in $limit_matches was 6 and not 5:

    } elseif ( count($limit_matches) == 6 && $limit_matches[1] == '0' ) {
    			$limit_matches[1] =  $limit_matches[4];

    I chose to add a new condition but I think the other is never used.
    I’m sure.

    Thread Starter Borek Bernard

    (@borekb)

    Thanks for posting a solution, however, this whole DB abstraction thing lost my trust and I went with MySQL. I’m not happy that I needed to install another DB server just to run a blog engine but hopefully it will save some nerves in the future.

    zcaotica, thank you for sharing the solution.

    Like borekb, this incident caused me to abandon the whole DB abstraction thing. Sure, if I try your fix it may solve this problem… but I feel as though something else will break later.

    I realised that WordPress was built for MySQL, and therefore I really should use it, even if it means having to run to DB servers (MSSQL/MySQL).

    WordPress is running just fine now on MySQL, and my server performance has barely taken a hit so I’m happy to continue with this.

    Thanks again all.

    Thank you for posting this solution!!!! I’ve been searching for a fix for this all day!

    @ zcaotica,

    Thank you so much for posting this! I even reinstall my server just for this issue… Wish I could find your post earlier.

    Just found another way to fix this issue.

    Because I found in 1.1.3, the same $limit_matches equations worked, so I read the changelog and I think is the line 726:

    $pattern = ‘/LIMIT\s*(\d+)((\s*,?\s*)(\d+)*)(;{0,1})$/is’;

    should be changed back as 1.1.3:

    $pattern = ‘/LIMIT\s*(\d+)((\s*,?\s*)(\d+)*)$/is’;

    Although it seems to fix the “limit regex to catch queries with ; at the end” issue, but will cause new issue here.

    Yoren,

    Thank you SO MUCH! I beat my head against the wall for an entire day thinking that somehow I had screwed up either the MS SQL install or the Multisite install. Your fix solved the problem! Did you happen to submit a bug report to the plugin owners to let them know this is an issue affecting numerous people?

    @thelievense,

    I found someone has submitted this to bugs tracker: https://sourceforge.net/tracker/?func=detail&aid=3485384&group_id=315685&atid=1328061,
    and he provided another solution about it.

    We too experienced this issue with our new WordPress installation and MS SQL Server.

    We followed the recommendations posted on SourceForge by ‘debettap’. This seems to have fixed the issue for us too.

    Yes!
    The reccommended link by mkrawats to SourceForge fixed my pagination issue, and showing 0 posts in the admin section.
    Thank you!
    Wanted to say this worked for me too.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: WP Db Abstraction] SELECT TOP 0?’ is closed to new replies.