X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=interfaces%2Fpostgresql%2Fpostgresql-sql.cl;h=7e9d6e89a4051d5bedf0f8ea86ba4443707d2c9b;hb=f5b810d17ae9c5898222b179869912f9736b97b2;hp=809507c2e341e04752671612bc9faf432d962da5;hpb=f8478421f5a0440246f70aa4234ff25f416be7e3;p=clsql.git diff --git a/interfaces/postgresql/postgresql-sql.cl b/interfaces/postgresql/postgresql-sql.cl index 809507c..7e9d6e8 100644 --- a/interfaces/postgresql/postgresql-sql.cl +++ b/interfaces/postgresql/postgresql-sql.cl @@ -8,7 +8,7 @@ ;;;; Original code by Pierre R. Mai ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: postgresql-sql.cl,v 1.15 2002/04/27 20:58:11 kevin Exp $ +;;;; $Id: postgresql-sql.cl,v 1.16 2002/05/10 08:05:48 marc.battyani Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai @@ -285,23 +285,22 @@ (lo-create (database-conn-ptr database) (logior postgresql::+INV_WRITE+ postgresql::+INV_READ+))) -;; (MB)the begin/commit/rollback stuff will be removed when with-transaction wil be implemented -(defmethod database-write-large-object ( object-id (data string) (database postgresql-database)) +(defmethod database-write-large-object (object-id (data string) (database postgresql-database)) (let ((ptr (database-conn-ptr database)) (length (length data)) (result nil) (fd nil)) - (unwind-protect - (progn - (database-execute-command "begin" database) - (setf fd (lo-open ptr object-id postgresql::+INV_WRITE+)) - (when (>= fd 0) - (when (= (lo-write ptr fd data length) length) - (setf result t)))) - (progn - (when (and fd (>= fd 0)) - (lo-close ptr fd)) - (database-execute-command (if result "commit" "rollback") database))) + (with-transaction (:database database) + (unwind-protect + (progn + (setf fd (lo-open ptr object-id postgresql::+INV_WRITE+)) + (when (>= fd 0) + (when (= (lo-write ptr fd data length) length) + (setf result t)))) + (progn + (when (and fd (>= fd 0)) + (lo-close ptr fd)) + ))) result)) ;; (MB) the begin/commit/rollback stuff will be removed when with-transaction wil be implemented