Ejemplo n.º 1
0
 def generate_deal_bcp(self):
     conn = unity_c37r.create_connection(self.cache_db + '.IM')
     cmds  = sql.SQLiteCommand(conn)
     cmds.CommandText = '''
         select * from deal
     '''
     reader = cmds.ExecuteReader()
     res = dict()
     while reader.Read():
         deal = DealInfo()
         deal.set_value_with_idx(deal.colltection_target_id, self.colltection_target_id)
         deal.set_value_with_idx(deal.app_code, self.app_code)
         deal.set_value_with_idx(deal.deal_id, unity_c37r.c_sharp_get_string(reader, 0))
         try:
             deal.set_value_with_idx(deal.money, unity_c37r.c_sharp_get_real(reader, 2))
         except:
             deal.set_value_with_idx(deal.money, 0)
         deal.set_value_with_idx(deal.description, unity_c37r.c_sharp_get_string(reader, 3))
         t = unity_c37r.c_sharp_get_long(reader, 6)
         if t != 0:
             deal.set_value_with_idx(deal.time, t)
         pass
         unity_c37r.execute_query(self.cmd, TBL_BCP_INSERT_DEAL, deal.get_values())
         # status... not supported right now
         # type ... not suppoted right now
     reader.Close()
     cmds.Dispose()
     conn.Close()
Ejemplo n.º 2
0
 def generate_product_bcp(self):
     conn = unity_c37r.create_connection(self.cache_db)
     cmds = sql.SQLiteCommand(conn)
     cmds.CommandText = '''
         select * from tb_product
     '''
     reader = cmds.ExecuteReader()
     while reader.Read():
         pdt = ProductInfo()
         pdt.set_value_with_idx(pdt.app_code, self.app_code)
         pdt.set_value_with_idx(pdt.colltection_target_id, self.colltection_target_id)
         pdt.set_value_with_idx(pdt.account_id, unity_c37r.c_sharp_get_string(reader, 0))
         tp = unity_c37r.c_sharp_get_string(reader, 1)
         pdt.set_value_with_idx(pdt.source, '0%s' %tp)
         pdt.set_value_with_idx(pdt.product_id, unity_c37r.c_sharp_get_string(reader, 2))
         pdt.set_value_with_idx(pdt.product_name, unity_c37r.c_sharp_get_string(reader, 3))
         pdt.set_value_with_idx(pdt.price, unity_c37r.c_sharp_get_string(reader, 4))
         t = unity_c37r.c_sharp_get_long(reader, 5)
         if t is not 0:
             pdt.set_value_with_idx(pdt.create_time, t)
         pdt.set_value_with_idx(pdt.description, unity_c37r.c_sharp_get_string(reader, 6))
         pdt.set_value_with_idx(pdt.url, unity_c37r.c_sharp_get_string(reader, 7))
         pdt.set_value_with_idx(pdt.shop_id, unity_c37r.c_sharp_get_string(reader, 8))
         pdt.set_value_with_idx(pdt.delete_status, unity_c37r.c_sharp_get_long(reader, 9))
         unity_c37r.execute_query(self.cmd, TBL_BCP_INSERT_PRODUCT, pdt.get_values())
     reader.Close()
     cmds.Dispose()
     conn.Close()
Ejemplo n.º 3
0
 def generate_bcp_account(self):
     conn = unity_c37r.create_connection(self.cache_db + '.IM')
     cmds = sql.SQLiteCommand(conn)
     cmds.CommandText = '''
         select * from account
     '''
     reader = cmds.ExecuteReader()
     while reader.Read():
         a = AccountInfo()
         #a.colltection_target_id = self.colltection_target_id
         a.set_value_with_idx(a.colltection_target_id, self.colltection_target_id)
         a.set_value_with_idx(a.app_code, self.app_code)
         a.set_value_with_idx(a.account_id, unity_c37r.c_sharp_get_string(reader, 0))
         a.set_value_with_idx(a.nick, unity_c37r.c_sharp_get_string(reader, 1))
         a.set_value_with_idx(a.account, unity_c37r.c_sharp_get_string(reader, 2))
         a.set_value_with_idx(a.password, unity_c37r.c_sharp_get_string(reader, 3))
         pic = unity_c37r.c_sharp_get_string(reader, 4)
         pic = os.path.join(self.mnt, pic)
         if os.path.exists(pic):
             #a.set_value_with_idx(os.path.join(self.app_code, ))
             ppath,pname = os.path.split(pic)
             a.set_value_with_idx(a.photo, self.app_code + '/' + pname)
             pass # copy file...
         a.set_value_with_idx(a.telephone, unity_c37r.c_sharp_get_string(reader, 5))
         gender = unity_c37r.c_sharp_get_long(reader, 6)
         rg = '0'
         if gender == 0:
             rg = '0'
         elif gender == 1:
             rg = '1'
         elif gender == 2:
             rg = '2'
         elif gender == 9:
             rg = '9'
         a.set_value_with_idx(a.sex_code, rg)
         a.set_value_with_idx(a.age, unity_c37r.c_sharp_get_long(reader, 7))
         #a.set_value_with_idx(a.country_code, unity_c37r.c_sharp_get_string(reader, 8)) # NOT SUPPORT RIGHT NOW!!!!
         a.set_value_with_idx(a.city, unity_c37r.c_sharp_get_string(reader, 9))
         #a.set_value_with_idx(a.signature, unity_c37r.c_sharp_get_string(reader, ))
         a.set_value_with_idx(a.address, unity_c37r.c_sharp_get_string(reader, 12))
         a.set_value_with_idx(a.birth, unity_c37r.c_sharp_get_string(reader, 13))
         a.set_value_with_idx(a.signature, unity_c37r.c_sharp_get_string(reader, 14))
         d = unity_c37r.c_sharp_get_string(reader, 15)
         a.set_value_with_idx(a.signature, d)
         # not support delete time
         unity_c37r.execute_query(self.cmd, TBL_BCP_INSERT_ACCOUNT, a.get_values())
     self.db_commit()
     reader.Close()
     cmds.Dispose()
     conn.Close()
Ejemplo n.º 4
0
 def generate_shop_bcp(self):
     conn = unity_c37r.create_connection(self.cache_db)
     cmds = sql.SQLiteCommand(conn)
     cmds.CommandText = '''
         select * from tb_shop
     '''
     reader = cmds.ExecuteReader()
     while reader.Read():
         s = ShopInfo()
         s.set_value_with_idx(s.colltection_target_id, self.colltection_target_id)
         s.set_value_with_idx(s.app_code, self.app_code)
         s.set_value_with_idx(s.account_id, unity_c37r.c_sharp_get_string(reader, 0))
         s.set_value_with_idx(s.shop_id, unity_c37r.c_sharp_get_string(reader, 1))
         s.set_value_with_idx(s.shop_name, unity_c37r.c_sharp_get_string(reader, 2))
         s.set_value_with_idx(s.boss_id, unity_c37r.c_sharp_get_string(reader, 3))
         s.set_value_with_idx(s.boss_account, unity_c37r.c_sharp_get_string(reader, 4))
         s.set_value_with_idx(s.boss_nick, unity_c37r.c_sharp_get_string(reader, 5))
         s.set_value_with_idx(s.delete_status, unity_c37r.c_sharp_get_long(reader, 6))
         unity_c37r.execute_query(self.cmd, TBL_BCP_INSERT_SHOP, s.get_values())
     reader.Close()
     cmds.Dispose()
     conn.Close()
Ejemplo n.º 5
0
 def db_insert_file_list(self, fl):
     unity_c37r.execute_query(self.cmd, TBL_BCP_INSERT_FILELIST,
                              fl.get_values())
Ejemplo n.º 6
0
 def db_insert_transfer(self, t):
     unity_c37r.execute_query(self.cmd, TBL_BCP_INSERT_TRANSFER,
                              t.get_values())
Ejemplo n.º 7
0
 def db_insert_account(self, a):
     unity_c37r.execute_query(self.cmd, TBL_BCP_INSERT_ACCOUNT,
                              a.get_values())
Ejemplo n.º 8
0
 def db_insert_version(self, v_key, v_val):
     unity_c37r.execute_query(self.cmd, unity_c37r.TBL_INSERT_VERSION,
                              [v_key, v_val])
Ejemplo n.º 9
0
 def db_insert_key(self, k):
     unity_c37r.execute_query(self.cmd, TBL_INSERT_IME_DICT, k.get_values())