当前位置: 首页>>代码示例>>Python>>正文


Python db.close方法代码示例

本文整理汇总了Python中db.close方法的典型用法代码示例。如果您正苦于以下问题:Python db.close方法的具体用法?Python db.close怎么用?Python db.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db的用法示例。


在下文中一共展示了db.close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _extract

# 需要导入模块: import db [as 别名]
# 或者: from db import close [as 别名]
def _extract(self, rec):
        if rec is None:
            return None
        else:
            key, data = rec
            # Safe in Python 2.x because expresion short circuit
            if sys.version_info[0] < 3 or isinstance(data, bytes) :
                return key, cPickle.loads(data)
            else :
                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits

    #----------------------------------------------
    # Methods allowed to pass-through to self.dbc
    #
    # close, count, delete, get_recno, join_item


#--------------------------------------------------------------------------- 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:20,代码来源:dbshelve.py

示例2: __init__

# 需要导入模块: import db [as 别名]
# 或者: from db import close [as 别名]
def __init__(self):
        #load table to memory
        logging.info("Loading ids")
        cur = getCursor()
        executeAndLog(cur,
                "SELECT id, entity_name, address, original_address, lat, lng FROM entities")
        for row in cur:
            norm_name = self.normalize(row["entity_name"]) 
            logging.info(norm_name)
            norm_address = self.normalize(row["address"])
            norm_orig_address = self.normalize(row["original_address"])
            t_address = (hash(norm_name), hash(norm_address))
            t_orig_address = (hash(norm_name), hash(norm_orig_address))
            t_lat_lng = (hash(norm_name), hash((str(row["lat"]), str(row["lng"]))))
            self.name_address[t_address] = row["id"]
            self.name_address[t_orig_address] = row["id"]
            self.name_lat_lng[t_lat_lng] = row["id"]
            self.address_data[hash(norm_orig_address)] = row["id"]
        cur.close()
        logging.info("Loading done")

    # normalize string be removing spaces, dots, commas and turning everything into lower cases
    # TODO: normalize upper case letters with diacritics 
开发者ID:verejnedigital,项目名称:verejne.digital,代码行数:25,代码来源:geocode.py

示例3: __del__

# 需要导入模块: import db [as 别名]
# 或者: from db import close [as 别名]
def __del__(self):
        self.close() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:dbshelve.py

示例4: close

# 需要导入模块: import db [as 别名]
# 或者: from db import close [as 别名]
def close(self, *args, **kwargs):
        self.db.close(*args, **kwargs)
        self._closed = True 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:dbshelve.py

示例5: join

# 需要导入模块: import db [as 别名]
# 或者: from db import close [as 别名]
def join(self, cursorList, flags=0):
        raise NotImplementedError


    #----------------------------------------------
    # Methods allowed to pass-through to self.db
    #
    #    close,  delete, fd, get_byteswapped, get_type, has_key,
    #    key_range, open, remove, rename, stat, sync,
    #    upgrade, verify, and all set_* methods.


#--------------------------------------------------------------------------- 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:dbshelve.py


注:本文中的db.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。