コード例 #1
0
def pg_value(value, fc, **kwargs):
    typ = type(value)
    data = py_types.get(typ)
    if data == None:
        raise NotSupportedError("type %r not mapped to pg type" % typ)

    # permit the type conversion to be determined by the value, if provided
    inspect_func = data.get("inspect")
    if value != None and inspect_func != None:
        data = inspect_func(value)

    # special case: NULL values
    if data.get("typeoid") == -1:
        return None

    if fc == 0:
        func = data.get("txt_out")
    elif fc == 1:
        func = data.get("bin_out")
    else:
        raise InternalError("unrecognized format code %r" % fc)
    if func == None:
        raise NotSupportedError("type %r, format code %r not supported" %
                                (typ, fc))
    return func(value, **kwargs)
コード例 #2
0
def pg_type_info(typ):
    value = None
    if isinstance(typ, dict):
        value = typ["value"]
        typ = typ["type"]

    data = py_types.get(typ)
    if data == None:
        raise NotSupportedError("type %r not mapped to pg type" % typ)

    # permit the type data to be determined by the value, if provided
    inspect_func = data.get("inspect")
    if value != None and inspect_func != None:
        data = inspect_func(value)

    type_oid = data.get("typeoid")
    if type_oid == None:
        raise InternalError("type %r has no type_oid" % typ)
    elif type_oid == -1:
        # special case: NULL values
        return type_oid, 0

    # prefer bin, but go with whatever exists
    if data.get("bin_out"):
        format = 1
    elif data.get("txt_out"):
        format = 0
    else:
        raise InternalError("no conversion fuction for type %r" % typ)

    return type_oid, format
コード例 #3
0
def py_value(v, description, **kwargs):
    if v == None:
        # special case - NULL value
        return None
    type_oid = description['type_oid']
    format = description['format']
    data = pg_types.get(type_oid)
    if data == None:
        raise NotSupportedError("type oid %r not supported" % type_oid)
    if format == 0:
        func = data.get("txt_in")
    elif format == 1:
        func = data.get("bin_in")
    else:
        raise NotSupportedError("format code %r not supported" % format)
    if func == None:
        raise NotSupportedError("data response format %r, type %r not supported" % (format, type_oid))
    return func(v, **kwargs)
コード例 #4
0
 def get_operating_system(self):
     platform = sys.platform
     if platform.startswith(u'linux'):
         return u"linux"
     elif platform.startswith(u'darwin'):
         return u"mac"
     elif platform.startswith(u'win'):
         return u"windows"
     else:
         raise NotSupportedError(u"Your platform," + sys.platform +
                                 u",isn't supported.")
コード例 #5
0
 def get_virtual_memory_address_width(self):
     is64Bit = sys.maxsize / 3 > 2**32
     if is64Bit:
         return 64
     else:
         if self.operating_system == u"mac":
             raise NotSupportedError(
                 u"Your processor is determined to have a maxSize of" +
                 sys.maxsize +
                 u",\n which doesn't correspond with a 64-bit architecture."
             )
         return 32
コード例 #6
0
def py_type_info(description):
    type_oid = description['type_oid']
    data = pg_types.get(type_oid)
    if data == None:
        raise NotSupportedError("type oid %r not mapped to py type" % type_oid)
    # prefer bin, but go with whatever exists
    if data.get("bin_in"):
        format = 1
    elif data.get("txt_in"):
        format = 0
    else:
        raise InternalError("no conversion fuction for type oid %r" % type_oid)
    return format
コード例 #7
0
ファイル: cursor.py プロジェクト: yufeiminds/sqlalchemy-simql
 def callproc(procname, parameters={}):
     raise NotSupportedError()
コード例 #8
0
 def rollback(self):
     raise NotSupportedError("Rollback is not supported in SimQL")