/**
  * Loads this data-object's properties from the database given an id
  *
  * If this object is associeted with an instance through the
  * {@link PinholeInstanceDataObject::setInstance()} method, load internal
  * will only load rows matching the specified instance.
  *
  * @param mixed $id the id of the database row to set this object's
  *                       properties with.
  *
  * @return mixed this object's data row or null is no such row exists.
  */
 protected function loadInternal($id)
 {
     $row = null;
     if ($this->instance === null) {
         $row = parent::loadInternal($id);
     } else {
         if ($this->table !== null && $this->id_field !== null) {
             $id_field = new SwatDBField($this->id_field, 'integer');
             $sql = 'select * from %s where %s = %s and instance = %s';
             $sql = sprintf($sql, $this->table, $id_field->name, $this->db->quote($id, $id_field->type), $this->db->quote($this->instance->id, 'integer'));
             $rs = SwatDB::query($this->db, $sql, null);
             $row = $rs->fetchRow(MDB2_FETCHMODE_ASSOC);
         }
     }
     return $row;
 }