當前位置: 首頁>>代碼示例>>Python>>正文


Python DBSession.commit方法代碼示例

本文整理匯總了Python中base_models.DBSession.commit方法的典型用法代碼示例。如果您正苦於以下問題:Python DBSession.commit方法的具體用法?Python DBSession.commit怎麽用?Python DBSession.commit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在base_models.DBSession的用法示例。


在下文中一共展示了DBSession.commit方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: save

# 需要導入模塊: from base_models import DBSession [as 別名]
# 或者: from base_models.DBSession import commit [as 別名]
def save():
    print('{line} -> {ip} {forwarder} {is_send} {mti} {bits}'.format(
        line=r_log.line, ip=ip, forwarder=forwarder, is_send=is_send, mti=mti,
        bits=bits))
    r_iso = Iso()
    r_iso.id = conf.nilai_int = r_log.id
    r_iso.tgl = r_log.tgl
    r_iso.jenis_id = r_log.jenis_id
    r_iso.kategori_id = r_log.kategori_id
    r_iso.ip = ip
    r_iso.forwarder = forwarder
    r_iso.is_send = is_send
    r_iso.mti = mti
    for key in bits:
        value = bits[key]
        n = str(key).zfill(3)
        fieldname = 'bit_{n}'.format(n=n)
        setattr(r_iso, fieldname, value)
    DBSession.add(r_iso)
    conf.updated = create_now()
    DBSession.add(conf)
    try:
        DBSession.flush()
    except IntegrityError as err:
        s_err = str(err)
        if s_err.find('duplicate key') > -1:
            print('  sudah ada')
            DBSession.rollback()
        else:
            raise(err)
    DBSession.commit()
開發者ID:opensipkd,項目名稱:iso8583-forwarder,代碼行數:33,代碼來源:log2iso.py

示例2: inquiry_request_handler

# 需要導入模塊: from base_models import DBSession [as 別名]
# 或者: from base_models.DBSession import commit [as 別名]
 def inquiry_request_handler(self):
     try:
         self.save_request_log()
         self._inquiry_request_handler()
         self.save_response_log()
         DBSession.commit()
     except:
         self.ack_unknown()
開發者ID:opensipkd,項目名稱:iso8583-forwarder,代碼行數:10,代碼來源:DbTransaction.py

示例3: set_unpaid

# 需要導入模塊: from base_models import DBSession [as 別名]
# 或者: from base_models.DBSession import commit [as 別名]
 def set_unpaid(self):
     pay = Reversal.set_unpaid(self)
     if not pay:
         q = DBSession.query(self.models.Payment).filter_by(
             propinsi=self.invoice.kd_propinsi,
             kabupaten=self.invoice.kd_dati2,
             kecamatan=self.invoice.kd_kecamatan,
             kelurahan=self.invoice.kd_kelurahan,
             blok=self.invoice.kd_blok,
             urut=self.invoice.no_urut,
             jenis=self.invoice.kd_jns_op,
             tahun=self.invoice.thn_pajak_sppt)
         q.delete()
     DBSession.commit()
開發者ID:opensipkd,項目名稱:iso8583-forwarder,代碼行數:16,代碼來源:ReversalByQuery.py

示例4: commit

# 需要導入模塊: from base_models import DBSession [as 別名]
# 或者: from base_models.DBSession import commit [as 別名]
 def commit(self):
     DBSession.commit()
     OtherDBSession.commit()
開發者ID:opensipkd,項目名稱:iso8583-forwarder,代碼行數:5,代碼來源:DbTransaction.py

示例5: commit

# 需要導入模塊: from base_models import DBSession [as 別名]
# 或者: from base_models.DBSession import commit [as 別名]
 def commit(self):
     DBSession.commit()
     self.parent.ack()
開發者ID:opensipkd,項目名稱:iso8583-forwarder,代碼行數:5,代碼來源:__init__.py

示例6: save_conf

# 需要導入模塊: from base_models import DBSession [as 別名]
# 或者: from base_models.DBSession import commit [as 別名]
def save_conf():
    conf.nilai_int = r_iso.id
    conf.updated = create_now()
    DBSession.add(conf)
    DBSession.flush()
    DBSession.commit()
開發者ID:opensipkd,項目名稱:iso8583-forwarder,代碼行數:8,代碼來源:iso-summary.py


注:本文中的base_models.DBSession.commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。