pass sql list from fpdb through guibulkimport to fpdb_import
This commit is contained in:
parent
9c62ecb80e
commit
38ee98e492
|
@ -34,6 +34,7 @@ import Configuration
|
||||||
|
|
||||||
class GuiBulkImport():
|
class GuiBulkImport():
|
||||||
|
|
||||||
|
# not used
|
||||||
def import_dir(self):
|
def import_dir(self):
|
||||||
"""imports a directory, non-recursive. todo: move this to fpdb_import so CLI can use it"""
|
"""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
|
ttime = time() - starttime
|
||||||
if ttime == 0:
|
if ttime == 0:
|
||||||
ttime = 1
|
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)
|
% (stored, dups, partial, errs, ttime, stored / ttime)
|
||||||
self.importer.clearFileList()
|
self.importer.clearFileList()
|
||||||
|
|
||||||
|
@ -96,10 +97,10 @@ class GuiBulkImport():
|
||||||
"""returns the vbox of this thread"""
|
"""returns the vbox of this thread"""
|
||||||
return self.vbox
|
return self.vbox
|
||||||
|
|
||||||
def __init__(self, settings, config):
|
def __init__(self, settings, config, sql = None):
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.config = config
|
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 = gtk.VBox(False, 0)
|
||||||
self.vbox.show()
|
self.vbox.show()
|
||||||
|
|
|
@ -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))
|
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
|
# 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()
|
self.db.connection.rollback()
|
||||||
#end def load_profile
|
#end def load_profile
|
||||||
|
|
||||||
|
@ -477,7 +476,7 @@ class fpdb:
|
||||||
def tab_bulk_import(self, widget, data=None):
|
def tab_bulk_import(self, widget, data=None):
|
||||||
"""opens a tab for bulk importing"""
|
"""opens a tab for bulk importing"""
|
||||||
#print "start of tab_bulk_import"
|
#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)
|
self.threads.append(new_import_thread)
|
||||||
bulk_tab=new_import_thread.get_vbox()
|
bulk_tab=new_import_thread.get_vbox()
|
||||||
self.add_and_display_tab(bulk_tab, "Bulk Import")
|
self.add_and_display_tab(bulk_tab, "Bulk Import")
|
||||||
|
|
|
@ -54,11 +54,13 @@ except:
|
||||||
|
|
||||||
class Importer:
|
class Importer:
|
||||||
|
|
||||||
def __init__(self, caller, settings, config):
|
def __init__(self, caller, settings, config, sql = None):
|
||||||
"""Constructor"""
|
"""Constructor"""
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.caller = caller
|
self.caller = caller
|
||||||
self.config = config
|
self.config = config
|
||||||
|
self.sql = sql
|
||||||
|
|
||||||
self.database = None # database will be the main db interface eventually
|
self.database = None # database will be the main db interface eventually
|
||||||
self.filelist = {}
|
self.filelist = {}
|
||||||
self.dirlist = {}
|
self.dirlist = {}
|
||||||
|
@ -76,7 +78,7 @@ class Importer:
|
||||||
self.settings.setdefault("minPrint", 30)
|
self.settings.setdefault("minPrint", 30)
|
||||||
self.settings.setdefault("handCount", 0)
|
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.NEWIMPORT = False
|
||||||
self.allow_hudcache_rebuild = False
|
self.allow_hudcache_rebuild = False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user