41
41
TransientError ,
42
42
TransactionError ,
43
43
)
44
- from neo4j .io import Neo4jPool
45
44
from neo4j .work import Workspace
46
45
from neo4j .work .result import Result
47
46
from neo4j .work .transaction import Transaction
@@ -78,13 +77,6 @@ class Session(Workspace):
78
77
# The current auto-transaction result, if any.
79
78
_autoResult = None
80
79
81
- # The set of bookmarks after which the next
82
- # :class:`.Transaction` should be carried out.
83
- _bookmarks = None
84
-
85
- # Sessions are supposed to cache the database on which to operate.
86
- _cached_database = False
87
-
88
80
# The state this session is in.
89
81
_state_failed = False
90
82
@@ -110,47 +102,10 @@ def __exit__(self, exception_type, exception_value, traceback):
110
102
self ._state_failed = True
111
103
self .close ()
112
104
113
- def _set_cached_database (self , database ):
114
- self ._cached_database = True
115
- self ._config .database = database
116
-
117
105
def _connect (self , access_mode ):
118
106
if access_mode is None :
119
107
access_mode = self ._config .default_access_mode
120
- if self ._connection :
121
- # TODO: Investigate this
122
- # log.warning("FIXME: should always disconnect before connect")
123
- self ._connection .send_all ()
124
- self ._connection .fetch_all ()
125
- self ._disconnect ()
126
- if not self ._cached_database :
127
- if (self ._config .database is not None
128
- or not isinstance (self ._pool , Neo4jPool )):
129
- self ._set_cached_database (self ._config .database )
130
- else :
131
- # This is the first time we open a connection to a server in a
132
- # cluster environment for this session without explicitly
133
- # configured database. Hence, we request a routing table update
134
- # to try to fetch the home database. If provided by the server,
135
- # we shall use this database explicitly for all subsequent
136
- # actions within this session.
137
- self ._pool .update_routing_table (
138
- database = self ._config .database ,
139
- imp_user = self ._config .impersonated_user ,
140
- bookmarks = self ._bookmarks ,
141
- database_callback = self ._set_cached_database
142
- )
143
- self ._connection = self ._pool .acquire (
144
- access_mode = access_mode ,
145
- timeout = self ._config .connection_acquisition_timeout ,
146
- database = self ._config .database ,
147
- bookmarks = self ._bookmarks
148
- )
149
-
150
- def _disconnect (self ):
151
- if self ._connection :
152
- self ._pool .release (self ._connection )
153
- self ._connection = None
108
+ super ()._connect (access_mode )
154
109
155
110
def _collect_bookmark (self , bookmark ):
156
111
if bookmark :
0 commit comments