Commit b85c1cf6 authored by Nicolas Dumazet's avatar Nicolas Dumazet

support sockets in SQL connection strings


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42366 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 653a4623
...@@ -244,8 +244,14 @@ def getMySQLArguments(): ...@@ -244,8 +244,14 @@ def getMySQLArguments():
host = '' host = ''
db, user = connection_string.split(' ', 1) db, user = connection_string.split(' ', 1)
sock = ''
if ' ' in user: # look for user password if ' ' in user: # look for user password
user, password = user.split() sp = user.split()
if len(sp) == 2:
user, password = sp
elif len(sp) == 3:
user, password, sock = sp
sock = '--socket=%s' % sock
password = '-p%s' % password password = '-p%s' % password
if "@" in db: # look for hostname if "@" in db: # look for hostname
...@@ -256,7 +262,7 @@ def getMySQLArguments(): ...@@ -256,7 +262,7 @@ def getMySQLArguments():
else: else:
host = '-h %s' % host host = '-h %s' % host
return '-u %s %s %s %s' % (user, password, host, db) return '-u %s %s %s %s %s' % (user, password, host, db, sock)
def getExtraSqlConnectionStringList(): def getExtraSqlConnectionStringList():
"""Return list of extra available SQL connection string """Return list of extra available SQL connection string
......
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