Esempio n. 1
0
    def _execute(self, query, args):
        if args:
            cur_id = 1
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packPRPSQLSTT(self.pkgid, self.pkgcnstkn, self.pkgsn,
                                  self.database), cur_id, True, False)
            cur_id = ddm.write_request_dds(self.sock, ddm.packSQLSTT(query),
                                           cur_id, False, False)
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packDSCSQLSTT(self.pkgid, self.pkgcnstkn, self.pkgsn,
                                  self.database), cur_id, False, True)
            _, _, params_description = self._parse_response()

            cur_id = 1
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packEXCSQLSTT(self.pkgid, self.pkgcnstkn, self.pkgsn,
                                  self.database), cur_id, True, False)
            cur_id = ddm.write_request_dds(
                self.sock, ddm.packSQLDTA(params_description, args,
                                          self.endian), cur_id, False, False)
            cur_id = ddm.write_request_dds(self.sock, ddm.packRDBCMM(), cur_id,
                                           False, True)
            self._parse_response()
        else:
            cur_id = 1
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packEXCSQLIMM(self.pkgid, self.pkgcnstkn, self.pkgsn,
                                  self.database), cur_id, True, False)
            cur_id = ddm.write_request_dds(self.sock, ddm.packSQLSTT(query),
                                           cur_id, False, False)
            cur_id = ddm.write_request_dds(self.sock, ddm.packRDBCMM(), cur_id,
                                           False, True)
            self._parse_response()
Esempio n. 2
0
    def _query(self, query, args):
        if args:
            cur_id = 1
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packPRPSQLSTT(self.pkgid, self.pkgcnstkn, self.pkgsn,
                                  self.database), cur_id, True, False)
            cur_id = ddm.write_request_dds(self.sock, ddm.packSQLSTT(query),
                                           cur_id, False, False)
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packDSCSQLSTT(self.pkgid, self.pkgcnstkn, self.pkgsn,
                                  self.database), cur_id, False, True)
            _, description, params_description = self._parse_response()

            cur_id = 1
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packOPNQRY_with_params(self.pkgid, self.pkgcnstkn,
                                           self.pkgsn, self.database), cur_id,
                True, False)
            cur_id = ddm.write_request_dds(
                self.sock, ddm.packSQLDTA(params_description, args,
                                          self.endian), cur_id, False, True)
            rows, _, _ = self._parse_response()

            cur_id = 1
            cur_id = ddm.write_request_dds(self.sock, ddm.packRDBCMM(), cur_id,
                                           False, True)
            _, _, _ = self._parse_response()

            return rows, description
        else:
            cur_id = 1
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packPRPSQLSTT(self.pkgid, self.pkgcnstkn, self.pkgsn,
                                  self.database), cur_id, True, False)
            cur_id = ddm.write_request_dds(self.sock, ddm.packSQLSTT(query),
                                           cur_id, False, False)
            cur_id = ddm.write_request_dds(
                self.sock,
                ddm.packOPNQRY(self.pkgid, self.pkgcnstkn, self.pkgsn,
                               self.database), cur_id, False, True)
            rows, description, params_description = self._parse_response()
            return rows, description
Esempio n. 3
0
 def _set_valiables(self):
     cur_id = 1
     cur_id = ddm.write_request_dds(
         self.sock, ddm.packEXCSAT_MGRLVLLS([cp.CCSIDMGR, 1208]), cur_id,
         False, False)
     cur_id = ddm.write_request_dds(
         self.sock, ddm.packEXCSQLSET(self.pkgid, None, 1, self.database),
         cur_id, True, False)
     cur_id = ddm.write_request_dds(
         self.sock,
         ddm.packSQLSTT("SET CLIENT WRKSTNNAME '{}'".format(
             platform.node())), cur_id, True, False)
     cur_id = ddm.write_request_dds(
         self.sock,
         ddm.packSQLSTT("SET CURRENT LOCALE LC_CTYPE='{}'".format(
             locale.getlocale()[0])), cur_id, False, False)
     cur_id = ddm.write_request_dds(self.sock, ddm.packRDBCMM(), cur_id,
                                    False, True)
     self._parse_response()
Esempio n. 4
0
 def close(self):
     cur_id = 1
     cur_id = ddm.write_request_dds(self.sock, ddm.packRDBCMM(), cur_id,
                                    False, True)
     self._parse_response()
     self.sock.close()