69 lines
2.1 KiB
C
69 lines
2.1 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/>.
|
|
*/
|
|
|
|
#include "sql-multi-stmt.h"
|
|
|
|
/**
|
|
* SECTION: sql-multi-stmt
|
|
* @Short_description: the equivalent multiple statements separated by semicolon.
|
|
* @Title: SqlMultiStmt
|
|
*
|
|
* The #SqlMultiStmt represents multiple SQL statements separated by semicolon.
|
|
**/
|
|
G_DEFINE_TYPE (SqlMultiStmt, sql_multi_stmt, SQL_TYPE_STMT);
|
|
|
|
SqlMultiStmt * sql_multi_stmt_new ()
|
|
{
|
|
return g_object_new (SQL_TYPE_MULTI_STMT, NULL);
|
|
}
|
|
|
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
|
|
|
|
static void sql_multi_stmt_render (SqlMultiStmt * obj, SqlRender * render)
|
|
{
|
|
sql_render_add_list (render, T, NULL, obj->stmt, ";");
|
|
}
|
|
|
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
|
|
|
void sql_multi_stmt_add_stmt (SqlMultiStmt * obj, SqlStmt * stmt)
|
|
{
|
|
g_return_if_fail (SQL_IS_MULTI_STMT (obj));
|
|
g_return_if_fail (SQL_IS_STMT (stmt));
|
|
|
|
obj->stmt = g_slist_append (obj->stmt, g_object_ref_sink (stmt));
|
|
}
|
|
|
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
|
|
|
|
static void sql_multi_stmt_init (SqlMultiStmt * obj)
|
|
{
|
|
obj->stmt = NULL;
|
|
}
|
|
|
|
static void sql_multi_stmt_finalize (SqlMultiStmt * obj)
|
|
{
|
|
g_slist_free_full (obj->stmt, g_object_unref);
|
|
G_OBJECT_CLASS (sql_multi_stmt_parent_class)->finalize (G_OBJECT (obj));
|
|
}
|
|
|
|
static void sql_multi_stmt_class_init (SqlMultiStmtClass * klass)
|
|
{
|
|
G_OBJECT_CLASS (klass)->finalize = (GObjectFinalizeFunc) sql_multi_stmt_finalize;
|
|
SQL_OBJECT_CLASS (klass)->render = (SqlRenderFunc) sql_multi_stmt_render;
|
|
}
|