]> saetta.ns0.it Git - zakform/tests/commitdiff
Test for ZakFormGdaexProvider::get_create_table. test_cgi_js_validation
authorAndrea Zagli <azagli@libero.it>
Fri, 24 Jul 2020 11:46:03 +0000 (13:46 +0200)
committerAndrea Zagli <azagli@libero.it>
Fri, 24 Jul 2020 11:46:03 +0000 (13:46 +0200)
.gitignore
src/Makefile.am
src/gdaex_get_create_table.c [new file with mode: 0644]

index 63be726cd1715200da378c14d327d4fa7853e562..3c8bf8fcae850e80899982e7c23232630131a9ed 100644 (file)
@@ -54,6 +54,7 @@ cgi_ini
 cgi_ini_b4
 cgi_validate
 cgi_render_each_element
+gdaex_get_create_table
 get_elements
 get_element_filters
 get_element_validators
index e831c295a0e15bc590479af7a8db0f7fd7083f23..38c9b67f4733c84d74bb78a609eb5688ba9f8259 100644 (file)
@@ -12,6 +12,7 @@ noinst_PROGRAMS = \
                   cgi_ini_b4 \
                   cgi_render_each_element \
                   cgi_validate \
+                  gdaex_get_create_table \
                   get_elements \
                   get_element_filters \
                   get_element_validators \
diff --git a/src/gdaex_get_create_table.c b/src/gdaex_get_create_table.c
new file mode 100644 (file)
index 0000000..bb86902
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2020 Andrea Zagli <azagli@libero.it>
+ *
+ * This library 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.
+ *
+ * This library 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 <libzakcgi/libzakcgi.h>
+#include <libzakform/libzakform.h>
+#include <libzakformcgi/libzakformcgi.h>
+#include <libzakformgdaex/libzakformgdaex.h>
+
+int
+main (int argc, char *argv[])
+{
+       ZakCgiMain *cgi;
+       GdaEx *gdaex;
+
+       ZakFormCgiForm *form;
+       ZakFormGdaexProvider *provider;
+
+       gda_init ();
+
+       cgi = zak_cgi_main_new ();
+
+       form = zak_form_cgi_form_new (cgi, NULL);
+
+       if (argc == 4)
+               {
+                       gdaex = gdaex_new_from_string (argv[1]);
+                       if (gdaex == NULL)
+                               {
+                                       g_error ("Unable to connect to the db: %s.", argv[1]);
+                               }
+
+                       provider = zak_form_gdaex_provider_new (gdaex, argv[2]);
+
+                       zak_form_form_load_from_file (ZAK_FORM_FORM (form), argv[3]);
+
+                       g_warning ("%s",
+                                  zak_form_gdaex_provider_get_create_table_str (provider, zak_form_form_get_elements (ZAK_FORM_FORM (form))));
+               }
+
+       return 0;
+}