diff --git a/django/db/backends/oracle/query.py b/django/db/backends/oracle/query.py
index 85e2f68..c049004 100644
|
a
|
b
|
def query_class(QueryClass, Database):
|
| 25 | 25 | pass |
| 26 | 26 | |
| 27 | 27 | class OracleQuery(QueryClass): |
| | 28 | def __reduce__(self): |
| | 29 | """ |
| | 30 | Enable pickling for this class (normal pickling handling doesn't |
| | 31 | work as Python can only pickle module-level classes by default). |
| | 32 | """ |
| | 33 | if hasattr(QueryClass, '__getstate__'): |
| | 34 | assert hasattr(QueryClass, '__setstate__') |
| | 35 | data = self.__getstate__() |
| | 36 | else: |
| | 37 | data = self.__dict__ |
| | 38 | return (unpickle_query_class, (QueryClass,), data) |
| | 39 | |
| 28 | 40 | def resolve_columns(self, row, fields=()): |
| 29 | 41 | index_start = len(self.extra_select.keys()) |
| 30 | 42 | values = [self.convert_values(v, None) for v in row[:index_start]] |
| … |
… |
def query_class(QueryClass, Database):
|
| 143 | 155 | |
| 144 | 156 | _classes[QueryClass] = OracleQuery |
| 145 | 157 | return OracleQuery |
| | 158 | |
| | 159 | def unpickle_query_class(QueryClass): |
| | 160 | """ |
| | 161 | Utility function for handling unpickling of Oracle Query subclasses. This |
| | 162 | is called by Python's unpickling functions. |
| | 163 | """ |
| | 164 | # FIXME: Would be nice to not have any dependency on cx_Oracle here. Since |
| | 165 | # modules can't be pickled, we need a way to know to load the right module. |
| | 166 | import cx_Oracle |
| | 167 | |
| | 168 | klass = query_class(QueryClass, cx_Oracle) |
| | 169 | return klass.__new__(klass) |
| | 170 | unpickle_query_class.__safe_for_unpickling__ = True |
| | 171 | |