本文整理汇总了Python中lib_openmolar.common.db_orm.InsertableRecord.setValue方法的典型用法代码示例。如果您正苦于以下问题:Python InsertableRecord.setValue方法的具体用法?Python InsertableRecord.setValue怎么用?Python InsertableRecord.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib_openmolar.common.db_orm.InsertableRecord
的用法示例。
在下文中一共展示了InsertableRecord.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database):
q_query = QtSql.QSqlQuery("select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0, 0
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("dent_key"))
self.record.remove(self.record.indexOf("checked_date"))
def demo_queries(self):
"""
return a list of queries to populate a demo database
"""
for patient_id in xrange(self.min_patient_id, self.max_patient_id + 1):
self.record.clearValues()
# set values, or allow defaults
self.record.setValue("patient_id", patient_id)
self.record.setValue("checked_by", "demo_installer")
yield self.record.insert_query
示例2: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = 300
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('type'))
self.record.remove(self.record.indexOf('commit_time'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
today = QtCore.QDateTime.currentDateTime()
for i in xrange(0, self.length):
self.record.clearValues()
self.record.setValue('line',
u"This is a test Line of Reception Notes")
self.record.setValue('patient_id',
randint(self.min_patient_id, self.max_patient_id))
self.record.setValue('author', 1)
t_stamp = today.addSecs(- randint(0, 86400))
t_stamp = t_stamp.addDays(- randint(0, 4000))
self.record.setValue('open_time', t_stamp)
yield self.record.insert_query
示例3: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database):
self.length = 2
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for i in range(self.length):
self.record.clearValues()
self.record.setValue('status', 'open')
yield self.record.insert_query
示例4: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
min_patient_id = q_query.value(0).toInt()[0]
max_patient_id = q_query.value(1).toInt()[0]
self.patient_id = randint(min_patient_id, max_patient_id)
else:
self.patient_id = 0
self.length = 1
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('checked_date'))
self.record.remove(self.record.indexOf('is_erupted'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', self.patient_id)
self.record.setValue('mesial_neighbour', 9)
self.record.setValue('distal_neighbour', 10)
self.record.setValue('checked_by', 'demo_installer')
yield self.record.insert_query
示例5: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database):
self.length = 40
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('checked_date'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for i in range(self.length):
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('number',
u"0%04d %06d"% (randint(1000,9999), randint(100000,999999)))
self.record.setValue('checked_by', "demo_installer")
yield self.record.insert_query
示例6: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query = QtSql.QSqlQuery("select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0, 0
q_query = QtSql.QSqlQuery("select min(ix), max(ix) from addresses", database)
if q_query.first():
self.max_address_id = q_query.value(1).toInt()[0]
self.min_address_id = q_query.value(0).toInt()[0]
# reserve id number 1 for the practice address.
if self.min_address_id == 1 and self.max_address_id > 1:
self.min_address_id == 2
else:
self.min_address_id, self.max_address_id = 0, 0
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("address_cat"))
self.record.remove(self.record.indexOf("to_date"))
self.record.remove(self.record.indexOf("from_date"))
self.record.remove(self.record.indexOf("mailing"))
def demo_queries(self):
"""
return a list of queries to populate a demo database
"""
for patient_id in xrange(self.min_patient_id, self.max_patient_id + 1):
self.record.clearValues()
address_id = randint(self.min_address_id, self.max_address_id)
# set values, or allow defaults
self.record.setValue("patient_id", patient_id)
self.record.setValue("address_id", address_id)
yield self.record.insert_query
示例7: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database):
q_query = QtSql.QSqlQuery(
"""select ix from patients
where last_name='POTTER' and first_name='HARRY' """,
database,
)
self.length = 0
self.patient_id = None
if q_query.first():
self.length = 1
self.patient_id = q_query.value(0).toInt()[0]
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("checked_date"))
def demo_queries(self):
"""
return a list of queries to populate a demo database
"""
sql_list = []
if self.patient_id:
self.record.setValue("patient_id", self.patient_id)
self.record.setValue("memo", "Nasty scar on forehead, present since birth")
self.record.setValue("checked_by", "demo_installer")
sql_list.append(self.record.insert_query)
return sql_list
示例8: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
'''select ix from patients
where last_name='POTTER' and first_name='HARRY' ''', database)
self.length = 0
self.patient_id = None
if q_query.first():
self.length = 1
self.patient_id = q_query.value(0).toInt()[0]
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('checked_date'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
if self.patient_id:
self.record.setValue('patient_id', self.patient_id)
self.record.setValue('memo', "legal guardian is Mr Vernon Dursley")
self.record.setValue('checked_by', 'demo_installer')
return [self.record.insert_query]
return []
示例9: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('checked_date'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for pt in range(self.min_patient_id, self.max_patient_id):
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', pt)
self.record.setValue('checked_by', 'demo_installer')
self.record.setValue('values', "1234*-")
yield self.record.insert_query
示例10: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
self.length = 820
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
date_ = QtCore.QDate.currentDate().addMonths(-1)
finish_date = date_.addMonths(6)
while date_ < finish_date:
dayno = date_.dayOfWeek()
if dayno in (6,7):
date_ = date_.addDays(1)
continue
if dayno == 2:
start = QtCore.QDateTime(date_, QtCore.QTime(13,0))
end_ = QtCore.QDateTime(date_, QtCore.QTime(19,0))
else:
start = QtCore.QDateTime(date_, QtCore.QTime(9,0))
end_ = QtCore.QDateTime(date_, QtCore.QTime(17,0))
self.record.clearValues()
self.record.setValue('diary_id', 1)
self.record.setValue('start', start)
self.record.setValue('finish', end_)
self.record.setValue('comment', 'demo session')
yield self.record.insert_query
date_ = date_.addDays(1)
示例11: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from telephone", database)
if q_query.first():
self.min_tel_id = q_query.value(0).toInt()[0]
self.max_tel_id = q_query.value(1).toInt()[0]
else:
self.min_tel_id, self.max_tel_id = 0,0
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('tel_cat'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
sql_list = []
for patient_id in xrange(self.min_patient_id, self.max_patient_id+1):
self.record.clearValues()
tel_id = (randint(self.min_tel_id, self.max_tel_id))
#set values, or allow defaults
self.record.setValue("patient_id", patient_id)
self.record.setValue("tel_id", tel_id)
sql_list.append(self.record.insert_query)
return sql_list
示例12: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
self.length = 1
self.record = InsertableRecord(database, TABLENAME)
self.tooth_tx_id = 0
q_query= QtSql.QSqlQuery(
"select ix from treatment_teeth where treatment_id=2", database)
if q_query.first():
self.tooth_tx_id = q_query.value(0).toInt()[0]
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
self.record.setValue('tooth_tx_id', self.tooth_tx_id)
self.record.setValue('surfaces', "MO")
self.record.setValue('material', "AM")
sql = self.record.insert_query
yield sql
示例13: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
self.length = 6
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
"""
return a list of queries to populate a demo database
"""
for avatar in (
"demo_neil.svg",
"demo_andi.svg",
"demo_blondie.svg",
"demo_helen.svg",
"demo_me.svg",
"demo_nattress.svg",
"demo_iceman.svg",
"demo_frog.svg",
"demo_jellyman.svg",
"demo_lucy.svg",
"demo_negro.svg",
"demo_ja.svg",
"demo_sally.svg",
):
f = QtCore.QFile(":avatars/%s" % avatar)
f.open(QtCore.QIODevice.ReadOnly)
ts = QtCore.QTextStream(f)
self.record.clearValues()
self.record.setValue("svg_data", ts.readAll())
self.record.setValue("description", avatar)
f.close()
yield self.record.insert_query
示例14: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = (self.max_patient_id - self.min_patient_id) * 24
if self.length > 100:
self.length = 100
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
comments = ["big tooth", "little tooth", "rotated tooth"]
list_len = len(comments)-1
unique_teeth = set([])
while len(unique_teeth) < self.length:
pt = randint(self.min_patient_id, self.max_patient_id)
tooth = randint(1,32)
unique_teeth.add((pt, tooth))
for pt, tooth in unique_teeth:
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', pt)
self.record.setValue('tooth', tooth)
self.record.setValue('checked_by', 'demo_installer')
self.record.setValue('comment', comments[randint(0, list_len)])
self.record.remove(self.record.indexOf('checked_date'))
yield self.record.insert_query
示例15: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import setValue [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
self.database = database
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = (self.max_patient_id - self.min_patient_id) * 3
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('date_charted'))
def crown_list(self):
CROWNS = SETTINGS.OM_TYPES["crowns"].allowed_values
TEETH = SETTINGS.upper_back + SETTINGS.lower_back
randno = len(TEETH) - 1
for i in range(3):
tooth = TEETH[randint(0, randno)]
type_ = CROWNS[randint(0, len(CROWNS)-1)]
crown = (tooth, type_)
yield crown
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for patient in xrange(self.min_patient_id, self.max_patient_id+1):
for tooth, type_ in self.crown_list():
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', patient)
self.record.setValue('type', type_)
self.record.setValue('tooth', tooth)
self.record.setValue('comment', "generated by demo_installer")
yield self.record.insert_query