本文整理匯總了Python中core.data.db.history.HistoryItem.getPrimaryKeyColumns方法的典型用法代碼示例。如果您正苦於以下問題:Python HistoryItem.getPrimaryKeyColumns方法的具體用法?Python HistoryItem.getPrimaryKeyColumns怎麽用?Python HistoryItem.getPrimaryKeyColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.data.db.history.HistoryItem
的用法示例。
在下文中一共展示了HistoryItem.getPrimaryKeyColumns方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from core.data.db.history import HistoryItem [as 別名]
# 或者: from core.data.db.history.HistoryItem import getPrimaryKeyColumns [as 別名]
def __init__(self):
baseOutputPlugin.__init__(self)
if not kb.kb.getData('gtkOutput', 'db') == []:
# Restore it from the kb
self._db = kb.kb.getData('gtkOutput', 'db')
self.queue = kb.kb.getData('gtkOutput', 'queue')
else:
self.queue = Queue.Queue()
kb.kb.save('gtkOutput', 'queue' , self.queue)
# Create DB and add tables
sessionName = cf.cf.getData('sessionName')
dbName = os.path.join(get_home_dir(), 'sessions', 'db_' + sessionName)
# Just in case the directory doesn't exist...
try:
os.mkdir(os.path.join(get_home_dir() , 'sessions'))
except OSError, oe:
# [Errno 17] File exists
if oe.errno != 17:
msg = 'Unable to write to the user home directory: ' + get_home_dir()
raise w3afException( msg )
self._db = DB()
# Check if the database already exists
if os.path.exists(dbName):
# Find one that doesn't exist
for i in xrange(100):
newDbName = dbName + '-' + str(i)
if not os.path.exists(newDbName):
dbName = newDbName
break
# Create DB!
self._db.open(dbName)
# Create table
historyItem = HistoryItem(self._db)
self._db.createTable(historyItem.getTableName(),
historyItem.getColumns(),
historyItem.getPrimaryKeyColumns())
kb.kb.save('gtkOutput', 'db', self._db)