Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database_info(isc_info_firebird_version) fails opn amd64 linux [PYFB16] #39

Closed
firebird-automations opened this issue Apr 10, 2012 · 4 comments

Comments

@firebird-automations
Copy link

Submitted by: Treeve Jelbert (treeve)

Assigned to: @pmakowski

isc_info_firebird_version fails with TypeError: 'an integer is required'

I tried using the python debugger and got the following data

$ ./test
>
/usr/lib/python2.7/site-packages/sqlalchemy/dialects/firebird/fdb.py(155)_get_server_version_in$
-> fbconn = connection.connection
(Pdb) c
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(780)database_info()
-> if ord2(res_buf[i]) != isc_info_end:
(Pdb) p res_buf
'g\x80\x00\x03\x1cLI-V2.5.2.26455 Firebird 2.50LI-V2.5.2.26455 Firebird 2.5/tcp
(Gemini-64)/P120LI-V2.5.2.26455 Firebird 2.5/tcp
(Gemini-64)/P12\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$
(Pdb) p i
131
(Pdb) s
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(783)database_info()
-> if request_buffer[0] != res_buf[0]:
(Pdb) p request_buffer[0]
'g'
(Pdb) s
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(785)database_info()
-> if result_type.upper() == 'I':
(Pdb) s
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(787)database_info()
-> elif (result_type.upper() == 'S'
(Pdb)
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(788)database_info()
-> and info_code not in _DATABASE_INFO__KNOWN_LOW_LEVEL_EXCEPTIONS):
(Pdb)
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(792)database_info()
-> return ctypes.string_at(res_buf[3:], i - 3)
(Pdb)
--Call--
> /usr/lib/python2.7/ctypes/__init__.py(495)string_at()
-> def string_at(ptr, size=-1):
(Pdb)
> /usr/lib/python2.7/ctypes/__init__.py(499)string_at()
-> return _string_at(ptr, size)
(Pdb)
--Return--
> /usr/lib/python2.7/ctypes/__init__.py(499)string_at()->'\x03\x1cLI-V...emini-64)/P12'
-> return _string_at(ptr, size)
(Pdb)
--Return-->
/usr/lib/python2.7/site-packages/fdb/fbcore.py(792)database_info()->'\x03\x1cLI-V...emini-64)/P$
-> return ctypes.string_at(res_buf[3:], i - 3)
(Pdb)
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(892)db_info()
-> pos = 1
(Pdb)
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(894)db_info()
-> versionStringLen = (struct.unpack('B',
(Pdb)
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(895)db_info()

(Pdb)
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(895)db_info()
-> int2byte(buf[pos]))[0])
(Pdb) unt
--Return--
> /usr/lib/python2.7/site-packages/fdb/fbcore.py(895)db_info()->None
-> int2byte(buf[pos]))[0])
(Pdb)
TypeError: 'an integer is required'

Commits: 9bf1220

@firebird-automations
Copy link
Author

Commented by: @pmakowski

hum sorry, the code is ok under Python3, but not under Python2
thanks for the report

just a not for SQLAlchemy, if you xant to determine the database dialect (1 or 3) better to use, :
con.database_info(fdb.isc_info_db_sql_dialect,'i'))
the actual code in SQLA only try to get the serveur version, not the database dialect it seems

Python 3.2.1 (default, Jul 11 2011, 18:54:42)
[GCC 4.6.1 20110627 (Red Hat 4.6.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fdb
>>> con = fdb.connect(dsn='localhost:employee',user='sysdba', password='masterke')
>>> print(con.database_info(fdb.isc_info_db_sql_dialect,'i'))
3
>>> print(con.db_info([fdb.isc_info_implementation]))
{11: (66, 1)}
>>> print(con.db_info([fdb.isc_info_db_sql_dialect,fdb.isc_info_firebird_version]))
{62: 3, 103: 'LI-V2.5.2.26389 Firebird 2.5'}

@firebird-automations
Copy link
Author

Commented by: @pmakowski

fix in rev 54361
you can take the fix from https://firebird.svn.sourceforge.net/svnroot/firebird/python/fdb/trunk

@firebird-automations
Copy link
Author

Modified by: @pmakowski

assignee: Pavel Cisar [ pcisar ] => Philippe Makowski [ makowski ]

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 0.8.0 [ 10464 ]

@firebird-automations
Copy link
Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant