82 lines
2.3 KiB
C
82 lines
2.3 KiB
C
/*
|
|
* Copyright (C) 2012 - Juan Ferrer Toribio
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 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 General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef SQL_SELECT_H
|
|
#define SQL_SELECT_H
|
|
|
|
#include "sql-dml.h"
|
|
#include "sql-select-field.h"
|
|
#include "sql-select-order.h"
|
|
|
|
#define SQL_TYPE_SELECT (sql_select_get_type ())
|
|
#define SQL_SELECT(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, SQL_TYPE_SELECT, SqlSelect))
|
|
#define SQL_IS_SELECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, SQL_TYPE_SELECT))
|
|
|
|
typedef struct _SqlSelect SqlSelect;
|
|
typedef struct _SqlSelectClass SqlSelectClass;
|
|
|
|
typedef enum
|
|
{
|
|
SQL_SELECT_NONE
|
|
,SQL_SELECT_UNION_ALL
|
|
,SQL_SELECT_UNION_ANY
|
|
,SQL_SELECT_INTERSECT
|
|
,SQL_SELECT_EXCEPT
|
|
,SQL_SELECT_COUNT
|
|
}
|
|
SqlSelectType;
|
|
|
|
/**
|
|
* SqlSelect:
|
|
* @expr: (element-type Sql.Expr):
|
|
* @group: (element-type Sql.Expr):
|
|
* @order: (element-type Sql.Expr):
|
|
**/
|
|
struct _SqlSelect
|
|
{
|
|
SqlDml parent;
|
|
gboolean distinct;
|
|
SqlList * fields;
|
|
SqlList * group;
|
|
SqlExpr * having;
|
|
SqlList * order;
|
|
guint limit_offset;
|
|
guint limit_count;
|
|
|
|
SqlSelect * next;
|
|
SqlSelectType type;
|
|
};
|
|
|
|
struct _SqlSelectClass
|
|
{
|
|
/* <private> */
|
|
SqlDmlClass parent;
|
|
};
|
|
|
|
GType sql_select_get_type ();
|
|
SqlObject * sql_select_new ();
|
|
void sql_select_set_distinct (SqlSelect * obj, gboolean distinct);
|
|
void sql_select_add_expr (SqlSelect * obj, SqlExpr * expr);
|
|
void sql_select_set_alias (SqlSelect * obj, SqlExpr * expr, const gchar * alias);
|
|
void sql_select_add_group (SqlSelect * obj, SqlExpr * expr);
|
|
void sql_select_set_having (SqlSelect * obj, SqlExpr * expr);
|
|
void sql_select_add_order (SqlSelect * obj, SqlExpr * expr, SqlSelectOrderWay way);
|
|
void sql_select_set_limit (SqlSelect * obj, guint count, guint offset);
|
|
void sql_select_set_next (SqlSelect * obj, SqlSelect * next, SqlSelectType type);
|
|
|
|
#endif
|