Database interface design - was how to build up the library.

Sean Kelly sean at invisibleduck.org
Fri Oct 7 11:44:14 PDT 2011


On Oct 7, 2011, at 10:14 AM, Adam Ruppe wrote:

> In my database.d, I used a database row struct to provide both
> integer and key based indexes.

Funny… I have a ResultSet object which contains an array of Column objects.  Here's the basic idea:

class ResultSet {
    static class Column {
        int index();
        string name();
        int size();
        int length();
        void[] data();
        bool opEquals(NullValue);
        T as(T)(); // return raw if T matches underlying or call to!(T) on field as appropriate
    }

    size_t numCols();
    bool nextResultSet();
    bool next();
    bool prev();
    bool first();
    bool last();
    void update(); // SQLSetPos(rowNumber=0)
    Column opIndex(size_t);
    // easy enough to add opIndex(string)
}

Does your Row equate to the ResultSet as above?


More information about the Digitalmars-d mailing list