本文整理汇总了Python中pyPgSQL.PgSQL.unescape_bytea方法的典型用法代码示例。如果您正苦于以下问题:Python PgSQL.unescape_bytea方法的具体用法?Python PgSQL.unescape_bytea怎么用?Python PgSQL.unescape_bytea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyPgSQL.PgSQL
的用法示例。
在下文中一共展示了PgSQL.unescape_bytea方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_trace
# 需要导入模块: from pyPgSQL import PgSQL [as 别名]
# 或者: from pyPgSQL.PgSQL import unescape_bytea [as 别名]
def get_trace(self):
"""
Do not take any argument.
Returns the next triplet (message, cipher, trace), where:
- message is an ascii string containing a 64 bits clear message in hexadecimal,
- cipher is an ascii string containing a 64 bits ciphered message in hexadecimal,
- trace is a float vector containing a trace during the cipher operation.
"""
if self.__i == len( self.__dbd ):
return None, None, None; # Error, since we have reached the last file
trace_name= self.__dbd[self.__i]
self.__i+= 1;
try:
cmd= "SELECT message,cryptogram,filecontent FROM "+self.__table+" WHERE filename = '"+trace_name+"'"
self.__curs.execute( cmd )
one= self.__curs.fetchone()
msg, crypt, raw_data= one
if db_name=='pgdb':
raw_data= db.unescape_bytea( raw_data )
return msg, crypt, parse_binary( str(raw_data) )
except db.DatabaseError, e:
print e
sys.exit(1)
示例2: get_trace
# 需要导入模块: from pyPgSQL import PgSQL [as 别名]
# 或者: from pyPgSQL.PgSQL import unescape_bytea [as 别名]
def get_trace(self):
"""
Do not take any argument.
Returns the next couple (message, trace), where:
- message is an ascii string containing a 64 bits clear message in hexadecimal,
- trace is a float vector containing a trace during the cipher operation.
"""
msg, crypt, raw_data= self.__curs.fetchone()
if db_name=='pgdb': raw_data= db.unescape_bytea( raw_data )
return msg, crypt, parse_binary( str(raw_data) )
示例3: get_file
# 需要导入模块: from pyPgSQL import PgSQL [as 别名]
# 或者: from pyPgSQL.PgSQL import unescape_bytea [as 别名]
def get_file(self, filename):
"""
Returns the raw trace (header plus float vector) of <filename>
"""
try:
cmd= "SELECT encode(data, 'escape') FROM "+self.__table+" WHERE filename = '"+filename+"'"
self.__curs.execute( cmd )
raw_data= self.__curs.fetchone()
if db_name=='pgdb':
raw_data= db.unescape_bytea( raw_data )
return parse_binary( str(raw_data) )
except db.DatabaseError, e:
print e
sys.exit(1)