[DB-SIG] problems with DCOracle2 running on solaris 8 (oracle 8.1.6)

Andy Todd andy47@halfcooked.com
Tue, 28 Jan 2003 11:52:33 +0000


On Tue, Jan 28, 2003 at 12:15:58PM +0100, Molina Carron wrote:
> Right, this should help.
> 
> My data (just a row):
> CD_CAMINO                      2
> CD_TRAMITE                      Registro
> CD_OPERACION               13800
> CONDICION                       ANIO_EXP_FISCALIA & '' # ''
> CD_ACCION                       X>X
> PARAMETRO1                    ANIO_EXP_FISCALIA
> PARAMETRO2                    x
> PARAMETRO3
> PARAMETRO4
> ----------------------------------------------------------------------------
> ----------------------------
> My problem:
> *I get different values for the field Parametro2 depending on how i access
> to it: if my query is:
>     select * from rm_tra_acciones where cd_tramite=:p1 and cd_camino=:p2,
> (2, 'Registro',)
> it returns a lot of rows, and, when i move to the one above, and ask for my
> field Parametro2 it returns None (wrong!)
> 
> *On the other hand, if my query is:
> select * from rm_tra_acciones where cd_tramite=:p1 and cd_camino=:p2 and
> cd_operacion=:p3,
> (2, 'Registro',13800,)
> and ask my field, it returns x (correct!)
> 
> *sqlplus works fine
> 
> *No error messagges are returned
> 
> *I get data from every query, but not every data is good
> ----------------------------------------------------------------------------
> ----------------------
> 
> My python code:
> def test():
>     sql=[''' select * from rm_tra_acciones
>             where cd_tramite=:p1 and cd_camino=:p2
>         ''',
>         ''' select * from rm_tra_acciones
>             where cd_tramite=:p1 and cd_camino=:p2 and cd_operacion=:p3
>         ''']
>     params=[('Registro', 2,),('Registro', 2,13800,)]
> 
>     import DCOracle2
>     cadenaConn='%s/%s@%s'% ('menores','menores','datos10k')
>     conn=DCOracle2.connect(cadenaConn)
> 
>     print 'test1'
>     cur=conn.cursor()
>     cur.execute(sql[0],params[0])
> 
>     rs = cur.fetchall()
> 
>     print rs[41] ##the row
> 
>     print 'test2'
>     cur=conn.cursor()
>     cur.execute(sql[1],params[1])
>     print cur.fetchall()[0]
> ----------------------------------------------------------------------------
> --------------------------------
> The results:
> >python -u etcPythonOracle.py
> test1
> [2L, 'Registro', 13800L, "ANIO_EXP_FISCALIA & '' # ''", 'X>X',
> 'ANIO_EXP_FISCALIA', None, None, None]
> test2
> [2L, 'Registro', 13800L, "ANIO_EXP_FISCALIA & '' # ''", 'X>X',
> 'ANIO_EXP_FISCALIA', 'x', None, None]
> >Exit code: 0
> 
> 
> Thanks
> 
> 

My first impression is that this is a data issue and nothing to do with the db module or database. Are you sure that both of your queries are returning the same row? It looks like they are not.

In test1 you are only restricting by cd_tramite and cd_camino but in test2 you add the cd_operacion column to the where clause. What happens if you include the ROWID pseudo column in your results sets, are they the same?

The only other thing I can think of, and it is a long shot, is that you are not comparing the same columns. Whilst performing a 'SELECT *' is more than likely going to return the same columns in the same order each time you execute a query there is absolutely no guarantee that this is true. I would change your select clauses to ONLY return the columns of interest in this particular case and eliminate this possibility even though it is fairly unlikely to be the cause of your distress.

Regards,
Andy
-- 
--------------------------------------------------------------------------------
>From the desk of Andrew J Todd esq
http://www.halfcooked.com/