Skip to content
Snippets Groups Projects
Commit 24c2d06a authored by esha's avatar esha
Browse files

Fixed empty arg. for mysql connection.

parent c9c0ec1e
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ lua dump = function(v) return box.cjson.encode(v) end
lua connect = {}
---
...
lua for tk in string.gmatch(os.getenv('MYSQL'), '[^:]+') do table.insert(connect, tk) end
lua for tk in string.gmatch(os.getenv('MYSQL')..':', '(.-):') do table.insert(connect, tk) end
---
...
lua c = box.net.sql.connect('mysql', unpack(connect))
......
......@@ -4,9 +4,6 @@ import os
try:
(host, port, user, password, db) = os.getenv('MYSQL').split(':')
for val in (host, port, user, password, db):
if not val.strip():
raise ValueError('Empty value')
if not os.path.exists(os.path.join(self.args.builddir, 'src/module/mysql/mysql.so')):
raise RuntimeError('No MySQL module found')
except (RuntimeError, TypeError, NameError, AttributeError, ValueError):
......
......@@ -22,7 +22,7 @@ exec admin "lua c = box.net.sql.connect('mysql')"
exec admin "lua dump = function(v) return box.cjson.encode(v) end"
exec admin "lua connect = {}"
exec admin "lua for tk in string.gmatch(os.getenv('MYSQL'), '[^:]+') do table.insert(connect, tk) end"
exec admin "lua for tk in string.gmatch(os.getenv('MYSQL')..':', '(.-):') do table.insert(connect, tk) end"
# mysql
exec admin "lua c = box.net.sql.connect('mysql', unpack(connect))"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment