Skip to content

Commit

Permalink
- Fix for PYFB-54 , PYFB-55 , PYFB-56 and PYFB-57
Browse files Browse the repository at this point in the history
  • Loading branch information
pcisar committed Aug 30, 2015
1 parent c56f710 commit 1c79dcd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fdb/fbcore.py
Expand Up @@ -163,7 +163,7 @@
from exceptions import NotImplementedError


__version__ = '1.4.9'
__version__ = '1.4.10'

apilevel = '2.0'
threadsafety = 1
Expand Down
18 changes: 14 additions & 4 deletions fdb/ibase.py
Expand Up @@ -1154,6 +1154,12 @@ class fbclient_API(object):
"""
def __init__(self,fb_library_name=None):

def get_key(key, sub_key):
try:
return winreg.OpenKey(key, sub_key)
except:
return None

if fb_library_name is None:
if sys.platform == 'darwin':
fb_library_name = find_library('Firebird')
Expand All @@ -1169,10 +1175,14 @@ def __init__(self,fb_library_name=None):
import _winreg as winreg

# try find via installed Firebird server
baseKey = 'SOFTWARE\Firebird Project\Firebird Server\Instances'
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, baseKey)
instFold = winreg.QueryValueEx(key,'DefaultInstance')
fb_library_name = os.path.join(os.path.join(instFold[0], 'bin'), 'fbclient.dll')
key = get_key(winreg.HKEY_LOCAL_MACHINE,
'SOFTWARE\Firebird Project\Firebird Server\Instances')
if not key:
key = get_key(winreg.HKEY_LOCAL_MACHINE,
'SOFTWARE\Wow6432Node\Firebird Project\Firebird Server\Instances')
if key:
instFold = winreg.QueryValueEx(key,'DefaultInstance')
fb_library_name = os.path.join(os.path.join(instFold[0], 'bin'), 'fbclient.dll')
else:
fb_library_name = find_library('fbclient')
if not fb_library_name:
Expand Down
10 changes: 5 additions & 5 deletions fdb/schema.py
Expand Up @@ -301,7 +301,7 @@ def __object_by_name(self,list,name):
def __clear(self,data=None):
if data:
data = data.lower()
if data not in ['tables','view','domains','indices','dependencies',
if data not in ['tables','views','domains','indices','dependencies',
'generators','sequences','triggers','procedures',
'constraints','collations','character sets',
'exceptions','roles','functions','files','shadows',
Expand Down Expand Up @@ -2464,9 +2464,9 @@ def _get_columns(self):
r.RDB$DEFAULT_SOURCE, r.RDB$COLLATION_ID, r.RDB$BASE_FIELD,
v.RDB$RELATION_NAME as BASE_RELATION
from RDB$RELATION_FIELDS r
left join RDB$VIEW_RELATIONS v on r.RDB$VIEW_CONTEXT = v.RDB$VIEW_CONTEXT
left join RDB$VIEW_RELATIONS v on r.RDB$VIEW_CONTEXT = v.RDB$VIEW_CONTEXT and v.rdb$view_name = ?
where r.RDB$RELATION_NAME = ?
order by RDB$FIELD_POSITION""",(self.name,))]
order by RDB$FIELD_POSITION""",(self.name,self.name))]
return self.__columns
def _get_privileges(self):
return [p for p in self.schema.privileges
Expand Down Expand Up @@ -3049,8 +3049,8 @@ def _get_owner_name(self):
return self._attributes['RDB$OWNER_NAME']
def _get_privileges(self):
return [p for p in self.schema.privileges
if ((p.subject_name == self.name) and
(p.subject_type in self._type_code))]
if ((p.user_name == self.name) and
(p.user_type in self._type_code))]

#--- Properties

Expand Down

0 comments on commit 1c79dcd

Please sign in to comment.