]> saetta.ns0.it Git - libgdaex/commitdiff
Added function SqlBuilder::where_double.
authorAndrea Zagli <azagli@libero.it>
Sun, 27 Sep 2020 06:57:16 +0000 (08:57 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 27 Sep 2020 06:57:16 +0000 (08:57 +0200)
src/sqlbuilder.c
src/sqlbuilder.h

index 9ac5314c3c7fcd25edb3d7d3387dc25dc31aa20d..e478638f5ec37bd198b4cd0150f8d89875abdad7 100644 (file)
@@ -706,6 +706,36 @@ gdaex_sql_builder_where_float (GdaExSqlBuilder *sqlb, GdaSqlOperatorType op,
        return id;
 }
 
+GdaSqlBuilderId
+gdaex_sql_builder_where_double (GdaExSqlBuilder *sqlb, GdaSqlOperatorType op,
+                                const gchar *table_name,
+                                const gchar *field_name,
+                                const gchar *field_alias,
+                                GdaSqlOperatorType where_op,
+                                gdouble op1,
+                                gdouble op2)
+{
+       GValue *val1;
+       GValue *val2;
+
+       GdaSqlBuilderId id;
+
+       val1 = g_new0 (GValue, 1);
+       g_value_init (val1, G_TYPE_DOUBLE);
+       g_value_set_double (val1, op1);
+
+       val2 = g_new0 (GValue, 1);
+       g_value_init (val2, G_TYPE_DOUBLE);
+       g_value_set_double (val2, op2);
+
+       id = gdaex_sql_builder_where (sqlb, op, table_name, field_name, field_alias, where_op, val1, val2, NULL);
+
+       g_value_unset (val1);
+       g_value_unset (val2);
+
+       return id;
+}
+
 GdaSqlBuilderId
 gdaex_sql_builder_where_string (GdaExSqlBuilder *sqlb, GdaSqlOperatorType op,
                                 const gchar *table_name,
index b6cefc155a974863ee0aca94ef7f5a0521b76112..3c20f1afa77768507e0bc69e7055f6e9ea60266c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  sqlbuilder.h
  *
- *  Copyright (C) 2015-2019 Andrea Zagli <azagli@libero.it>
+ *  Copyright (C) 2015-2020 Andrea Zagli <azagli@libero.it>
  *
  *  This file is part of libgdaex.
  *
@@ -73,7 +73,7 @@ void gdaex_sql_builder_field_string (GdaExSqlBuilder *sqlb, const gchar *table_n
 void gdaex_sql_builder_fields (GdaExSqlBuilder *sqlb, ...);
 
 GdaSqlBuilderId gdaex_sql_builder_where (GdaExSqlBuilder *sqlb, GdaSqlOperatorType op,
-                                                                                ...);
+                                         ...);
 GdaSqlBuilderId gdaex_sql_builder_where_boolean (GdaExSqlBuilder *sqlb, GdaSqlOperatorType op,
                                                  const gchar *table_name,
                                                  const gchar *field_name,
@@ -95,6 +95,13 @@ GdaSqlBuilderId gdaex_sql_builder_where_float (GdaExSqlBuilder *sqlb, GdaSqlOper
                                                GdaSqlOperatorType where_op,
                                                gfloat op1,
                                                gfloat op2);
+GdaSqlBuilderId gdaex_sql_builder_where_double (GdaExSqlBuilder *sqlb, GdaSqlOperatorType op,
+                                                const gchar *table_name,
+                                                const gchar *field_name,
+                                                const gchar *field_alias,
+                                                GdaSqlOperatorType where_op,
+                                                gdouble op1,
+                                                gdouble op2);
 GdaSqlBuilderId gdaex_sql_builder_where_string (GdaExSqlBuilder *sqlb, GdaSqlOperatorType op,
                                                 const gchar *table_name,
                                                 const gchar *field_name,