// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _LIBGDAMM_SERVERPROVIDER_H
#define _LIBGDAMM_SERVERPROVIDER_H

#include <glibmm.h>

/* $Id: serverprovider.hg,v 1.5 2004/05/04 09:50:46 murrayc Exp $ */
// -*- C++ -*- // this is for the .hg, I realize gensig puts one in

/* serverprovider.h
 *
 * Copyright 2001      Free Software Foundation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <libgdamm/connection.h>
#include <libgdamm/command.h>
#include <libgda/gda-server-provider.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdaServerProvider GdaServerProvider;
typedef struct _GdaServerProviderClass GdaServerProviderClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gnome
{

namespace Gda
{ class ServerProvider_Class; } // namespace Gda

} // namespace Gnome
namespace Gnome
{

namespace Gda
{

class Connection;


class ServerProvider : public Glib::Object
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef ServerProvider CppObjectType;
  typedef ServerProvider_Class CppClassType;
  typedef GdaServerProvider BaseObjectType;
  typedef GdaServerProviderClass BaseClassType;

private:  friend class ServerProvider_Class;
  static CppClassType serverprovider_class_;

private:
  // noncopyable
  ServerProvider(const ServerProvider&);
  ServerProvider& operator=(const ServerProvider&);

protected:
  explicit ServerProvider(const Glib::ConstructParams& construct_params);
  explicit ServerProvider(GdaServerProvider* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~ServerProvider();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;
  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  GdaServerProvider*       gobj()       { return reinterpret_cast<GdaServerProvider*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const GdaServerProvider* gobj() const { return reinterpret_cast<GdaServerProvider*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  GdaServerProvider* gobj_copy();

private:


  Glib::ustring get_version() const;
  
  bool open_connection(const Glib::RefPtr<Connection>& cnc, GdaQuarkList *params, const Glib::ustring& username, const Glib::ustring& password);
  
  bool close_connection(const Glib::RefPtr<Connection>& cnc);

  
  Glib::ustring get_server_version(const Glib::RefPtr<Connection>& cnc) const;
  
  Glib::ustring get_database(const Glib::RefPtr<Connection>& cnc) const;
  
  bool change_database(const Glib::RefPtr<Connection>& cnc, const Glib::ustring& name);
  
  bool create_database(const Glib::RefPtr<Connection>& cnc, const Glib::ustring& name);
  
  bool drop_database(const Glib::RefPtr<Connection>& cnc, const Glib::ustring& name);

   //Use deep ownership because we own both the list and its elements;
   

  Glib::ListHandle< Glib::RefPtr<DataModel> > execute_command(const Glib::RefPtr<Connection>& cnc, const Command& cmd, const ParameterList& params);

  
  bool begin_transaction(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Transaction>& xaction);
  
  bool commit_transaction(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Transaction>& xaction);
  
  bool rollback_transaction(const Glib::RefPtr<Connection>& cnc, const Glib::RefPtr<Transaction>& xaction);

  
  bool supports(const Glib::RefPtr<Connection>& cnc, ConnectionFeature feature) const;

  //TODO: Use C++ parameters, and add const version:
  
  Glib::RefPtr<DataModel> get_schema(const Glib::RefPtr<Connection>& cnc, ConnectionSchema schema, const ParameterList& params);
  
  Glib::RefPtr<const DataModel> get_schema(const Glib::RefPtr<Connection>& cnc, ConnectionSchema schema, const ParameterList& params) const;

  Glib::RefPtr<DataModel> get_schema(const Glib::RefPtr<Connection>& cnc, ConnectionSchema schema);
  Glib::RefPtr<const DataModel> get_schema(const Glib::RefPtr<Connection>& cnc, ConnectionSchema schema) const;


  bool create_blob(const Glib::RefPtr<Connection>& cnc, GdaBlob *blob);

  
  Glib::ustring get_last_insert_id(const Glib::RefPtr<Connection>&, const Glib::RefPtr<DataModel>& recset) const;            

 //TODO: vfuncs.


public:

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::


};

} // namespace Gda
} // namespace Gnome


namespace Glib
{
  /** @relates Gnome::Gda::ServerProvider
   * @param object The C instance
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   */
  Glib::RefPtr<Gnome::Gda::ServerProvider> wrap(GdaServerProvider* object, bool take_copy = false);
}


#endif /* _LIBGDAMM_SERVERPROVIDER_H */

