Results 1 to 3 of 3

Thread: Non standard primary key in Interbase DB doesn't work with QSqlQuery

  1. #1
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Non standard primary key in Interbase DB doesn't work with QSqlQuery

    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:
    Qt Code:
    1. QSqlQuery q( db );
    2. q.prepare( "select * from main_table where id = :id" );
    3. q.bindValue( ":id", QByteArray( char12_id, 12 ) );
    To copy to clipboard, switch view to plain text mode 
    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
    Last edited by borisbn; 3rd April 2010 at 08:00. Reason: add instruments

  2. #2
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    81
    Thanks
    6
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Non standard primary key in Interbase DB doesn't work with QSqlQuery

    i dont understand. the type of the field id is CHAR(12) but the data storage is a 96 bit number?

  3. #3
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Non standard primary key in Interbase DB doesn't work with QSqlQuery

    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

Similar Threads

  1. Replies: 2
    Last Post: 21st January 2011, 17:12
  2. Replies: 1
    Last Post: 5th February 2009, 23:50
  3. Get primary and foreign keys from tables
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 5th November 2008, 11:16
  4. Replies: 2
    Last Post: 2nd June 2008, 08:45
  5. PRIMARY Selections
    By hayati in forum Newbie
    Replies: 9
    Last Post: 12th September 2006, 12:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.