gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnumed-devel] new functions in gmPG


From: Ian Haywood
Subject: [Gnumed-devel] new functions in gmPG
Date: Tue, 23 Sep 2003 02:29:03 -0400
User-agent: Mutt/1.3.28i

I have committed run_select () and run_commit () into gmPG.

The sole purpose of these functions is to turn this:
        def _get_medical_age(self):
                curs = self._defconn_ro.cursor()
                cmd = "select dob from identity where id = %s"
                try:
                        curs.execute(cmd, self.ID)
                except:
                        curs.close()
                        _log.LogException('>>>%s<<< failed' % (cmd % self.ID), 
sys.exc_info())
                        return None
                data = curs.fetchone()
                curs.close()

                if data is None:
                        return '??'
                return get_medical_age(data[0])

into this:
        def _get_medical_age (self):
                data = gmPG.run_select ("demographica", "select dob from 
identity where id = %s", self.ID)
                if not data:
                        return '??'
                return get_medical_age (data[0][0])

Comments/bugfixes please.
I have not changed any existing functions yet except the one demonstrated.

Ian

Attachment: pgpXaNE0aXSFF.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]