Ejemplo n.º 1
0
    def __init__(self, serialnumber):
        self.sn=serialnumber
        query="select * from tbl_hpidentification " \
            + " where serialnumber_pk = '" + serialnumber + "'"

        conn=getdb.getDBConn()
        st=conn.createStatement()
        rs=st.executeQuery(query)
        rsmd=rs.getMetaData()

        if not rs.next():
            raise "No results"

        self.__fields={}
        self.__columns=[]
        for i in range(rsmd.getColumnCount()):
            columnname=str(rsmd.getColumnName(i+1))
            self.__columns.append(columnname)
            self.__fields[columnname]=str(rs.getString(i+1))

        if rs.next():
            raise "Too many results"

        rs.close()
        st.close()
        conn.close()
Ejemplo n.º 2
0
    def __init__(self, serialnumber):
        self.sn = serialnumber
        query="select * from tbl_hpidentification " \
            + " where serialnumber_pk = '" + serialnumber + "'"

        conn = getdb.getDBConn()
        st = conn.createStatement()
        rs = st.executeQuery(query)
        rsmd = rs.getMetaData()

        if not rs.next():
            raise "No results"

        self.__fields = {}
        self.__columns = []
        for i in range(rsmd.getColumnCount()):
            columnname = str(rsmd.getColumnName(i + 1))
            self.__columns.append(columnname)
            self.__fields[columnname] = str(rs.getString(i + 1))

        if rs.next():
            raise "Too many results"

        rs.close()
        st.close()
        conn.close()
Ejemplo n.º 3
0
    def __initGroup(self, fileType, group):
        conn=getdb.getDBConn()
        pst=conn.prepareStatement(
            """select * from tbl_FileVersion_map_ref 
                where FileType_num_fk = ? and Group_idnum_fk = ?""")
        pst.setInt(1, fileType.getTypeId())
        pst.setInt(2, group.getId())

        matrix=com.twowire.compatibility.VersionMatrix()

        rs=pst.executeQuery()
        while rs.next():
            low=rs.getInt("CompatibilityFrom_num_fk")
            if rs.wasNull():
                low=None
            else:
                low=java.lang.Integer(low)
            high=rs.getInt("CompatibilityTo_num_fk")
            if rs.wasNull():
                high=None
            else:
                high=java.lang.Integer(high)
            vr=com.twowire.compatibility.VersionRange(
                low, high, java.lang.Integer(rs.getInt("FileVersion_num")))
            matrix.add(vr)
        rs.close()
        pst.close()
        conn.close()

        self.byGroup[(fileType, group)]=matrix
Ejemplo n.º 4
0
    def __initGroup(self, fileType, group):
        conn = getdb.getDBConn()
        pst = conn.prepareStatement("""select * from tbl_FileVersion_map_ref 
                where FileType_num_fk = ? and Group_idnum_fk = ?""")
        pst.setInt(1, fileType.getTypeId())
        pst.setInt(2, group.getId())

        matrix = com.twowire.compatibility.VersionMatrix()

        rs = pst.executeQuery()
        while rs.next():
            low = rs.getInt("CompatibilityFrom_num_fk")
            if rs.wasNull():
                low = None
            else:
                low = java.lang.Integer(low)
            high = rs.getInt("CompatibilityTo_num_fk")
            if rs.wasNull():
                high = None
            else:
                high = java.lang.Integer(high)
            vr = com.twowire.compatibility.VersionRange(
                low, high, java.lang.Integer(rs.getInt("FileVersion_num")))
            matrix.add(vr)
        rs.close()
        pst.close()
        conn.close()

        self.byGroup[(fileType, group)] = matrix
Ejemplo n.º 5
0
    def go(self):
        gws = lookupSerial.GatewaySerial(myserialnumber)
        gwb = gws.getGatewayBean()

        db = getdb.getDBConn(db='Aztec6')

        query="select * from tbl_HP where HPBox_num_fk_pk=" \
            + `gwb.getHPBoxNum()`
        st = db.createStatement()
        rs = st.executeQuery(query)

        getdb.dumpResults(rs)
Ejemplo n.º 6
0
    def go(self):
        gws=lookupSerial.GatewaySerial(myserialnumber)
        gwb=gws.getGatewayBean()

        db=getdb.getDBConn(db='Aztec6')

        query="select * from tbl_HP where HPBox_num_fk_pk=" \
            + `gwb.getHPBoxNum()`
        st=db.createStatement()
        rs=st.executeQuery(query)

        getdb.dumpResults(rs)
Ejemplo n.º 7
0
#!/usr/bin/env jython

import getdb

query1="select sourceipaddress, hpipaddress from tbl_hpidentification " \
    + " where sourceipaddress is not null or hpipaddress is not null"

conn = getdb.getDBConn()
st = conn.createStatement()
rs = st.executeQuery(query1)

count = 0
diff = 0
empty = 0
while rs.next():
    s = rs.getString("sourceipaddress").rstrip()
    h = rs.getString("hpipaddress").rstrip()

    if s == '' and h == '':
        empty += 1
    else:
        if s != h:
            diff += 1

        count += 1

        print s + "\t" + h

print "# Total IP addresses: ", count
print "# Different IP addresses: ", diff
print "# Empty IP addresses: ", empty
Ejemplo n.º 8
0
#!/usr/bin/env jython

import getdb

query="""
    select
            owner.firstname, owner.lastname,
            mfg.serialnumber
        from
            tbl_owner owner, tbl_hpmanufacturingdata mfg,
            tbl_hpowner_map map
        where
            owner.organization_num_fk = 74
            and owner.owner_idnum_pk = map.owner_idnum_fk
            and mfg.hpbox_num_pk = map.hpbox_num_fk
"""

conn=getdb.getDBConn()
st=conn.createStatement()
rs=st.executeQuery(query)
while rs.next():
    print rs.getString(1)
    print rs.getString(2)
    print rs.getString(3)
    print "--------"