Well I answered my own question. After you set the object you can serialize that object and pass that into that database. It's pretty much just a string so nothing to fancy there. When you want to get it back just unserialize the object with your own callback function.
Here is a simple simple example of what i did:
Insert an object:
$sql = 'insert into test(objects) values(\''.stripslashes(serialize($db)).'\')';
// $db equals the object. Insert the object after you have set EVERYTHING in it.
Get the object back:
$db = new DB_object();
$sql = 'select objects from test';
$db->query($sql);
$res = $db->getResults();
$obj = $res[0]->objects;
ini_set('unserialize_callback_func','mycallback');
$obj = unserialize(stripslashes(substr($obj,7)));
echo $obj->getNumRows();
function mycallback($classname) {
// just include a file containing your classdefinition
// you get $classname to figure out which classdefinition is required
include('dbObj.class.php');
}