[freetds] begin atomic in procedures

Petr ZEMAN petrz at aswsyst.cz
Wed Nov 23 11:09:43 EST 2005


Good afternoon.

I have a problem with atomic statement in sybase ASA and FreeTDS. When it's used in procedures called from PHP by freetds, it ends with "Error -267: COMMIT/ROLLBACK not allowed within atomic operation"

I use:
Adaptive Server Anywhere Network Server Version 9.0.2.3182
FreeTDS 0.62.3 (I tried 0.63 too)
PHP 5.0.4-pl3-gentoo:

Sybase_CT Support => enabled
Active Persistent Links => 0
Active Links => 0
Min server severity => 10
Min client severity => 10
Application Name => PHP 5.0.4-pl3-gentoo
Deadlock retry count => -1

Directive => Local Value => Master Value
sybct.allow_persistent => On => On
sybct.deadlock_retry_count => Unlimited => Unlimited
sybct.hostname => no value => no value
sybct.login_timeout => -1 => -1
sybct.max_links => Unlimited => Unlimited
sybct.max_persistent => Unlimited => Unlimited
sybct.min_client_severity => 10 => 10
sybct.min_server_severity => 10 => 10

Linux 2.6.13-gentoo-r5 #1 SMP Wed Nov 2 10:12:28 CET 2005 i686 Intel(R) Celeron(R) CPU 2.40GHz GenuineIntel GNU/Linux

Replication of problem:
Create new empty DB.
Create table 'test' with one integer colum 'id'.
Add any row to table 'test'
Create procedure test:

CREATE PROCEDURE test()
BEGIN
  begin atomic 
    message 'Entered Inner';
      update test set id=id+1; 
      exception
        when others then
          message 'Error INNER', @@error,' text: ', errormsg(); 
    message 'Leaving Inner';
  end;
END

When I call test() from sybase interactive sql, all is ok.
When I call it from php via freetds, ends with:
Error -267: COMMIT/ROLLBACK not allowed within atomic operation

freetds.conf:
[global]
  tds version = 5.0
  dump file = /tmp/freetds.log
  debug level = 1
  text size = 64512
[TESTDB]
  host = localhost
  port = 2638
  client charset = UTF-8
  tds version = 5.0

As DB layer I use PEAR:DB.
Before call of test() I only set:
  SET TEMPORARY OPTION CONNECTION_AUTHENTICATION = 'Company=...;Application=...;Signature=...'
  SET TEMPORARY OPTION ON_TSQL_ERROR = 'STOP'

When I remove 'atomic' from procedure test(), all is OK.

Thank you in advance for any help

-- 
Regards
Petr ZEMAN

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20051123/3ddc9481/attachment.bin


More information about the FreeTDS mailing list