rowcount is pulled directly from the DBAPI cursor and is usually only  
reliable for an UPDATE or DELETE statement.    Feel free to consult on  
the cx_oracle mailing list for why it might return 0 for a one-row  
SELECT statement - my guess would be that no rows were fetched from  
the server.

On Jan 24, 2009, at 3:10 AM, Jose Soares wrote:

>
> Hi all,
> I wonder why there's such difference between oracle and pg:
>
>
> oracle:
>
> (Pdb) engine.connect().execute(sql).fetchone()
>
> select * from ruolo_permesso where cod_ruolo = 'SYSADMIN'  and
> cod_permesso='TIPO_FIGURA' and inserimento='1'
>
> None
> (1273, 'SYSADMIN', 'TIPO_FIGURA', 1, 1, 1, 1)
> (Pdb) engine.connect().execute(sql).rowcount
>
> select * from ruolo_permesso where cod_ruolo = 'SYSADMIN'  and
> cod_permesso='TIPO_FIGURA' and inserimento='1'
>
> None
> 0           <--- zero??!!
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>
> postgres:
>
> (Pdb) engine.connect().execute(sql).fetchone()
>
> select * from ruolo_permesso where cod_ruolo = 'SYSADMIN'  and
> cod_permesso='TIPO_FIGURA' and inserimento='1'
>
> None
> (1533, 'SYSADMIN', 'TIPO_FIGURA', True, True, True, True)
> (Pdb) engine.connect().execute(sql).rowcount
>
> select * from ruolo_permesso where cod_ruolo = 'SYSADMIN'  and
> cod_permesso='TIPO_FIGURA' and inserimento='1'
>
> None
> 1
>
> ---------------------
> j
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to