Exemplo n.º 1
0
 def set_property(self, name: str, value: str):
     method_name = 'set' + name
     if method_name in dir(self._jconn):
         method = getattr(self._jconn, method_name)
     else:
         method = partial(self._jconn.setProperty, name)
     with reraise_jvm_exception(self._gateway):
         return method(value)
Exemplo n.º 2
0
 def fetchall(self):
     msg = ('Calling fetching all can cause memory errors '
            'in the py4jdbc gateway server. Consider using fetchmany '
            'instead.')
     self._logger.warning(msg)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.fetchAll()
     return self._make_rows(resp)
Exemplo n.º 3
0
 def fetchall(self):
     msg = ('Calling fetching all can cause memory errors '
            'in the py4jdbc gateway server. Consider using fetchmany '
            'instead.')
     self._logger.warning(msg)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.fetchAll()
     return self._make_rows(resp)
Exemplo n.º 4
0
 def set_property(self, name: str, value: str):
     method_name = 'set' + name
     if method_name in dir(self._jconn):
         method = getattr(self._jconn, method_name)
     else:
         method = partial(self._jconn.setProperty, name)
     with reraise_jvm_exception(self._gateway):
         return method(value)
Exemplo n.º 5
0
 def executemany(self, operation, parameter_seq):
     if self._closed:
         raise self.Error("Connection is closed.")
     with reraise_jvm_exception(self._gateway):
         rs = self.connection._conn.executeMany(operation, parameter_seq)
         if rs is None:
             del self._rs
             return
         self._rs = ResultSet(rs, gateway=self._gateway)
         return self._rs
Exemplo n.º 6
0
 def executemany(self, operation, parameter_seq):
     if self._closed:
         raise self.Error("Connection is closed.")
     with reraise_jvm_exception(self._gateway):
         rs = self.connection._conn.executeMany(operation, parameter_seq)
         if rs is None:
             del self._rs
             return
         self._rs = ResultSet(rs, gateway=self._gateway)
         return self._rs
Exemplo n.º 7
0
 def description(self):
     self._logger.debug('Getting cursor description.')
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.getDescription()
     return pickle.loads(resp)
Exemplo n.º 8
0
 def fetchmany(self, size=None):
     self._logger.debug("Batchsize is %d", size)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.fetchMany(size)
     return self._make_rows(resp)
Exemplo n.º 9
0
 def commit(self):
     with reraise_jvm_exception(self._gateway):
         self._jconn.commit()
Exemplo n.º 10
0
 def column_names(self):
     self._logger.info('Fetching column names: %r', self)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.colNames()
     return pickle.loads(resp)
Exemplo n.º 11
0
 def column_labels(self):
     self._logger.debug('Fetching column labels: %r', self)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.colLabels()
     return pickle.loads(resp)
Exemplo n.º 12
0
 def rollback(self):
     with reraise_jvm_exception(self._gateway):
         self._jconn.rollback()
Exemplo n.º 13
0
 def description(self):
     self._logger.debug('Getting cursor description.')
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.getDescription()
     return pickle.loads(resp)
Exemplo n.º 14
0
 def column_labels(self):
     self._logger.debug('Fetching column labels: %r', self)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.colLabels()
     return pickle.loads(resp)
Exemplo n.º 15
0
 def fetchmany(self, size=None):
     self._logger.debug("Batchsize is %d", size)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.fetchMany(size)
     return self._make_rows(resp)
Exemplo n.º 16
0
 def close(self):
     if self._closed:
         raise self.Error("Connection is already closed.")
     with reraise_jvm_exception(self._gateway):
         self._jconn.close()
         self._closed = True
Exemplo n.º 17
0
 def column_names(self):
     self._logger.info('Fetching column names: %r', self)
     with reraise_jvm_exception(self._gateway):
         resp = self._rs.colNames()
     return pickle.loads(resp)
Exemplo n.º 18
0
 def _close_last(self):
     if self._rs is not None:
         with reraise_jvm_exception(self._gateway):
             self._rs.close()
Exemplo n.º 19
0
 def rollback(self):
     with reraise_jvm_exception(self._gateway):
         self._jconn.rollback()
Exemplo n.º 20
0
 def commit(self):
     with reraise_jvm_exception(self._gateway):
         self._jconn.commit()
Exemplo n.º 21
0
 def close(self):
     if self._closed:
         raise self.Error("Connection is already closed.")
     with reraise_jvm_exception(self._gateway):
         self._jconn.close()
         self._closed = True
Exemplo n.º 22
0
 def _close_last(self):
     if self._rs is not None:
         with reraise_jvm_exception(self._gateway):
             self._rs.close()