Relationship classes now use the driver's methods.

The classes which manage the relationships no longer
construct sql statements, instead they call the proper
methods in the driver.
Added to the factory a method for loading layers.

Now it has a method that checks whether a layers is
loaded, and if it isn't, it tries to load it with
the current db session.
Maybe the factory was not the better place for
this function, but I don't think we have a better
place right now without creating a new class.
Fix #394 Forms layer dependencies loaded on demand

Now when we open a form that needs other layers
to be loaded, if they aren't loaded in the toc
it tries to add them through the factory method.