Re: [Zope-DB] roll back

2006-08-29 Thread Charlie Clark
Am 30.08.2006, 00:44 Uhr, schrieb Maslak, Michael  
<[EMAIL PROTECTED]>:



Did what you suggested. That is, removed the BEGIN TRANSACTION & COMMIT
TRANSACTION statements. It has the same behavior: a non-atomic commit.
No roll back. mat1 has a new record mat2 errors.


Please keep your reply on list.



   

I don't use DTML - but if your DTML maps to a
try:
this()
except:
that()

Then you are still acting outside the Zope transactional management! I  
suggest you rewrite your code to use two ZSQL methods and call them from a  
PythonScript

simply
context.mat_1()
content.mat_2()

It's easier than you think.

Charlie
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] roll back

2006-08-29 Thread Charlie Clark
Am 30.08.2006, 00:35 Uhr, schrieb Maslak, Michael  
<[EMAIL PROTECTED]>:



It is allowing a record to be committed in mat1 even as mat2 fails.
There is no roll back happening.


Normally, if you leave the transaction management to Zope and the RDBMS  
can manage it, then all transactions will indeed be rolled back by Zope if  
one fails. So, remove the transactional logic from your ZSQL and your  
problems should be over.


Charlie
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] roll back

2006-08-29 Thread Charlie Clark
Am 29.08.2006, 22:42 Uhr, schrieb Maslak, Michael  
<[EMAIL PROTECTED]>:



Can you please correct my mistake or my
misunderstanding?


Yes, you don't need to explicitly start and commit transactions in ZSQL as  
Zoep does this for you.


Charlie
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


[Zope-DB] roll back

2006-08-29 Thread Maslak, Michael








I'm using MS SQL Server 2000 and eGenix mxODBC on W2K3
platform with Zope 2.7.5.

 

DTML method:

 

…



  



  




…

 

-

insertMAT  ZSQL method:

 

BEGIN TRANSACTION

insert into mat1 (mat_id)

values ();

 

insert into mat2 (mat_id, mat_name)

values (, );

 

COMMIT TRANSACTION;

 

 

Renders the error:

Error Message:('22001', 8152, '[Microsoft][ODBC SQL Server Driver][SQL
Server]String or binary data would be truncated.', 4721)

 

The error occurs in the insert into mat2 where mat_name is
too long. But the first insert into mat1 is being written and committed.

 

I understood the entire transaction would be rolled back,
either by Zope as a result of the exception or by MS SQL since the two inserts
are written as a single transaction. Can you please correct my mistake or my
misunderstanding?

 

Thank you,

 

Michael Maslak, Jr.

 






___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db