'Returns the SpatiaLite version as a tuple (version string, major,
minor, subminor).'

def spatialite_version_tuple(self):

    try:
        version = self.spatialite_version()
    except DatabaseError:
        version = None
        try:
            tmp = self._get_spatialite_func("X(GeomFromText('POINT(1    1)'))")
            if (tmp == 1.0):
                version = '2.3.0'
        except DatabaseError:
            pass
        if (version is None):
            raise
    m = self.version_regex.match(version)
    if m:
        major = int(m.group('major'))
        minor1 = int(m.group('minor1'))
        minor2 = int(m.group('minor2'))
    else:
        raise Exception(('Could    not    parse    SpatiaLite    version    string:    %s' % version))
    return (version, major, minor1, minor2)
