“DBA” v0.1


The MySQL interface is working, I wouldn’t call it complete. The SQLite interface is what I was going to work on tonight, I’ll see if I can get it working tomorrow.

Todo List:

  1. Get SQLite interface functioning,
  2. Unit tests,
  3. Windows and Mac,
  4. Auto-documentation,
  5. Convenience constructors,
  6. Source control,
  7. Add a Postgres interface,
  8. Features (such as parameter binding, column metadata retrieval),
  9. .NET API

That list will definitely grow :)

Notes on the development below:

I thought about making the column cursor ‘mutable’: This would allow me to make all the operator>>s const. And I like constness. But then again, I like constness to mean what it says, and mutable violates that.

I’m probably going to jump ahead and require C++0x for building the library, that’ll allow me to create a number of additional constructors without the need for code duplication

ResultSet::ResultSet(const Connection& conn, size_t stlen, const char* statement)

ResultSet::ResultSet(const Connection& conn, const std::string& statement)
: ResultSet(conn, statement.length(), statement.c_str()

Mmm :) (How sad is it that I get all giddy as I read through the Wiki page describing what’s going to be in C++0x? And that I almost say “awh” out loud when I read that concepts got tabled)

Also, when I was writing the crude test cases in main.cpp, the very first issue I ran into was that my test case used “ResultSet rs(conn, “SELECT NOW()”);” which isn’t yet supported.

The reason such a simple case isn’t supported? I wanted to allow a vsnprintf type constructor too, and unfortunately the fingerprints would conflict (no way in a varadic function to tell if there are no varadic arguments :(

After starting in Visual Studio, I moved the code to my Ubuntu box. I tried to use KDevelop 4, but couldn’t find a way to add an existing file to a project! Roflamo! So I wrote most of the code under MonoDevelop. When it came to fixing typos and compile errors etc, I ran into some issue with MonoDevelop – I think the error list was backwards or something weird like that, so I used Code::Blocks to finish it up because I’m more familiar with it.

Once I’ve gotten both the current interfaces working, I’m going to think about source control. I don’t know that I’ll put it on SourceForge – I’m not really trying to create the latest and greatest database api. But I like to have a “Work in Progress” project, and my old stalwart (an iteration of my MUD language) just hasn’t appealed to me lately.

The ultimate goal of this project is the .NET API. Not because the world doesn’t have enough cross-language database APIs already, not because I have spotted some unseen flaw in all the existing ones… Just because I want my own, non-trivial, end-to-end project :)

Lastly, while this does have some similarities to my in-house database API at Playnet (which is arguably more of an API over our code than an API over the database, and which is designed to save every last CPU cycle possible without making the application code cryptic), I wrote this from scratch on Sunday :-P

Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: