[libgda] Misc. demos/ corrections



commit de6809687fa039d490419f05b1b1f1ac50510ee7
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Feb 22 21:41:46 2015 +0100

    Misc. demos/ corrections

 libgda-ui/demos/ddl_queries.c    |   32 +++++++++++++++++++++++++++++++-
 libgda-ui/demos/geninclude.pl.in |   12 ++++++------
 2 files changed, 37 insertions(+), 7 deletions(-)
---
diff --git a/libgda-ui/demos/ddl_queries.c b/libgda-ui/demos/ddl_queries.c
index ebbf533..e760cec 100644
--- a/libgda-ui/demos/ddl_queries.c
+++ b/libgda-ui/demos/ddl_queries.c
@@ -349,9 +349,23 @@ extract_named_parameters (GdaServerOperation *op, const gchar *root_path, GtkTex
                g_free (str);
                break;
        }
-       case GDA_SERVER_OPERATION_NODE_SEQUENCE:
+       case GDA_SERVER_OPERATION_NODE_SEQUENCE: {
                gtk_text_buffer_insert (tbuffer, &iter, "Sequence)\n", -1);
+               guint i, size = gda_server_operation_get_sequence_size (op, root_path);
+               for (i = 0; i < size; i++) {
+                       gchar **names;
+                       names = gda_server_operation_get_sequence_item_names (op, root_path);
+                       guint n;
+                       for (n = 0; names [n]; n++) {
+                               gchar *npath;
+                               npath = g_strdup_printf ("%s/%u%s", root_path, i, names [n]);
+                               extract_named_parameters (op, npath, tbuffer);
+                               g_free (npath);
+                       }
+                       g_strfreev (names);
+               }
                break;
+       }
 
        case GDA_SERVER_OPERATION_NODE_SEQUENCE_ITEM:
                gtk_text_buffer_insert (tbuffer, &iter, "Sequence item)\n", -1);
@@ -428,6 +442,22 @@ show_named_parameters (G_GNUC_UNUSED GtkButton *button, DemoData *data)
                                     "weight", PANGO_WEIGHT_BOLD,
                                     "foreground", "blue", NULL);
 
+       xmlNodePtr xml;
+       xml = gda_server_operation_save_data_to_xml (data->op, NULL);
+       if (xml) {
+               g_print ("XML rendering of the GdaServerOperation is:\n");
+                xmlBufferPtr buffer;
+                buffer = xmlBufferCreate ();
+                xmlNodeDump (buffer, NULL, xml, 0, 1);
+                xmlFreeNode (xml);
+                xmlBufferDump (stdout, buffer);
+                xmlBufferFree (buffer);
+               g_print ("\n");
+       }
+       else {
+               g_print ("XML rendering ERROR\n");
+       }
+
        root_nodes = gda_server_operation_get_root_nodes (data->op);
        for (i = 0; root_nodes && root_nodes[i]; i++)
                extract_named_parameters (data->op, root_nodes[i], buffer);
diff --git a/libgda-ui/demos/geninclude.pl.in b/libgda-ui/demos/geninclude.pl.in
index ce8a1fd..771887f 100755
--- a/libgda-ui/demos/geninclude.pl.in
+++ b/libgda-ui/demos/geninclude.pl.in
@@ -40,7 +40,7 @@ foreach $href (@demos) {
        my $do_next = 0;
 
        # parent detected
-       if (defined @parents) {
+       if (@parents) {
            foreach $foo (@parents) {
                if ($foo eq $parent_name) {
                    $do_next = 1;
@@ -54,7 +54,7 @@ foreach $href (@demos) {
 
        push @parents, $parent_name;
 
-       $tmp = (defined @child_arrays)?($#child_arrays + 1):0;
+       $tmp = (@child_arrays)?($#child_arrays + 1):0;
        push @child_arrays, "child$tmp";
 
        push @demos, {"title" => $parent_name, "file" => "NULL",
@@ -62,7 +62,7 @@ foreach $href (@demos) {
     }
 }
 
-if (defined @parents) {
+if (@parents) {
     $i = 0;
     for ($i = 0; $i <= $#parents; $i++) {
        $first = 1;
@@ -73,7 +73,7 @@ if (defined @parents) {
        for ($j = 0; $j <= $#demos; $j++) {
            $href = $demos[$j];
            
-           if (!defined $demos[$j]) {
+           if (!$demos[$j]) {
                next;
            }
            
@@ -105,7 +105,7 @@ if (defined @parents) {
 } @demos_old;
 
 # sort the child arrays
-if (defined @child_arrays) {
+if (@child_arrays) {
     for ($i = 0; $i <= $#child_arrays; $i++) {
        @foo_old = @{$child_arrays[$i]};
 
@@ -133,7 +133,7 @@ foreach $href (@demos) {
        print ", \n";
     }
 
-    if (defined @parents) {
+    if (@parents) {
        for ($i = 0; $i <= $#parents; $i++) {
            if ($parents[$i] eq $href->{title}) {
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]