Pessoal, recebi um email sobre o ZcxOracleDA que aindei desenvolvendo com contribuições da Rafahela e agora desse colega...(sei lá de onde) não sei se alguém está usando, mas como ando meio afastado do Zope momentaneamente....se quiserem checar os pontos por ele citado seria uma boa...aliás se alguém quiser colocá-lo em algum repositório...também seria bom....
Abraços...
TOM
 
O email do colega:
---------------------
Hi!

I've just downloaded, installed and run your's product. Looks really
nice :)
I'm using DCOracle2 now but I need to use this on Windows
machines too. Unfortunatelly DCOracle2 fails strangely on Windows
(fatal errors etc.). With your's DA and cxOracle seems that it will
work - I'm testing this right now.

During usage of DCOracle2 I've found and corrected some errors in
it so I think you may want to get to know about these and
verify whether they should be moved to ZcxOracleDA (some of changes
I did may be not necessary or something...).

In SP.py we have __call__ function and it's part looks like that:

---------------------------------------------------------------
        try:
            # Note, this does not do result promotion like the DA query
will
            # which is probably bad.  OracleDates in particular look
like
            # DateTimes but arent at all the same!
            results = apply(self._v_proc,args,kw)
            return results
            #return self._lobConvert(results)
        except:         
            self._v_proc = None           
            raise                          # Reraise error
---------------------------------------------------------------

The problem is when procedure raises an exception.
I've checked this and seems that if we have one Zope request that:
1. Creates a database connection
2. Calls stored procedure which causes exception

  then after exception we'll get something like:

3. rollback point 1 - database connection is removed
4. rollback point 2 - try to call rollback in database......
    but there is no db connection now as it was removed just before.

This does'n happen always, just when DB connection was
created in the same transaction.

Of course you may want to check this yourself and I would
be glad to know whether you may confirm my diagnosis :)

The solution is pretty simple:

---------------------------------------------------------------
        try:
            # Note, this does not do result promotion like the DA query
will
            # which is probably bad.  OracleDates in particular look
like
            # DateTimes but arent at all the same!
            results = apply(self._v_proc,args,kw)
            return results
            #return self._lobConvert(results)
        except:         
            self._abort()
            self._v_proc = None           
            raise                          # Reraise error
---------------------------------------------------------------

just call _abort when catching exception and it will do rollback in
database.

Another changes I've made to DCOracle2:

In SP.py I've changed _register to be like that:
---------------------------------------------------------------
import transaction
def _register(self):
        if not self._registered:
            try:
                #get_transaction().register(Surrogate(self))
                transaction.get().register(Surrogate(self))              
                self._begin()

---------------------------------------------------------------

because get_transaction is deprecated.

I've also added some checking in db.py like:

    def _finish(self, *ignored):
        if self.db:         
            self.db.commit()

    def _abort(self, *ignored):     
        if self.db:         
            self.db.rollback()

because sometimes it happens that self.db is None.


Hope it will be useful for you. Thanks for your work!
Maciej Wisniowski
 

--
Att,
Wilton Souza Alencar
www.tom.pro.br
 
__._,_.___

Para enviar uma mensagem: zope-pt@yahoogrupos.com.br
Para desistir envie uma mensagem em branco para: [EMAIL PROTECTED]




Yahoo! Grupos, um serviço oferecido por:
PUBLICIDADE


Links do Yahoo! Grupos

__,_._,___

Responder a