Re: rowcount not available? [NC]

Cedric ROUVRAIS <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <OF32163121.359C45A7-ON85257612.004E7E55-85257612.004F3BD8@us.world.socgen>
Hi Alex,

I am reporting a bug in the dblib.c because the function dbcount(DBPROCESS
* dbproc) returns -1 instead of returning the number of rows affected. So
this is not a MS Sql issue but a problem in FreeTDS/dblib

The problem can be seen at the bsqldb.c function with this code:

            /*
             * Get row count, if available.
             */
            if (!options.fquiet) {
                  if (DBCOUNT(dbproc) > -1) {
                        fprintf(options.output, "(%d rows affected)\n",
DBCOUNT(dbproc));
                  }
                  // Removed the following code in order to replicate
SYBASE ISQL behaviour.
                  //else fprintf(stderr, "@@rowcount not available\n");
            }

I commented out the fprintf in my code to replicate the behaviour of ISQL
from Sybase, however the statement is incorrect in the sense that the value
of @@rowcount is available and set correctly (I checked this by doing
select @@ROWCOUNT in bsqldb and it correctly returned 10).

Hopes this clarifies,

Cedric



|------------------------------                                            
|            "Mittel,                                                      
|            Alexander"                                                    
|            <Alexander.Mittel                                             
|            @siemens.com>                                                 
|            Sent by:                                                      
|            freetds-bounces@l                                             
|            ists.ibiblio.org                                              
|                                                                          
|                                                                          
|            08/14/2009 01:41                                              
|            AM                                                            
|                                                                          
|                                                                          
|            Please respond to                                             
|                 FreeTDS                                                  
|            Development Group                                             
|            <[email protected]                                             
|               iblio.org>                                                 
|                                                                          
|                                                                          
                                                                           
                                                                           
                                                                        To 
                                               FreeTDS Development Group   
                                               <[email protected]> 
                                                                        cc 
                                                                           
                                                                   Subject 
                                               Re: [freetds] rowcount not  
                                               available? [NC]             
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





Hi,
this is a FreeTDS-mailing list, not a SQLServer-forum :-)

But: "set rowcount nn" is something completly different then "@@ROWCOUNT".
"set rowcount 10" limits the number of returned rows when doing a SELECT.
If a table has 20 rows then only 10 rows will be returned.
"@@ROWCOUNT" is set by SQLServer and contains the number of affected rows,
i.e. with UPDATE
Maybe look at MS doc to see
Mfg Alexander


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Cedric ROUVRAIS
Gesendet: Donnerstag, 13. August 2009 21:33
An: FreeTDS Development Group
Betreff: [freetds] rowcount not available? [NC]



Hi,

Me again, anybody have any clues? When I execute select @@ROWCOUNT I get
the correct count that is to say. Why would the rowcount not be available ?

a++ Cedric
__________________

Hi guys,

I have come across an interesting behaviour with SQL Server 2008, when you
use the instruction: "set rowcount nn" such as "set rowcount 10" then
DBCOUNT(dbproc) returns -1.

Anyone have any ideas???

Thanks,

Cedric
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds



*************************************************************************
This message and any attachments (the "message") are confidential, intended 
solely for the addressee(s), and may contain legally privileged information.  
Any unauthorised use or dissemination is prohibited.  E-mails are susceptible 
to alteration.  Neither SOCIETE GENERALE nor any of its subsidiaries or 
affiliates shall be liable for the message if altered, changed or falsified.
*************************************************************************
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.