[Zope-DB] roll back

Maslak, Michael Michael.Maslak at gdit.com
Tue Aug 29 16:42:56 EDT 2006


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

 

DTML method:

 

...

<dtml-try>

  <dtml-call "insertMAT(mat_id = '18',  mat_name = 'This string is too
long for the attribute',)">

<dtml-except>

  <dtml-raise MAT_SQL_FAILURE> <dtml-var error_value></dtml-raise>

</dtml-try>

...

 

---------

insertMAT  ZSQL method:

 

BEGIN TRANSACTION

insert into mat1 (mat_id)

values (<dtml-sqlvar mat_id type=int>);

 

insert into mat2 (mat_id, mat_name)

values (<dtml-sqlvar mat_id type=int>, <dtml-sqlvar mat_name
type=string>);

 

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.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-db/attachments/20060829/fd42916d/attachment.htm


More information about the Zope-DB mailing list