embeddable early-binded database

Discussion in 'C++' started by CAFxX, Mar 18, 2006.

  1. CAFxX

    CAFxX Guest

    hi all,
    I was wondering whenever it is possible to write an embeddable
    early-binding database in c++ (mainly for performance reasons).
    the point is that often the programmer knows at compile time the
    structure of the tables he uses, so why not trying to take advantage of
    this to gain something in speed (and maybe size) (e.g. by allowing the
    compiler to inline the right comparison operator)?
    conceptually it isn't very different from one of the STL containers like
    map, except that instead of a single key-value pair, it can hold
    multiple pairs (in the example below i called them indexes) and even
    just values (fields).

    for example:

    // myLog is the user-defined struct
    struct myLogStruct {
    table::index <time_t> Timestamp;
    table::index <unsigned> Resource;
    table::field <unsigned> IP;
    };

    typedef table<myLogStruct> myLogTable;

    [...]

    // suppose we need to insert a new row
    myLogTableInstance.Insert( myTimestamp, myResource, myIP );

    // or, similarly,
    myLogStructInstance.Timestamp = myTimestamp;
    myLogStructInstance.Resource = myResource;
    myLogStructInstance.IP = myIP;
    myLogTableInstance.Insert( myLogStructInstance );

    // then we may need to select all rows with Timestamp greater than some
    // value
    myLogTableInstance2 = myLogTableInstance.Select(myLogStruct::Timestamp)
    > myTimestamp;


    // finally, we may need to walk the table
    for (myLogTableIterator = myLogTableInstance2.First();
    myLogTableIterator != myLogTableInstance2.Last(); myLogTableIterator++)
    doSomething();


    has anyone ever seen something like this? do you think is it technically
    possible (and/or worth)?

    bye, CAFxX.
     
    CAFxX, Mar 18, 2006
    #1
    1. Advertising

  2. CAFxX

    CAFxX Guest

    CAFxX ha scritto:
    > // then we may need to select all rows with Timestamp greater than some
    > // value
    > myLogTableInstance2 = myLogTableInstance.Select(myLogStruct::Timestamp)
    > > myTimestamp;


    sorry, the line above should be

    myLogTableInstance2 = myLogTableInstance.Timestamp > myTimestamp;
     
    CAFxX, Mar 18, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?B?bW9vcJk=?=

    Looking for embeddable Java alternatives

    =?iso-8859-1?B?bW9vcJk=?=, Dec 13, 2005, in forum: Java
    Replies:
    2
    Views:
    336
    Roedy Green
    Dec 13, 2005
  2. Silvain Piree

    Re: Embeddable XML Database

    Silvain Piree, Jun 30, 2003, in forum: XML
    Replies:
    0
    Views:
    834
    Silvain Piree
    Jun 30, 2003
  3. Mirch Masala

    Re: Embeddable XML Database

    Mirch Masala, Jun 30, 2003, in forum: XML
    Replies:
    0
    Views:
    928
    Mirch Masala
    Jun 30, 2003
  4. george jetson

    Embeddable Pcode compiler/interpreter Serial EEPROM

    george jetson, Jul 7, 2004, in forum: C Programming
    Replies:
    1
    Views:
    460
    Grumble
    Jul 9, 2004
  5. dungdang
    Replies:
    2
    Views:
    409
    dungdang
    Jun 13, 2007
Loading...

Share This Page