Exemplo n.º 1
0
# Transform and update database if required
#

# which is the actual version
v = Version.selectBy(context='member')
if v.count() == 1:
    versionNb = v[0].versionNb
else:
    versionNb = 0
    Version(context='member',versionNb=0)

# transform database to SQLObject format
if versionNb <= 0:
    Member.createTable(ifNotExists=True)
    if isinstance(dbConnection,MySQLConnection):
        dbConnection.query('ALTER TABLE %s.`member` TYPE = MYISAM;' % dbConnection.db)
    for x in accountsmi.select():
        Member(
            accountNb=int(x.mitgliedsNr),
            newAccountNb=neueMitgliedsNr2Int(x.neueMitgliedsNr),
            firstName=x.vorname,
            lastName=x.nachname,
            title=x.titel,
            addressExtension=x.adresszusatz,
            street=x.strasse,
            city=x.ort,
            countryCode=x.countrycode,
            zipCode=x.pLZ,
            telefonPrivate=x.telefonPrivat,
            telefonOffice=x.telefonDienst,
            telefonMobile=x.mobiltelefon,
Exemplo n.º 2
0
class Version(SQLObject):
    '''
        This class implements the database access using the SQL Object library.
        The table "version" stores the actual deployed version of a table, used
        to store the transfers or account information. If the table structure of
        such a table changes the version number should be incremented. If the
        actual table is not up to date then the supporting code can upgrade the
        table content at startup time.
    '''
    
    _connection = dbConnection
    
    context = StringCol()
    versionNb = IntCol()

# create table
Version.createTable(ifNotExists=True)
dbConnection.query('ALTER TABLE %s.`version` TYPE = MYISAM;' % dbConnection.db)

# upgrade "version" table
v = Version.selectBy(context='version')
if v.count() == 1:
    versionNb = v[0].versionNb
else:
    versionNb = 0
    Version(context='version',versionNb=0)

versionNb = 1
v = Version.selectBy(context='version')
v[0].versionNb = versionNb
Exemplo n.º 3
0
# Transform and update database if required
#

# which is the actual version
v = Version.selectBy(context='transfer')
if v.count() == 1:
    versionNb = v[0].versionNb
else:
    versionNb = 0
    Version(context='transfer',versionNb=0)

# transform database to SQLObject format
if versionNb <= 0:
    Transfer.createTable(ifNotExists=True)
    if isinstance(dbConnection,MySQLConnection):
        dbConnection.query('ALTER TABLE %s.`transfer` TYPE = MYISAM;' % dbConnection.db)
    for x in transfers.select():
        Transfer(
            bookingId=x.tAID,
            transferId=x.transferID,
            transferCode=x.bKZ,
            debit=x.soll,
            credit=x.haben,
            bookingDate=x.datum,
            receiptDate=x.datum,
            year=x.jahr,
            importDescription=x.importBeschreibung,
            description=x.beschreibung,
            importWho=x.importWho,
            who=x.who,
            account1=x.konto1,
Exemplo n.º 4
0
# Transform and update database if required
#

# which is the actual version
v = Version.selectBy(context='price')
if v.count() == 1:
    versionNb = v[0].versionNb
else:
    versionNb = 1
    Version(context='price',versionNb=0)

# transform database to SQLObject format
if versionNb <= 0:
    Price.createTable(ifNotExists=True)
    if isinstance(dbConnection,MySQLConnection):
        dbConnection.query('ALTER TABLE %s.`price` TYPE = MYISAM;' % dbConnection.db)
    for x in prices.select():
        Price(
            transferCode=x.bKZ,
            debit=x.soll,
            credit=x.haben,
            description=x.beschreibung,
            newFrom=x.ab,
            newCredit=x.abHaben,
            newDebit=x.abSoll,
            account=x.konto,

            changedAt=x.changedAt,
            changedAtSite=x.changedOn,
            changedBy=x.changedBy)
Exemplo n.º 5
0
    
#
# Transform and update database if required
#

# which is the actual version
v = Version.selectBy(context='bankcode')
if v.count() == 1:
    versionNb = v[0].versionNb
else:
    versionNb = 0
    Version(context='bankcode',versionNb=0)

# transform database to SQLObject format
if versionNb <= 0:
    BankCode.createTable(ifNotExists=True)
    if isinstance(dbConnection,MySQLConnection):
        dbConnection.query('ALTER TABLE %s.`bank_code` TYPE = MYISAM;' % dbConnection.db)
    for x in blz.select():
        BankCode(
            bankName=x.bank,
            bankCode=x.bLZ,
            changedAt=x.changedAt,
            changedAtSite=x.changedOn,
            changedBy=x.changedBy)

# store actual version number
versionNb = 1
v = Version.selectBy(context='bankcode')
v[0].versionNb = versionNb