/* sql-function.c generated by valac 0.56.1, the Vala compiler
 * generated from sql-function.vala, do not modify */

/*
 * Copyright (C) 2010 Jens Georg <mail@jensge.org>.
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * This file is part of Rygel.
 *
 * Rygel 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 2.1 of the License, or (at your option) any later version.
 *
 * Rygel 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "rygel-db.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>

enum  {
	RYGEL_DATABASE_SQL_FUNCTION_0_PROPERTY,
	RYGEL_DATABASE_SQL_FUNCTION_NUM_PROPERTIES
};
static GParamSpec* rygel_database_sql_function_properties[RYGEL_DATABASE_SQL_FUNCTION_NUM_PROPERTIES];

static gpointer rygel_database_sql_function_parent_class = NULL;

static gchar* rygel_database_sql_function_real_to_string (RygelDatabaseSqlOperator* base);
static GType rygel_database_sql_function_get_type_once (void);

RygelDatabaseSqlFunction*
rygel_database_sql_function_construct (GType object_type,
                                       const gchar* name,
                                       const gchar* arg)
{
	RygelDatabaseSqlFunction * self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (arg != NULL, NULL);
	self = (RygelDatabaseSqlFunction*) rygel_database_sql_operator_construct (object_type, name, arg, "");
	return self;
}

RygelDatabaseSqlFunction*
rygel_database_sql_function_new (const gchar* name,
                                 const gchar* arg)
{
	return rygel_database_sql_function_construct (RYGEL_DATABASE_TYPE_SQL_FUNCTION, name, arg);
}

static gchar*
rygel_database_sql_function_real_to_string (RygelDatabaseSqlOperator* base)
{
	RygelDatabaseSqlFunction * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	self = (RygelDatabaseSqlFunction*) base;
	_tmp0_ = ((RygelDatabaseSqlOperator*) self)->name;
	_tmp1_ = ((RygelDatabaseSqlOperator*) self)->arg;
	_tmp2_ = g_strdup_printf ("%s(%s,?)", _tmp0_, _tmp1_);
	result = _tmp2_;
	return result;
}

static void
rygel_database_sql_function_class_init (RygelDatabaseSqlFunctionClass * klass,
                                        gpointer klass_data)
{
	rygel_database_sql_function_parent_class = g_type_class_peek_parent (klass);
	((RygelDatabaseSqlOperatorClass *) klass)->to_string = (gchar* (*) (RygelDatabaseSqlOperator*)) rygel_database_sql_function_real_to_string;
}

static void
rygel_database_sql_function_instance_init (RygelDatabaseSqlFunction * self,
                                           gpointer klass)
{
}

static GType
rygel_database_sql_function_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelDatabaseSqlFunctionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_database_sql_function_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelDatabaseSqlFunction), 0, (GInstanceInitFunc) rygel_database_sql_function_instance_init, NULL };
	GType rygel_database_sql_function_type_id;
	rygel_database_sql_function_type_id = g_type_register_static (RYGEL_DATABASE_TYPE_SQL_OPERATOR, "RygelDatabaseSqlFunction", &g_define_type_info, 0);
	return rygel_database_sql_function_type_id;
}

GType
rygel_database_sql_function_get_type (void)
{
	static volatile gsize rygel_database_sql_function_type_id__once = 0;
	if (g_once_init_enter (&rygel_database_sql_function_type_id__once)) {
		GType rygel_database_sql_function_type_id;
		rygel_database_sql_function_type_id = rygel_database_sql_function_get_type_once ();
		g_once_init_leave (&rygel_database_sql_function_type_id__once, rygel_database_sql_function_type_id);
	}
	return rygel_database_sql_function_type_id__once;
}

