Beispiel #1
0
    def copytableschema(self, tablename):
        try:

            iTable = ""
            listsourceTable = listtables(self.m_sourceSession.nominalSchema(),
                                         tablename)
            listdestTable = listtables(self.m_destSession.nominalSchema(),
                                       tablename)
            self._checktable(listsourceTable, listdestTable)

            for key, value in listsourceTable.items():
                iTable = key
                print iTable
                self._copytablelayout(iTable)

            self.m_destSession.transaction().commit()
            self.m_sourceSession.transaction().commit()
            print "copytableschema SUCCESS"
            return True

        except Exception, e:
            self.m_destSession.transaction().rollback()
            self.m_sourceSession.transaction().commit()
            raise Exception("Error in copytableschema method: " + str(e) +
                            " : " + iTable)
            return False
Beispiel #2
0
 def copytabledata(self,tablename,selectionclause,selectionparameters,rowCount=-1 ):
  try:

   iTable=""
   listsourceTable=listtables( self.m_sourceSession.nominalSchema(),tablename )
   listdestTable=listtables( self.m_destSession.nominalSchema(),tablename )

   currentCount = 0
   for key,value in listsourceTable.items():
    iTable = key
    print iTable
    tableexists = self._checkdata(iTable,listdestTable)

    if not tableexists: 
       self._copytablelayout(iTable)

    self._copydatalayout(iTable,selectionclause,selectionparameters,currentCount,rowCount)

   self.m_destSession.transaction().commit()
   self.m_sourceSession.transaction().commit()
   print "copytabledata SUCCESS"
   return True

  except Exception, e:
   self.m_destSession.transaction().rollback()
   self.m_sourceSession.transaction().commit()
   raise Exception  ("Error in copytabledata method: " + str(e)+" : " + iTable)
   return False
Beispiel #3
0
 def copytableschema(self,tablename ):
  try:

   iTable=""
   listsourceTable=listtables( self.m_sourceSession.nominalSchema(),tablename )
   listdestTable=listtables(self.m_destSession.nominalSchema(),tablename )
   self._checktable(listsourceTable,listdestTable)

   for key,value in listsourceTable.items():
    iTable = key
    print iTable
    self._copytablelayout(iTable)

   self.m_destSession.transaction().commit()
   self.m_sourceSession.transaction().commit()
   print "copytableschema SUCCESS"
   return True

  except Exception, e:
   self.m_destSession.transaction().rollback()
   self.m_sourceSession.transaction().commit()
   raise Exception ("Error in copytableschema method: " + str(e)+" : "+iTable)
   return False
Beispiel #4
0
    def copytabledata(self,
                      tablename,
                      selectionclause,
                      selectionparameters,
                      rowCount=-1):
        try:

            iTable = ""
            listsourceTable = listtables(self.m_sourceSession.nominalSchema(),
                                         tablename)
            listdestTable = listtables(self.m_destSession.nominalSchema(),
                                       tablename)

            currentCount = 0
            for key, value in listsourceTable.items():
                iTable = key
                print iTable
                tableexists = self._checkdata(iTable, listdestTable)

                if not tableexists:
                    self._copytablelayout(iTable)

                self._copydatalayout(iTable, selectionclause,
                                     selectionparameters, currentCount,
                                     rowCount)

            self.m_destSession.transaction().commit()
            self.m_sourceSession.transaction().commit()
            print "copytabledata SUCCESS"
            return True

        except Exception, e:
            self.m_destSession.transaction().rollback()
            self.m_sourceSession.transaction().commit()
            raise Exception("Error in copytabledata method: " + str(e) +
                            " : " + iTable)
            return False