diff -r 000000000000 -r 6d5596b9eb95 branches/gmyth-0.1b/src/gmyth_query.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/branches/gmyth-0.1b/src/gmyth_query.h Wed Feb 14 21:28:49 2007 +0000 @@ -0,0 +1,86 @@ +/** + * GMyth Library + * + * @file gmyth/gmyth_query.h + * + * @brief

GMythQuery class provides a wrapper for accessing + * the libmysqlclient funtions. + * + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. + * @author Leonardo Sobral Cunha + * + *//* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __GMYTH_QUERY_H__ +#define __GMYTH_QUERY_H__ + +#include + +/* MYSQL includes */ +#include + +#include "gmyth_backendinfo.h" + +G_BEGIN_DECLS + +#define GMYTH_QUERY_TYPE (gmyth_query_get_type ()) +#define GMYTH_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE, GMythQuery)) +#define GMYTH_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE, GMythQueryClass)) +#define IS_GMYTH_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE)) +#define IS_GMYTH_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE)) +#define GMYTH_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_QUERY_TYPE, GMythQueryClass)) + + +typedef struct _GMythQuery GMythQuery; +typedef struct _GMythQueryClass GMythQueryClass; + +struct _GMythQueryClass +{ + GObjectClass parent_class; + + /* callbacks */ + /* no one for now */ +}; + +struct _GMythQuery +{ + GObject parent; + + GMythBackendInfo *backend_info; + + GString *opt_socket_name; /* socket name (use built-in value) */ + unsigned int opt_flags; /* connection flags (none) */ + + MYSQL *conn; /* pointer to connection handler */ +}; + + +GType gmyth_query_get_type (void); + +GMythQuery* gmyth_query_new ( ); +MYSQL_RES * gmyth_query_process_statement + (GMythQuery *gmyth_query, gchar *stmt_str); + +gboolean gmyth_query_connect (GMythQuery *gmyth_query, GMythBackendInfo *backend_info); +gboolean gmyth_query_connect_with_timeout (GMythQuery *gmyth_query, + GMythBackendInfo *backend_info, guint timeout); +gboolean gmyth_query_disconnect (GMythQuery *gmyth_query); + +G_END_DECLS + +#endif /* __GMYTH_QUERY_H__ */