Skip to content

Commit

Permalink
obscure hacks for the deveserver.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Jun 13, 2011
1 parent 5db65fd commit a7143bd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions MySQLdb/libmysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ class MYSQL_FIELD(ctypes.Structure):
MYSQL_OPT_CONNECT_TIMEOUT = 0
MYSQL_INIT_COMMAND = 3

loc = None
c = None
# Prefer the higher version, obscure.
for lib in ["libmysqlclient.so.16", "mysqlclient"]:
loc = find_library(lib)
if loc is not None:
try:
c = ctypes.CDLL(lib)
except OSError:
pass
else:
break
if loc is None:
if c is None:
raise ImportError("Can't find a libmysqlclient")
c = ctypes.CDLL(loc)

c.mysql_init.argtypes = [MYSQL_P]
c.mysql_init.restype = MYSQL_P
Expand Down

0 comments on commit a7143bd

Please sign in to comment.