File: SelectQuery.c

package info (click to toggle)
libgda5 5.2.4-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 75,256 kB
  • ctags: 49,218
  • sloc: ansic: 461,759; sh: 11,808; xml: 10,466; yacc: 5,160; makefile: 4,327; php: 1,416; java: 1,300; python: 896; sql: 879; perl: 116
file content (217 lines) | stat: -rw-r--r-- 8,774 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/* SelectQuery.c generated by valac 0.26.2, the Vala compiler
 * generated from SelectQuery.vala, do not modify */

/* -*- Mode: Vala; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * libgdavala
 * Copyright (C) Daniel Espinosa Ortiz 2011 <esodan@gmail.com>
 * 
 * libgda 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 3 of the License, or
 * (at your option) any later version.
 * 
 * libgda 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 Lesser 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, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <libgda/libgda.h>
#include <stdlib.h>
#include <string.h>


#define GDA_DATA_TYPE_SELECT_QUERY (gda_data_select_query_get_type ())
#define GDA_DATA_SELECT_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDA_DATA_TYPE_SELECT_QUERY, GdaDataSelectQuery))
#define GDA_DATA_SELECT_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDA_DATA_TYPE_SELECT_QUERY, GdaDataSelectQueryClass))
#define GDA_DATA_IS_SELECT_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDA_DATA_TYPE_SELECT_QUERY))
#define GDA_DATA_IS_SELECT_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDA_DATA_TYPE_SELECT_QUERY))
#define GDA_DATA_SELECT_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDA_DATA_TYPE_SELECT_QUERY, GdaDataSelectQueryClass))

typedef struct _GdaDataSelectQuery GdaDataSelectQuery;
typedef struct _GdaDataSelectQueryClass GdaDataSelectQueryClass;
typedef struct _GdaDataSelectQueryPrivate GdaDataSelectQueryPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GdaDataSelectQuery {
	GObject parent_instance;
	GdaDataSelectQueryPrivate * priv;
};

struct _GdaDataSelectQueryClass {
	GObjectClass parent_class;
};

struct _GdaDataSelectQueryPrivate {
	GdaSqlBuilder* _sql;
	gchar* _table;
	GdaConnection* _connection;
};


static gpointer gda_data_select_query_parent_class = NULL;

GType gda_data_select_query_get_type (void) G_GNUC_CONST;
#define GDA_DATA_SELECT_QUERY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDA_DATA_TYPE_SELECT_QUERY, GdaDataSelectQueryPrivate))
enum  {
	GDA_DATA_SELECT_QUERY_DUMMY_PROPERTY,
	GDA_DATA_SELECT_QUERY_TABLE,
	GDA_DATA_SELECT_QUERY_CONNECTION
};
GdaDataSelectQuery* gda_data_select_query_new (void);
GdaDataSelectQuery* gda_data_select_query_construct (GType object_type);
const gchar* gda_data_select_query_get_table (GdaDataSelectQuery* self);
void gda_data_select_query_set_table (GdaDataSelectQuery* self, const gchar* value);
GdaConnection* gda_data_select_query_get_connection (GdaDataSelectQuery* self);
void gda_data_select_query_set_connection (GdaDataSelectQuery* self, GdaConnection* value);
static void gda_data_select_query_finalize (GObject* obj);
static void _vala_gda_data_select_query_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gda_data_select_query_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GdaDataSelectQuery* gda_data_select_query_construct (GType object_type) {
	GdaDataSelectQuery * self = NULL;
	self = (GdaDataSelectQuery*) g_object_new (object_type, NULL);
	return self;
}


GdaDataSelectQuery* gda_data_select_query_new (void) {
	return gda_data_select_query_construct (GDA_DATA_TYPE_SELECT_QUERY);
}


const gchar* gda_data_select_query_get_table (GdaDataSelectQuery* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_table;
	result = _tmp0_;
	return result;
}


void gda_data_select_query_set_table (GdaDataSelectQuery* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	GdaSqlBuilder* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_table);
	self->priv->_table = _tmp1_;
	_tmp2_ = self->priv->_sql;
	_tmp3_ = value;
	gda_sql_builder_select_add_target (_tmp2_, _tmp3_, NULL);
	g_object_notify ((GObject *) self, "table");
}


GdaConnection* gda_data_select_query_get_connection (GdaDataSelectQuery* self) {
	GdaConnection* result;
	GdaConnection* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_connection;
	result = _tmp0_;
	return result;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


void gda_data_select_query_set_connection (GdaDataSelectQuery* self, GdaConnection* value) {
	GdaConnection* _tmp0_ = NULL;
	GdaConnection* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_connection);
	self->priv->_connection = _tmp1_;
	g_object_notify ((GObject *) self, "connection");
}


static void gda_data_select_query_class_init (GdaDataSelectQueryClass * klass) {
	gda_data_select_query_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GdaDataSelectQueryPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gda_data_select_query_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gda_data_select_query_set_property;
	G_OBJECT_CLASS (klass)->finalize = gda_data_select_query_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GDA_DATA_SELECT_QUERY_TABLE, g_param_spec_string ("table", "table", "table", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GDA_DATA_SELECT_QUERY_CONNECTION, g_param_spec_object ("connection", "connection", "connection", gda_connection_get_type (), G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void gda_data_select_query_instance_init (GdaDataSelectQuery * self) {
	self->priv = GDA_DATA_SELECT_QUERY_GET_PRIVATE (self);
}


static void gda_data_select_query_finalize (GObject* obj) {
	GdaDataSelectQuery * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GDA_DATA_TYPE_SELECT_QUERY, GdaDataSelectQuery);
	_g_object_unref0 (self->priv->_sql);
	_g_free0 (self->priv->_table);
	_g_object_unref0 (self->priv->_connection);
	G_OBJECT_CLASS (gda_data_select_query_parent_class)->finalize (obj);
}


GType gda_data_select_query_get_type (void) {
	static volatile gsize gda_data_select_query_type_id__volatile = 0;
	if (g_once_init_enter (&gda_data_select_query_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GdaDataSelectQueryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gda_data_select_query_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GdaDataSelectQuery), 0, (GInstanceInitFunc) gda_data_select_query_instance_init, NULL };
		GType gda_data_select_query_type_id;
		gda_data_select_query_type_id = g_type_register_static (G_TYPE_OBJECT, "GdaDataSelectQuery", &g_define_type_info, 0);
		g_once_init_leave (&gda_data_select_query_type_id__volatile, gda_data_select_query_type_id);
	}
	return gda_data_select_query_type_id__volatile;
}


static void _vala_gda_data_select_query_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GdaDataSelectQuery * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GDA_DATA_TYPE_SELECT_QUERY, GdaDataSelectQuery);
	switch (property_id) {
		case GDA_DATA_SELECT_QUERY_TABLE:
		g_value_set_string (value, gda_data_select_query_get_table (self));
		break;
		case GDA_DATA_SELECT_QUERY_CONNECTION:
		g_value_set_object (value, gda_data_select_query_get_connection (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gda_data_select_query_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GdaDataSelectQuery * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GDA_DATA_TYPE_SELECT_QUERY, GdaDataSelectQuery);
	switch (property_id) {
		case GDA_DATA_SELECT_QUERY_TABLE:
		gda_data_select_query_set_table (self, g_value_get_string (value));
		break;
		case GDA_DATA_SELECT_QUERY_CONNECTION:
		gda_data_select_query_set_connection (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}