import sqlite3
import time
class mycursor ( sqlite3. Cursor ) :
def execute ( self , * args, ** kwargs ) :
timestart = time . clock ( )
query = super ( mycursor, self ) . execute ( * args, ** kwargs )
idle = time . clock ( ) - timestart
if idle > = 0.1 :
file = open ( "sqlite_slow.log" , "a +" )
file . write ( * args )
file . write ( "IDLE =" + str ( idle ) + "n" )
file . close ( )
return query
dbconnection = sqlite3. connect ( "some_slqite_base.db)
dbcursor = dbconnection.cursor (mycursor)
dbcursor.execute (" SELECT * FROM sqlite_master ")
insert into objects ('comment', 'xmlns', 'name') values ('Patch number 125124', 'http://oval.mitre.org/XMLSchema/oval-definitions-5#solaris', 'patch_object') IDLE = 1.5530665503253545
insert into advisory_cpe ('advisory_id', 'cpe_id') values ('665', '158') IDLE = 0.19326974126357754
Source: https://habr.com/ru/post/137677/
All Articles