Ejemplo n.º 1
0
            return self.select("context LIKE '%s'" % pattern, orderBy="context")
        else:
            return self.select(orderBy="context")
            
    search = classmethod(search)
        
    def allAttrs(self):
        attrs = {}
        attrs['context'] = self.context
        attrs['value'] = self.value
        return attrs

# upgrade "setting" table

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

# transform database to SQLObject format
if versionNb <= 0:
    Setting.createTable(ifNotExists=True)
    if isinstance(dbConnection,MySQLConnection):
        dbConnection.query('ALTER TABLE %s.`member` TYPE = MYISAM;' % dbConnection.db)
    Setting(context="site",value="office")
    Setting(context="organisation",value="My Sport Club")
    Setting(context="link",value="www.my_sport_club.org")
    Setting(context="mailAddress",value="support@my_sport_club.org")
Ejemplo n.º 2
0
        return None
    else:
        return int(s[2:])

def str2Int(s):
    if (s == None) or (s == ""):
        return 0
    else:
        return int(s)
    
#
# 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),
Ejemplo n.º 3
0
            SQLObject for the MiddleKit database format
        '''
    
        _connection = dbConnection
        _fromDatabase = True
        _idName = 'transfersId'
        _style = MixedCaseStyle(longID=True)
except:
    pass

#
# 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,
Ejemplo n.º 4
0
            SQLObject for the MiddleKit database format
        '''
    
        _connection = dbConnection
        _fromDatabase = True
        _idName = 'pricesId'
        _style = MixedCaseStyle(longID=True)
except:
    pass

#
# 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,
Ejemplo n.º 5
0
            SQLObject for the MiddleKit database format
        '''
    
        _connection = dbConnection
        _fromDatabase = True
        _idName = 'bLZId'
        _style = MixedCaseStyle(longID=True)
except:
    pass
    
#
# 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,