Issue Details (XML | Word | Printable)

Key: ODBC-141
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Potapchenko
Reporter: Sasha
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ODBC Driver

Data corrupted in Libre Base on Fedora 64 bit

Created: 01/Mar/12 07:49 AM   Updated: 05/Jan/15 05:04 PM
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.0.3

Environment: Libre Base on Fedora 64 bit, self compiled OdbcFb-Source-2.0.0151.tar.gz


 Description  « Hide
Greetings. Thanks for so useful for many people driver. It works good in almost all situations. But in one situation appears problem:
in Libre Base on Fedora 64 bit contents of some tables appears corrupted, with other tables Base crashes.

Bugreport about this in LibreOffice bugtracker: https://bugs.freedesktop.org/show_bug.cgi?id=45881

Resolution of expert:
That's a driver bug. The driver uses the C/C++ dataype "long" for the SQL
datatype "Integer" and for ODBC C type identifier SQL_C_SLONG. It should use
the ODBC C typedef of SQLINTEGER for that, which depending on platforms will be
"int" or "long" or even (theoretically) something else.

Integer / SQL_INTEGER / SQL_C_SLONG / SQLINTEGER is a 32 bit integer.
On Windows (32 bit or 64 bit), long == int == 32 bit integer, so one can use
"long" or "int" interchangeably and the bug does not appear.
On most modern 32 bit Unices, long == int == 32 bit integer, so again the bug
does not appear.
On most modern 64 bit Unices, int == 32 bit integer and long == 64 bit integer,
so not the same one => need to use the right one.

That's why UnixODBC has:

#if (SIZEOF_LONG_INT == 8)
typedef int SQLINTEGER;
#else
typedef long SQLINTEGER;
#endif

See also

http://msdn.microsoft.com/en-us/library/windows/desktop/ms714556%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/ms713979%28v=vs.85%29.aspx
-----------------------end of cite--------------------------------------------------------------------------------------

some additional information about my experiments: https://bugs.freedesktop.org/show_bug.cgi?id=34432

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Potapchenko added a comment - 27/Mar/12 08:27 AM
Try 2.0.1 version please

Sasha added a comment - 27/Mar/12 09:43 AM
In version 2.0.1 still reproducible

Sasha added a comment - 05/Jan/15 05:04 PM
Thanks for fixing this bug