# Progress update
File.Logerror(ErrorfileObject, module, 'Connected to Outlook', info)

# Get Outlook account information
OutlookAccounts = Email.Mailaccounts(failure)
Errormessage = 'Unable to get Outlook accounts detail'
if (OutlookAccounts == failure):
    File.Logerror(ErrorfileObject, module, Errormessage, error)

# Read fields in table 'vacancy'
SQLcommand = 'show columns from %s' % VacancyTable
SQLresponse = Db.SQLload(DbObject, DbCursor, SQLcommand, failure)
Errormessage = 'SQLresponse error for SQL command ' + '\"' + SQLcommand + '\"'
if ((SQLresponse) == failure):
    File.Logerror(ErrorfileObject, module, Errormessage, error)
Vacancyfields = Db.Fielddefs(SQLresponse)

# Progress update
File.Logerror(ErrorfileObject, module, 'Read vacancy table field definitions',
              info)

# Read fields in table 'history'
SQLcommand = 'show columns from %s' % HistoryTable
SQLresponse = Db.SQLload(DbObject, DbCursor, SQLcommand, failure)
Errormessage = 'SQLresponse error for SQL command ' + '\"' + SQLcommand + '\"'
if ((SQLresponse) == failure):
    File.Logerror(ErrorfileObject, module, Errormessage, error)
Historyfields = Db.Fielddefs(SQLresponse)

# Progress update
File.Logerror(ErrorfileObject, module, 'Read history table field definitions',
File.Logerror(ErrorfileObject, module, 'Loaded database table definition data',
              info)

# Verify all required tables have been defined.
for table in DbTable:

    # Generate SQL command

    SQLcommand = 'show columns from %s.%s' % (DbName, table)
    SQLresponse = (Db.SQLload(DbObject, DbCursor, SQLcommand, failure))
    Errormessage = 'SQLresponse error for SQL command ' + '\"' + SQLcommand + '\"'
    if ((SQLresponse) == failure):
        File.Logerror(ErrorfileObject, module, Errormessage, error)

    # Determine field definitions for tables 'company' and engine
    if (table == 'company'): Companyfields = Db.Fielddefs(SQLresponse)
    if (table == 'engine'): Enginefields = Db.Fielddefs(SQLresponse)

# Progress update
File.Logerror(ErrorfileObject, module,
              'Verified that all required tables have been defined', info)

# Load company data from 'companies.data' file
CompanyfileObject = File.Open(Companyfilename, read, failure)
Errormessage = 'Could not open ' + Companyfilename
if (CompanyfileObject == failure):
    File.Logerror(ErrorfileObject, module, Errormessage, error)

CompanyfileData = File.Readline(CompanyfileObject, empty)
Errormessage = 'No data in ' + Companyfilename
if (CompanyfileData == empty):
# Prepare a database cursor object.
DbCursor = Db.Initcursor(DbObject, invalid)
Errormessage = 'Unable to create database cursor'
if (DbCursor == invalid):
    File.Logerror(ErrorfileObject, module, Errormessage, error)

# Progress update
File.Logerror(ErrorfileObject, module, 'Connected to database', info)

# Verify 'company' table is defined and read field definitions
SQLcommand = 'show columns from %s.%s' % (DbName, 'company')
SQLresponse = (Db.SQLload(DbObject, DbCursor, SQLcommand, failure))
Errormessage = 'SQLresponse error for SQL command ' + '\"' + SQLcommand + '\"'
if ((SQLresponse) == failure):
    File.Logerror(ErrorfileObject, module, Errormessage, error)
Companyfields = Db.Fielddefs(SQLresponse)

# Progress update
File.Logerror(ErrorfileObject, module,
              'Verified that table company is defined', info)

# Load company data from 'companies.data' file
CompanyfileObject = File.Open(Companyfilename, read, failure)
Errormessage = 'Could not open ' + Companyfilename
if (CompanyfileObject == failure):
    File.Logerror(ErrorfileObject, module, Errormessage, error)

CompanyfileData = File.Readline(CompanyfileObject, empty)
Errormessage = 'No data in ' + Companyfilename
if (CompanyfileData == empty):
    File.Logerror(ErrorfileObject, module, Errormessage, error)
Ejemplo n.º 4
0
if ( DbObject == invalid ) : File.Logerror(ErrorfileObject,module,Errormessage,error)

# Prepare a database cursor object.
DbCursor = Db.Initcursor(DbObject,invalid)
Errormessage = 'Unable to create database cursor'
if ( DbCursor == invalid ) : File.Logerror(ErrorfileObject,module,Errormessage,error)

# Progress update
File.Logerror(ErrorfileObject,module,'Connected to database',info) 

# Read fields in table 'vacancy'
SQLcommand = 'show columns from %s' % VacancyTable 
SQLresponse = ( Db.SQLload(DbObject,DbCursor,SQLcommand,failure) )
Errormessage = 'SQLresponse error for SQL command ' + '\"' + SQLcommand + '\"'
if ( (SQLresponse) == failure ): File.Logerror(ErrorfileObject,module,Errormessage,error)
VacancyFields = Db.Fielddefs(SQLresponse)

# Progress update
File.Logerror(ErrorfileObject,module,'Read vacancy table field definitions',info)

# Read fields in table 'history'
SQLcommand = 'show columns from %s' % HistoryTable 
SQLresponse = Db.SQLload(DbObject,DbCursor,SQLcommand,failure)
Errormessage = 'SQLresponse error for SQL command ' + '\"' + SQLcommand + '\"'
if ( (SQLresponse) == failure ): File.Logerror(ErrorfileObject,module,Errormessage,error)
HistoryFields = Db.Fielddefs(SQLresponse)

# Progress update
File.Logerror(ErrorfileObject,module,'Read history table field definitions',info)

# Read fields in table 'Duplicate'