Commit 50a09211 authored by Vincent Pelletier's avatar Vincent Pelletier

Rename method to get a superuser SQL connection.

Previous name was too close to the regular-user SQL connection getter.
Also, prevent subclasses from calling it.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2219 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 979dfce4
...@@ -228,7 +228,7 @@ class NEOCluster(object): ...@@ -228,7 +228,7 @@ class NEOCluster(object):
self.uuid_set.add(uuid) self.uuid_set.add(uuid)
return uuid return uuid
def getSqlConnection(self): def __getSuperSQLConnection(self):
# Cleanup or bootstrap databases # Cleanup or bootstrap databases
connect_arg_dict = {'user': self.db_super_user} connect_arg_dict = {'user': self.db_super_user}
password = self.db_super_password password = self.db_super_password
...@@ -237,7 +237,7 @@ class NEOCluster(object): ...@@ -237,7 +237,7 @@ class NEOCluster(object):
return MySQLdb.Connect(**connect_arg_dict) return MySQLdb.Connect(**connect_arg_dict)
def setupDB(self): def setupDB(self):
sql_connection = self.getSqlConnection() sql_connection = self.__getSuperSQLConnection()
cursor = sql_connection.cursor() cursor = sql_connection.cursor()
for database in self.db_list: for database in self.db_list:
cursor.execute('DROP DATABASE IF EXISTS `%s`' % (database, )) cursor.execute('DROP DATABASE IF EXISTS `%s`' % (database, ))
...@@ -250,7 +250,7 @@ class NEOCluster(object): ...@@ -250,7 +250,7 @@ class NEOCluster(object):
sql_connection.close() sql_connection.close()
def switchTables(self, database): def switchTables(self, database):
sql_connection = self.getSqlConnection() sql_connection = self.__getSuperSQLConnection()
cursor = sql_connection.cursor() cursor = sql_connection.cursor()
cursor.execute('use %s' % (database, )) cursor.execute('use %s' % (database, ))
cursor.execute('rename table obj to tmp') cursor.execute('rename table obj to tmp')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment