PDA

View Full Version : Non standard primary key in Interbase DB doesn't work with QSqlQuery



borisbn
3rd April 2010, 08:43
Hi. I have a database in Interbase 7.5, that has a non standard primary key ID CHAR(12) in table MAIN_TABLE. This is not a string, but a 96-bits number, that can contains a zero byte within it. When I'm trying to bindValue to QSqlQuery like this:


QSqlQuery q( db );
q.prepare( "select * from main_table where id = :id" );
q.bindValue( ":id", QByteArray( char12_id, 12 ) );

where char12_id is a char[12], that was get from main_table earlier (with module, created by Builder's IBX), I'm receiving wrong results or nothing.
The database is not mine, that's why I can't modify it (unfortunatly)

P.S. Sorry for my English - it's not my "mother tongue"

instruments: Qt 4.6.2, MSVC 2008, Interbase 7.5

ecanela
3rd April 2010, 10:22
i dont understand. the type of the field id is CHAR(12) but the data storage is a 96 bit number?

borisbn
3rd April 2010, 11:32
I mean, that field id CHAR(12) is not a zero-finished string. Fields ID are numerical values with 12 bytes length, which equals to 96 bits. Each byte can contain ANY value, including zero