Well Not Really Much Today

Well it is another planning day here in the Moose-pen

In my last post I did manage to get the change of name-space 'DAD' to 'Driver' done rather easily, thanks test suite, but I did leave an question open to me once I made the change. Have I the right name-space for my 'SQL' driver.

My plan so far was that I expected a DBI handle (DBI::db) was going to be passed into my Driver as some point. So would it not be better to call this driver 'Driver::DBI' than what I was originally thinking 'Driver::SQL'

Taking one step back I also want to make a 'Driver::Mongo' as well so I think the name-space change to DBI dose make sense. Now before I do that I want to take a closer look at DBI and its DBSs.

I did a quick count of all the DBDs out there and there are the numbers I came up with

  1. 60
  2. 42 and
  3. 2

So 60 is the number reserved DBD name-spaces found in DBI, 42 is the number of DBDs that work with a database and are still on CPAN ( Douglas Adams whould be proud of us) and 2 is the number of DBD that do not use SQL.

Ok so I am sold it is 'Database::Accessor::Driver::DBI' from here on in.

Now that leads me to the problem of the '2' outstanding DBDs and how to handle them?

From the very start I know there are a number of flavours of 'SQL'. Lets take one common example 'Oracle' until very recently (12c) has not have and auto-increment field so we programmers had to do little tricks like this in your SQL


insert into address (id,street,city,province)
values (address_sequence.nextval,'123 someplce','Ajax','On');

or hide them in the back end with a stored procedure.

Now to accomplish the above I am going to have to build into my 'Database::Accessor::Driver::DBI' is the ability to spot what 'DBD' is being used and then have some sort of mechanism to use the appropriate SQL dialect.

I am going to see if I can use Moose Roles for this and I will and the idea being I create a role and drop them in the “Database::Accessor::Driver::Roles” name-space and put them in separate distributions so one only installs the code one needs.

I think the above will also cover off the two DBD that do not use 'SQL' though the chap who will be riting that one up will be I think over-riding all of the code for 'Driver::DBI'.

Now to come up with a test case for the above even before I get programming. But that is tomorrow's post.

moosepooplamp.jpg

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations