]> saetta.ns0.it Git - libgdaex/commitdiff
Added function GdaExSqlBuilder::field.
authorAndrea Zagli <azagli@libero.it>
Wed, 2 Dec 2015 15:24:48 +0000 (16:24 +0100)
committerAndrea Zagli <azagli@libero.it>
Wed, 2 Dec 2015 15:25:42 +0000 (16:25 +0100)
src/sqlbuilder.c
src/sqlbuilder.h
tests/sqlbuilder.c

index fd216221da9048ac84d3d343b39df8bdc298f391..afbe3a1c635063dc1b3b6b9f3ec69a1572204464 100644 (file)
@@ -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:
index 406b306b807cfe66c5258590ce5487d8189a723e..e3f2b9cc855fa8738e4070f3f8284c0e6d2dcb1e 100644 (file)
@@ -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,
index be00c45a3acdea25bd9ecefb91406ee7178b6776..e12c22989e6e5d30c6058f1539d437501e9fed91 100644 (file)
@@ -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,