Exemple #1
0
 def _get_connection(self):
     if self._connection is None:
         if exists(self.local_db_path):
             # since version metadata is filled in last in datacache,
             # checking for a version also implicitly checks for
             # having finishing fill in all the tables/rows.
             #
             # TODO: expose this more explicitly in datacache
             #
             self._connection = datacache.connect_if_correct_version(
                 self.local_db_path, DATABASE_SCHEMA_VERSION)
     return self._connection
Exemple #2
0
 def _get_connection(self):
     if self._connection is None:
         db_path = self.local_db_path()
         if exists(db_path):
             # since version metadata is filled in last in datacache,
             # checking for a version also implicitly checks for
             # having finishing fill in all the tables/rows.
             #
             # TODO: expose this more explicitly in datacache
             #
             self._connection = datacache.connect_if_correct_version(db_path, DATABASE_SCHEMA_VERSION)
     return self._connection
Exemple #3
0
 def _connect_if_exists(self):
     """
     Return the connection if the DB exists, and otherwise return
     None. As a side effect, stores the database connection in
     self._connection.
     """
     if self._connection is None:
         db_path = self.local_db_path()
         if exists(db_path):
             # since version metadata is filled in last in datacache,
             # checking for a version also implicitly checks for
             # having finishing fill in all the tables/rows.
             #
             # TODO: expose this more explicitly in datacache
             #
             self._connection = datacache.connect_if_correct_version(db_path, DATABASE_SCHEMA_VERSION)
     return self._connection