branches/gmyth-0.1b/src/gmyth_query.h
branchtrunk
changeset 326 81b1f3006eb2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/branches/gmyth-0.1b/src/gmyth_query.h	Tue Feb 06 00:33:35 2007 +0000
     1.3 @@ -0,0 +1,86 @@
     1.4 +/**
     1.5 + * GMyth Library
     1.6 + *
     1.7 + * @file gmyth/gmyth_query.h
     1.8 + * 
     1.9 + * @brief <p> GMythQuery class provides a wrapper for accessing
    1.10 + * the libmysqlclient funtions.
    1.11 + *
    1.12 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    1.13 + * @author Leonardo Sobral Cunha <leonardo.cunha@indt.org.br>
    1.14 + *
    1.15 + *//*
    1.16 + * 
    1.17 + * This program is free software; you can redistribute it and/or modify
    1.18 + * it under the terms of the GNU Lesser General Public License as published by
    1.19 + * the Free Software Foundation; either version 2 of the License, or
    1.20 + * (at your option) any later version.
    1.21 + *
    1.22 + * This program is distributed in the hope that it will be useful,
    1.23 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.24 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.25 + * GNU General Public License for more details.
    1.26 + *
    1.27 + * You should have received a copy of the GNU Lesser General Public License
    1.28 + * along with this program; if not, write to the Free Software
    1.29 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.30 + */
    1.31 +
    1.32 +#ifndef __GMYTH_QUERY_H__
    1.33 +#define __GMYTH_QUERY_H__
    1.34 +
    1.35 +#include <glib-object.h>
    1.36 +
    1.37 +/* MYSQL includes */
    1.38 +#include <mysql/mysql.h>
    1.39 +
    1.40 +#include "gmyth_backendinfo.h"
    1.41 +
    1.42 +G_BEGIN_DECLS
    1.43 +
    1.44 +#define GMYTH_QUERY_TYPE               (gmyth_query_get_type ())
    1.45 +#define GMYTH_QUERY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE, GMythQuery))
    1.46 +#define GMYTH_QUERY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE, GMythQueryClass))
    1.47 +#define IS_GMYTH_QUERY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE))
    1.48 +#define IS_GMYTH_QUERY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE))
    1.49 +#define GMYTH_QUERY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_QUERY_TYPE, GMythQueryClass))
    1.50 +
    1.51 +
    1.52 +typedef struct _GMythQuery         GMythQuery;
    1.53 +typedef struct _GMythQueryClass    GMythQueryClass;
    1.54 +
    1.55 +struct _GMythQueryClass
    1.56 +{
    1.57 +  GObjectClass parent_class;
    1.58 +
    1.59 +  /* callbacks */
    1.60 +  /* no one for now */
    1.61 +};
    1.62 +
    1.63 +struct _GMythQuery
    1.64 +{
    1.65 +    GObject parent;
    1.66 +  
    1.67 +    GMythBackendInfo *backend_info;
    1.68 +
    1.69 +    GString *opt_socket_name; /* socket name (use built-in value) */
    1.70 +    unsigned int opt_flags; /* connection flags (none) */
    1.71 +
    1.72 +    MYSQL *conn; /* pointer to connection handler */  
    1.73 +};
    1.74 +
    1.75 +
    1.76 +GType gmyth_query_get_type (void);
    1.77 +
    1.78 +GMythQuery* gmyth_query_new ( );
    1.79 +MYSQL_RES * gmyth_query_process_statement 
    1.80 +                (GMythQuery *gmyth_query, gchar *stmt_str);
    1.81 +
    1.82 +gboolean gmyth_query_connect (GMythQuery *gmyth_query, GMythBackendInfo *backend_info);
    1.83 +gboolean gmyth_query_connect_with_timeout (GMythQuery *gmyth_query,
    1.84 +	                GMythBackendInfo *backend_info, guint timeout);
    1.85 +gboolean gmyth_query_disconnect (GMythQuery *gmyth_query);
    1.86 +
    1.87 +G_END_DECLS
    1.88 +
    1.89 +#endif /* __GMYTH_QUERY_H__ */