branches/gmyth-0.1b/src/gmyth_query.h
author rosfran
Wed Feb 14 21:28:49 2007 +0000 (2007-02-14)
branchtrunk
changeset 360 6d5596b9eb95
permissions -rw-r--r--
[svn r362] Some fixes in the GIOWatcher clean-ups, and changed the API version number.
renatofilho@320
     1
/**
renatofilho@320
     2
 * GMyth Library
renatofilho@320
     3
 *
renatofilho@320
     4
 * @file gmyth/gmyth_query.h
renatofilho@320
     5
 * 
renatofilho@320
     6
 * @brief <p> GMythQuery class provides a wrapper for accessing
renatofilho@320
     7
 * the libmysqlclient funtions.
renatofilho@320
     8
 *
renatofilho@320
     9
 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
renatofilho@320
    10
 * @author Leonardo Sobral Cunha <leonardo.cunha@indt.org.br>
renatofilho@320
    11
 *
renatofilho@320
    12
 *//*
renatofilho@320
    13
 * 
renatofilho@320
    14
 * This program is free software; you can redistribute it and/or modify
renatofilho@320
    15
 * it under the terms of the GNU Lesser General Public License as published by
renatofilho@320
    16
 * the Free Software Foundation; either version 2 of the License, or
renatofilho@320
    17
 * (at your option) any later version.
renatofilho@320
    18
 *
renatofilho@320
    19
 * This program is distributed in the hope that it will be useful,
renatofilho@320
    20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
renatofilho@320
    21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
renatofilho@320
    22
 * GNU General Public License for more details.
renatofilho@320
    23
 *
renatofilho@320
    24
 * You should have received a copy of the GNU Lesser General Public License
renatofilho@320
    25
 * along with this program; if not, write to the Free Software
renatofilho@320
    26
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
renatofilho@320
    27
 */
renatofilho@320
    28
renatofilho@320
    29
#ifndef __GMYTH_QUERY_H__
renatofilho@320
    30
#define __GMYTH_QUERY_H__
renatofilho@320
    31
renatofilho@320
    32
#include <glib-object.h>
renatofilho@320
    33
renatofilho@320
    34
/* MYSQL includes */
renatofilho@320
    35
#include <mysql/mysql.h>
renatofilho@320
    36
renatofilho@320
    37
#include "gmyth_backendinfo.h"
renatofilho@320
    38
renatofilho@320
    39
G_BEGIN_DECLS
renatofilho@320
    40
renatofilho@320
    41
#define GMYTH_QUERY_TYPE               (gmyth_query_get_type ())
renatofilho@320
    42
#define GMYTH_QUERY(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE, GMythQuery))
renatofilho@320
    43
#define GMYTH_QUERY_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE, GMythQueryClass))
renatofilho@320
    44
#define IS_GMYTH_QUERY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_QUERY_TYPE))
renatofilho@320
    45
#define IS_GMYTH_QUERY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_QUERY_TYPE))
renatofilho@320
    46
#define GMYTH_QUERY_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_QUERY_TYPE, GMythQueryClass))
renatofilho@320
    47
renatofilho@320
    48
renatofilho@320
    49
typedef struct _GMythQuery         GMythQuery;
renatofilho@320
    50
typedef struct _GMythQueryClass    GMythQueryClass;
renatofilho@320
    51
renatofilho@320
    52
struct _GMythQueryClass
renatofilho@320
    53
{
renatofilho@320
    54
  GObjectClass parent_class;
renatofilho@320
    55
renatofilho@320
    56
  /* callbacks */
renatofilho@320
    57
  /* no one for now */
renatofilho@320
    58
};
renatofilho@320
    59
renatofilho@320
    60
struct _GMythQuery
renatofilho@320
    61
{
renatofilho@320
    62
    GObject parent;
renatofilho@320
    63
  
renatofilho@320
    64
    GMythBackendInfo *backend_info;
renatofilho@320
    65
renatofilho@320
    66
    GString *opt_socket_name; /* socket name (use built-in value) */
renatofilho@320
    67
    unsigned int opt_flags; /* connection flags (none) */
renatofilho@320
    68
renatofilho@320
    69
    MYSQL *conn; /* pointer to connection handler */  
renatofilho@320
    70
};
renatofilho@320
    71
renatofilho@320
    72
renatofilho@320
    73
GType gmyth_query_get_type (void);
renatofilho@320
    74
renatofilho@320
    75
GMythQuery* gmyth_query_new ( );
renatofilho@320
    76
MYSQL_RES * gmyth_query_process_statement 
renatofilho@320
    77
                (GMythQuery *gmyth_query, gchar *stmt_str);
renatofilho@320
    78
renatofilho@320
    79
gboolean gmyth_query_connect (GMythQuery *gmyth_query, GMythBackendInfo *backend_info);
renatofilho@320
    80
gboolean gmyth_query_connect_with_timeout (GMythQuery *gmyth_query,
renatofilho@320
    81
	                GMythBackendInfo *backend_info, guint timeout);
renatofilho@320
    82
gboolean gmyth_query_disconnect (GMythQuery *gmyth_query);
renatofilho@320
    83
renatofilho@320
    84
G_END_DECLS
renatofilho@320
    85
renatofilho@320
    86
#endif /* __GMYTH_QUERY_H__ */