c++databaseoracle11guint64occi

Best way to store an unsigned 64 bit integer in Oracle Database 11g using OCCI


I'm using version 11.2 and there is no direct support for uint64 in table fields. What do you suggest to do performacewise? It must be the primary key.

Thanks


Solution

  • I'm using a RAW(8) data type, and write it with:

    uint64 i;
    Bytes key((unsigned char*)&i, 8);
    statement->setBytes(1, key);
    

    Fast and compact, and seems to work well.