title: One of the SELECT fails using unixOdbc - SQLSTATE[24000]: Invalid cursor state
body: <p>I am running Ubuntu 13.10 with FreeTDS and ODBC (package: php5-odbc) installed.
  I use tds version = 8.0, but also tried tds version = 7.2.</p>
  
  <p>I am using PDO and this is my DSN:</p>
  
  <pre><code>$dsn = sprintf('odbc:Driver=FreeTDS;Server=%s;Port=1433;Database=%s', DB_SQL_SERVERNAME, DB_DB_NAME);
  </code></pre>
  
  <p>I connect to MSSQL instance and perform some INSERT/SELECT queries using transactions, however I can not figure out why this query fails:</p>
  
  <pre><code>SELECT id 
  FROM tblColumns 
  WHERE siteID = 10063 AND 
      typeID = 1000 AND 
      extendedTypeID = 18 AND 
      label = 'RwThiFc85A'
  </code></pre>
  
  <p>giving error:</p>
  
  <blockquote>
    <p>SQLSTATE[24000]: Invalid cursor state: 0 [FreeTDS][SQL Server]Invalid
    cursor state     (SQLExecute[0] at
    /build/buildd/php5-5.5.3+dfsg/ext/pdo_odbc/odbc_stmt.c:254)</p>
  </blockquote>
  
  <p>I am running bunches of similiar queries before and they are performed well, e.g.:</p>
  
  <pre><code>SELECT id 
  FROM tblColumns 
  WHERE siteID = 10063 AND 
      typeID = 1000 AND 
      extendedTypeID = 3 AND 
      label = 'VwThiFc91B'
  </code></pre>
  
  <p>Do you have ideas why it happens?</p>
  
  <p>I did not have such a issues with dblib and sqlsrv, however now I am on Unix and can not use sqlsrv, and due to issues with dblib UTF-8 encoding I am trying to use ODBC.</p>