Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3956750
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:24:13+00:00 2026-05-20T02:24:13+00:00

So, annoyingly, the PDO_SQLSRV driver from Microsoft returns -1 on any rowCount() call from

  • 0

So, annoyingly, the PDO_SQLSRV driver from Microsoft returns -1 on any rowCount() call from a SELECT query with non-scrollable cursors.

Further adding to the annoyance, the default cursor type is _FORWARD, meaning that I am seemingly having to add attributes to every prepared statement where I may need to get a row count back (in this app, that’s A LOT) as below. This is unacceptable, as some of the database engines we will be using do not support scrollable cursors.

$pdo->prepare("SELECT x FROM y", array(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL));

Curiously this does not seem to work with PDO::query()…

Edit:
As below, I’ve also tried PDO::setAttribute() and adding the option to PDO::__construct(), but neither throw exceptions or errors, or seem to actually do anything!

My question to you all is: is there a way to set the default cursor type to CURSOR_SCROLL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:24:13+00:00Added an answer on May 20, 2026 at 2:24 am

    What about:

    $pdo->setAttribute(PDO::ATTR_CURSOR, PDO::CURSOR_SCROLL);
    

    ?

    Also you can extend base PDO class with your own, with prepare method overriden:

    class MyPdo extends PDO
    {
        public function prepare($statement, $options = array())
        {
            if (empty($options)) $options = array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);
            return parent::prepare($statement, $options);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Two snippets of MySQL: SELECT * FROM annoyingly_long_left_hand_table LEFT JOIN annoyingly_long_right_hand_table ON annoyingly_long_left_hand_table.id =
I am trying to run this simple SELECT query using PDO::MySQL, but it does
I'm developing a Cocoa/Objective C application that reads the active document from any application
I'm trying to call a JBoss service from a C# program and I'm getting
I get an annoyingly vague error from the following code: GFree2AppDelegate *delegate = [[UIApplication
Our build is annoyingly slow. It's a Java system built with Ant , and
I am using tinyMCE and, rather annoyingly, it replaces all of my apostrophes with
I've been following Microsoft's guide for installing a dev environment on Windows 7: http://msdn.microsoft.com/en-us/library/ee554869.aspx
I can access my variable stored in a backing bean from my JSF2 page,
Annoyingly enough, setting the cssClass property of an ASP.NET checkbox control renders HTML like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.