waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

django adapter: to implement base.DatabaseWrapper.server_version property #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is minor thing, but probably can be useful in the future. 
mysql adapter defines in DatabaseWrapper class server_version property and
get_server_version method in order to make distinctions in some part of the
code depending of the db server version. I have done similar based on PyDB2
adapter like this:

    server_version_re = re.compile(r"dbmsVersion: (.*)>")

    def get_server_version(self):
        """ <open connection at c91a90, serverName: DB2     , dbmsName:
DB2/NT, dbmsVersion: 07.02.0009> 
        this function will return (7,2,9)
        """
        if not self.server_version:
            if not self._valid_connection():
                self.cursor() # creates connection
            m = server_version_re.search(str(self.connection))
            if not m:
                raise Exception('Unable to determine Db2 version from
version string %r' % str(self.connection))
            self.server_version = tuple([int(x) for x in
m.groups()[0].split(".")])
        return self.server_version

Probably this information can also be useful from end-users' viewpoint
(maybe django.db.BaseDatabaseWrapper should have such property/method also).

Original issue reported on code.google.com by trebor74hr@gmail.com on 26 Jun 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Thanks for your feedback. I would take this into consideration for the next 
release and 
update you for the same.

Thanks and Regards
Tarun Pasrija
Open Source Application Development
IBM India Software Labs

Original comment by tarun.pa...@in.ibm.com on 1 Jul 2009 at 7:25

GoogleCodeExporter commented 9 years ago
This code change has been made and would be released in the next version of 
ibm_db_django.

Thanks and Regards
Tarun Pasrija
Open Source Application Development
IBM India Software Labs

Original comment by tarun.pa...@in.ibm.com on 3 Aug 2009 at 12:06

GoogleCodeExporter commented 9 years ago

Original comment by tarun.pa...@in.ibm.com on 28 Aug 2009 at 10:45