Sorry guys here is the full code for the class:

#!/usr/bin/python
# Echo client program
import cx_Oracle
import socket
import pprint
from struct import *
import sys
from binascii import *
import time
import datetime


class StringCall:
        results=[]
        def databasebatchcall(self,termid, batchid):
                con = 
cx_Oracle.connect('user/user...@odb4.dcc.company.ie/ODB4TEST.COMPANY.IE')
                cur = con.cursor()
                cur.execute("SELECT * from name)
                results = cur.fetchall()
                
        
        def fetchbatchdata(self,results):
                
                for row in results:
                        mer = row[0].ljust(25, ' ')
                        mercity = row[1].ljust(13, ' ')
                        mertype = row[2]
                        merloc = row[3]
                        mercount = row[4]
                        mersec = row[5]
                        acq = row[6]
                        btime = row[7].strftime('%d%m')
                        bmerch = str(row[8]).rjust(12, '0')
                        termcur = row[9]
                        acqbank = str(row[10]).rjust(24, '0')
                        termtype = row[11]
                        termsoftver = row[12]
                        merbatch = str(row[13]).rjust(3, '0')
                        reccount = str(row[14]).rjust(9, '0')
                        amounttotal = str(row[15]).rjust(16, '0')
                        cashback = str(row[16]).rjust(16, '0')
                        deposit = str(row[17]).rjust(16, '0')
                
        def createbatchstrings(self):
                BatchHeaderPacket = 
"\x01000\x0251.520%s00000%s000006060001%s%s%s%s0003 \x03" % (btime, bmerch, 
termcur, acqbank, termtype, termsoftver);
                ParameterPacket = 
"\x01001\x0251.5300000401%s%sIE%s%s%s00000%s%s0%s                    \x03" % 
(mer, mercity, mertype, merloc, termid, mercount, mersec, acq);
                TrailerPacket = 
"\x01003\x0251.550%s00%s%s%s%s%s00000000000\x03" % (btime, merbatch, reccount, 
amounttotal, cashback, deposit);
                cur.close()

        def returnbatchheader(self):
                return BatchHeaderPacket
        def returnparameterpacket(self):
                return ParameterPacket
        def returntrailerpacket(self):
                return TrailerPacket
                
        
                
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to