From: Andrea Zagli Date: Wed, 2 Dec 2015 15:24:48 +0000 (+0100) Subject: Added function GdaExSqlBuilder::field. X-Git-Tag: v0.6.0~1^2~24 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=806586428ae2fb699d75b6a258355af98d253d5c;p=libgdaex Added function GdaExSqlBuilder::field. --- diff --git a/src/sqlbuilder.c b/src/sqlbuilder.c index fd21622..afbe3a1 100644 --- a/src/sqlbuilder.c +++ b/src/sqlbuilder.c @@ -345,6 +345,24 @@ gdaex_sql_builder_join (GdaExSqlBuilder *sqlb, va_end (ap); } +/** + * gdaex_sql_builder_field: + * @sqlb: + * @table_name: + * @field_name: + * @field_alias: + * @gval: + * + */ +void +gdaex_sql_builder_field (GdaExSqlBuilder *sqlb, const gchar *table_name, const gchar *field_name, const gchar *field_alias, GValue *gval) +{ + GdaExSqlBuilderTable *t; + + t = gdaex_sql_builder_get_table (sqlb, table_name, NULL, TRUE); + gdaex_sql_builder_get_field (sqlb, t, field_name, field_alias, gval, TRUE); +} + /** * gdaex_sql_builder_fields: * @sqlb: diff --git a/src/sqlbuilder.h b/src/sqlbuilder.h index 406b306..e3f2b9c 100644 --- a/src/sqlbuilder.h +++ b/src/sqlbuilder.h @@ -65,6 +65,7 @@ void gdaex_sql_builder_join (GdaExSqlBuilder *sqlb, GdaSqlSelectJoinType join_type, ...); +void gdaex_sql_builder_field (GdaExSqlBuilder *sqlb, const gchar *table_name, const gchar *field_name, const gchar *field_alias, GValue *gval); void gdaex_sql_builder_fields (GdaExSqlBuilder *sqlb, ...); GdaSqlBuilderId gdaex_sql_builder_where (GdaExSqlBuilder *sqln, GdaSqlOperatorType op, diff --git a/tests/sqlbuilder.c b/tests/sqlbuilder.c index be00c45..e12c229 100644 --- a/tests/sqlbuilder.c +++ b/tests/sqlbuilder.c @@ -38,6 +38,8 @@ main (int argc, char **argv) "pippo", "name", "the_name", NULL, NULL); + gdaex_sql_builder_field (sqlb, "pippo", "income", NULL, NULL); + gdaex_sql_builder_join (sqlb, GDA_SQL_SELECT_JOIN_INNER, "pippo", "id", "", GDA_SQL_OPERATOR_TYPE_EQ,