Files
metasploit-gs/lib/msf/core/db_objects.rb
T
Mike Smith f9ffc8b8bc Add db_workspace command & other db refactoring.
* Added "workspaces" table and associated ActiveRecord class.
 * Moved ActiveRecord models from db_objects.rb into separate files.
 * Do the DB migration check every time you connect (was previously done
   during db_create).
 * Use :dependent => :destroy associations so that we don't have to
   manually delete the dependent objects.

git-svn-id: file:///home/svn/framework3/trunk@7861 4d416f70-5f16-0410-b530-b9f4589650da
2009-12-14 22:52:34 +00:00

46 lines
734 B
Ruby

module Msf
##
#
# This module defines all of the DB database tables
# and creates ActiveRecord objects for each one of them
#
##
class DBManager
class Lock
@@mutex = Mutex.new
def self.mutex
@@mutex
end
end
# ActiveRecord/sqlite3 has locking issues when you update a table with a pending select
# This set of instance/class wrappers should prevent a table lock
# Straight up gangsta from spoon (ripped from BION)
module DBSave
def self.included(mod)
class << mod
def find(*args)
ActiveRecord::Base.connection_pool.clear_stale_cached_connections!
super(*args)
end
def save(*args)
ActiveRecord::Base.connection_pool.clear_stale_cached_connections!
super(*args)
end
end
end
end
end
end