本文整理汇总了Python中config.Configuration.xml_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.xml_dir方法的具体用法?Python Configuration.xml_dir怎么用?Python Configuration.xml_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config.Configuration
的用法示例。
在下文中一共展示了Configuration.xml_dir方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_itemobject.xml"
filedbfname = Configuration.data_dir() + "/itemobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
db_fields = romdb.DBFields(cur, 'item', fields, [ 'dropability' ])
db_fields.recreate_table([ ])
cur.execute('DROP TABLE IF EXISTS item_ability')
cur.execute("""CREATE TABLE item_ability (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
abilityid INTEGER NOT NULL,
CONSTRAINT item_ability_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 6),
CONSTRAINT item_ability_ability_range CHECK (abilityid / 10000 IN (51, 72)),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES item
)
""")
示例2: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "lib"))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_weaponobject.xml"
filedbfname = Configuration.data_dir() + "/weaponobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
# construct db table
db_fields = romdb.DBFields(cur, "weapon", fields, ["eqtype", "dropability"])
db_fields.recreate_table([("guid", "sys_name", "id")])
cur.execute("DROP TABLE IF EXISTS weapon_ability")
cur.execute(
"""CREATE TABLE weapon_ability (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
abilityid INTEGER NOT NULL,
CONSTRAINT weapon_ability_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 6),
CONSTRAINT weapon_ability_ability_range CHECK (abilityid / 10000 IN (51, 72)),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES weapon
示例3: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_addpowerobject.xml"
filedbfname = Configuration.data_dir() + "/addpowerobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
# construct db table
db_fields = romdb.DBFields(cur, 'addpower', fields, [ 'eqtype' ])
db_fields.recreate_table([ ])
cur.execute('DROP TABLE IF EXISTS addpower_weareq ')
cur.execute("""CREATE TABLE addpower_weareq (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
typeid INTEGER NOT NULL,
value INTEGER NOT NULL,
CONSTRAINT addpower_weareq_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 10),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES addpower,
FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id)
)
示例4: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_armorobject.xml"
filedbfname = Configuration.data_dir() + "/armorobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
# construct db table
db_fields = romdb.DBFields(cur, 'armor', fields, [ 'eqtype', 'dropability' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])
cur.execute("""DROP TABLE IF EXISTS armor_ability""")
cur.execute("""CREATE TABLE armor_ability (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
abilityid INTEGER NOT NULL,
CONSTRAINT armor_ability_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 6),
CONSTRAINT aror_ability_ability_range CHECK (abilityid / 10000 IN (51, 72)),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES armor
)
""")
示例5: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_itemcombine.xml"
filedbfname = Configuration.data_dir() + "/itemcombine.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
db_fields = romdb.DBFields(cur, 'item_combine', fields, [ 'src' ])
db_fields.recreate_table([ ('dstitem', 'sys_name', 'id') ])
cur.execute('DROP TABLE IF EXISTS item_combine_src ')
cur.execute("""CREATE TABLE item_combine_src (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
item INTEGER NOT NULL,
amount INTEGER NOT NULL,
CONSTRAINT item_combine_src_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 3),
CONSTRAINT item_combine_src_amount_range CHECK (amount >= 1),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES item_combine
)""")
conn.commit()
示例6: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_treasureobject.xml"
filedbfname = Configuration.data_dir() + "/treasureobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
db_fields = romdb.DBFields(cur, 'treasure', fields, [ 'dropability', 'item' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])
cur.execute('DROP TABLE IF EXISTS treasure_drop ')
cur.execute("""CREATE TABLE treasure_drop (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
item INTEGER,
rate INTEGER NOT NULL,
count INTEGER NOT NULL,
CONSTRAINT treasure_drop_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 100),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES treasure
)
""")
conn.commit()
示例7: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_recipeobject.xml"
filedbfname = Configuration.data_dir() + "/recipeobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
db_fields = romdb.DBFields(cur, 'recipe', fields, [ 'source' ])
db_fields.recreate_table([ ])
cur.execute('DROP TABLE IF EXISTS recipe_source ')
cur.execute("""CREATE TABLE recipe_source (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
source INTEGER NOT NULL,
count INTEGER NOT NULL,
reduce INTEGER NOT NULL,
CONSTRAINT recipe_source_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 8),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES recipe
)
""")
示例8: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_eqrefineabilityobject.xml"
filedbfname = Configuration.data_dir() + "/eqrefineabilityobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
# construct db table
db_fields = romdb.DBFields(cur, 'refine', fields, [ 'eqtype' ])
db_fields.recreate_table([ ])
cur.execute('DROP TABLE IF EXISTS refine_prop')
cur.execute("""CREATE TABLE refine_prop (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
typeid INTEGER NOT NULL,
value INTEGER NOT NULL,
CONSTRAINT refine_prop_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 10),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES refine,
FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id)
)
示例9: DBConnection
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_cardobject.xml"
filedbfname = Configuration.data_dir() + "/cardobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
db_fields = romdb.DBFields(cur, 'card', fields, [ ])
db_fields.recreate_table([ ('cardaddpower', 'addpower', 'guid') ])
conn.commit()
records = romdb.decode_db(filedbfname, fields)
for k, v in records.items():
if not db_fields.insert_fields(v):
# constraint failure (no sys_name most likely) - skip the item
continue
conn.commit()
conn.close()
# vim:set ts=2 sw=2:
示例10: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_suitobject.xml"
filedbfname = Configuration.data_dir() + "/suitobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
db_fields = romdb.DBFields(cur, 'suit', fields, [ 'basetype', 'suitlist' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])
cur.execute('DROP TABLE IF EXISTS suit_bonus')
cur.execute("""CREATE TABLE suit_bonus (
guid INTEGER NOT NULL,
itemcount INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
typeid INTEGER NOT NULL,
value INTEGER NOT NULL,
CONSTRAINT suitbouns_itemcount_range CHECK (itemcount >= 2 AND itemcount <= 9),
CONSTRAINT suitbonus_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 3),
PRIMARY KEY (guid, itemcount, ordernum),
FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id),
FOREIGN KEY (guid) REFERENCES suit
示例11: CHECK
# 需要导入模块: from config import Configuration [as 别名]
# 或者: from config.Configuration import xml_dir [as 别名]
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import romdb
from config import Configuration
from dbconnection import DBConnection
dbxmlfname = Configuration.xml_dir() + "/db_titleobject.xml"
filedbfname = Configuration.data_dir() + "/titleobject.db"
conn = DBConnection()
cur = conn.cursor()
fields = romdb.load_field_xml(dbxmlfname)
# construct db table
db_fields = romdb.DBFields(cur, 'title', fields, [ 'eqtype' ])
db_fields.recreate_table([ ('guid', 'sys_name', 'id') ])
cur.execute('DROP TABLE IF EXISTS title_weareq ')
cur.execute("""CREATE TABLE title_weareq (
guid INTEGER NOT NULL,
ordernum INTEGER NOT NULL,
typeid INTEGER NOT NULL,
value INTEGER NOT NULL,
CONSTRAINT title_weareq_ordernum_range CHECK (ordernum >= 1 AND ordernum <= 5),
PRIMARY KEY (guid, ordernum),
FOREIGN KEY (guid) REFERENCES title,
FOREIGN KEY (typeid) REFERENCES sys_weareqtype (id)
)