pass sql list from fpdb through guibulkimport to fpdb_import

This commit is contained in:
sqlcoder 2009-07-29 06:37:06 +01:00
parent 9c62ecb80e
commit 38ee98e492
3 changed files with 9 additions and 7 deletions

View File

@ -34,6 +34,7 @@ import Configuration
class GuiBulkImport():
# not used
def import_dir(self):
"""imports a directory, non-recursive. todo: move this to fpdb_import so CLI can use it"""
@ -80,7 +81,7 @@ class GuiBulkImport():
ttime = time() - starttime
if ttime == 0:
ttime = 1
print 'GuiBulkImport.import_dir done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %d/sec'\
print 'GuiBulkImport.load done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %d/sec'\
% (stored, dups, partial, errs, ttime, stored / ttime)
self.importer.clearFileList()
@ -96,10 +97,10 @@ class GuiBulkImport():
"""returns the vbox of this thread"""
return self.vbox
def __init__(self, settings, config):
def __init__(self, settings, config, sql = None):
self.settings = settings
self.config = config
self.importer = fpdb_import.Importer(self, self.settings, config)
self.importer = fpdb_import.Importer(self, self.settings, config, sql)
self.vbox = gtk.VBox(False, 0)
self.vbox.show()

View File

@ -430,7 +430,6 @@ class fpdb:
self.status_bar.set_text("Status: Connected to %s database named %s on host %s" % (self.db.get_backend_name(),self.db.fdb.database, self.db.fdb.host))
# Database connected to successfully, load queries to pass on to other classes
self.querydict = FpdbSQLQueries.FpdbSQLQueries(self.db.get_backend_name())
self.db.connection.rollback()
#end def load_profile
@ -477,7 +476,7 @@ class fpdb:
def tab_bulk_import(self, widget, data=None):
"""opens a tab for bulk importing"""
#print "start of tab_bulk_import"
new_import_thread=GuiBulkImport.GuiBulkImport(self.settings, self.config)
new_import_thread = GuiBulkImport.GuiBulkImport(self.settings, self.config, self.sql)
self.threads.append(new_import_thread)
bulk_tab=new_import_thread.get_vbox()
self.add_and_display_tab(bulk_tab, "Bulk Import")

View File

@ -54,11 +54,13 @@ except:
class Importer:
def __init__(self, caller, settings, config):
def __init__(self, caller, settings, config, sql = None):
"""Constructor"""
self.settings = settings
self.caller = caller
self.config = config
self.sql = sql
self.database = None # database will be the main db interface eventually
self.filelist = {}
self.dirlist = {}
@ -76,7 +78,7 @@ class Importer:
self.settings.setdefault("minPrint", 30)
self.settings.setdefault("handCount", 0)
self.database = Database.Database(self.config) # includes .connection and .sql variables
self.database = Database.Database(self.config, sql = self.sql) # includes .connection and .sql variables
self.NEWIMPORT = False
self.allow_hudcache_rebuild = False