Skip to content

Commit a7b2469

Browse files
author
Daniel Kinzler
committed
pass port to mysql_connect
git-svn-id: https://svn.toolserver.org/svnroot/daniel/duesenstuff/trunk/gpClient@577 9f2c43bc-b3c0-43f4-b155-41619b16f219
1 parent f72b725 commit a7b2469

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

python/gp/client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,22 @@ def getProtocolVersion(self):
13011301

13021302
return self._protocol_version
13031303

1304+
def supportsProtocolVersion(self, min_version, max_version = None): #TODO: port to PHP
1305+
"""returns True if the peer's protocol version is at least
1306+
min_version and, if given, no grater than max_version.
1307+
"""
1308+
1309+
version = self.getProtocolVersion()
1310+
version = float(version)
1311+
1312+
if min_version and version < min_version:
1313+
return False
1314+
1315+
if max_version and version > max_version:
1316+
return False
1317+
1318+
return True
1319+
13041320

13051321
def checkProtocolVersion(self):
13061322
"""Can raise a gpProtocolException.
@@ -1309,6 +1325,7 @@ def checkProtocolVersion(self):
13091325
peer is not compatible with MIN_PROTOCOL_VERSION and MAX_PROTOCOL_VERSION.
13101326
13111327
"""
1328+
13121329
version = self.getProtocolVersion()
13131330
version = float(version)
13141331

python/gp/mysql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ def set_unbuffered(self, unbuffered ):
315315
self.unbuffered = unbuffered
316316

317317

318-
def mysql_connect( self, server, username, password, db ):
318+
def mysql_connect( self, server, username, password, db, port = 3306 ):
319319
#FIXME: connection charset, etc!
320320

321321
#try:
322-
self.connection = MySQLdb.connect(host=server, user=username, passwd=password, db = db)
322+
self.connection = MySQLdb.connect(host=server, user=username, passwd=password, db = db, port = port)
323323

324324
#XXX: would be nice to wrap the exception and provide additional info.
325325
# but without exception chaining, we lose the traceback. wich is bad.

0 commit comments

Comments
 (0)