DDBI update

bobef bobef at nospam-abv.bg
Thu Oct 30 11:37:30 PDT 2008


> I want feedback! In particular regarding how to fetch values not as strings 

I imagine the db engines return something like this:

struct {
  int type;
  int int_data;
  char* char_data;
  bool bool_data;
  etc etc_data;
}

So I image Row.get should look like this:

T get (T=char[])(int idx) {
  static if(is(T == char[])) {
    if(fieldtype == string) return field.char_data;
    else if(fieldtype == int) return toString(field.int_data);
    else throw new Exception("Don't know how to convert from "~field.typename~" to "~T.stringof);
  }
  else static if() etc....
}

At least this is what I do with Sciter to work seamlessly with D, and this is what I plan to do with sqlite soon, if there is no other project doing it :) In my experience this stuff works great.

Regards,
bobef


More information about the Digitalmars-d-announce mailing list