List:Commits« Previous MessageNext Message »
From:paul Date:December 19 2005 6:12am
Subject:svn commit - mysqldoc@docsrva: r592 - in trunk: . tools
View as plain text  
Author: paul
Date: 2005-12-19 07:12:29 +0100 (Mon, 19 Dec 2005)
New Revision: 592

Log:
 r4925@frost:  paul | 2005-12-19 00:12:15 -0600
 Ensure that fill_help_tables2.pl writes single-line inserts
 (no newlines).


Modified:
   trunk/
   trunk/tools/fill_help_tables2.pl


Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:4903
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:1694
   + b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:4925
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:1694

Modified: trunk/tools/fill_help_tables2.pl
===================================================================
--- trunk/tools/fill_help_tables2.pl	2005-12-18 22:39:35 UTC (rev 591)
+++ trunk/tools/fill_help_tables2.pl	2005-12-19 06:12:29 UTC (rev 592)
@@ -142,6 +142,10 @@
 #   for some reason.  (Well, it won't quite work.  The help_cateogory
 #   also has a url column.  But I have no idea what that should be, so
 #   it's now set to '' explicitly.)
+# 2005-12-18
+# - Ensure each insert statement is written on a single line, so that
+#   the output can be processed by mysqld --bootstrap (mysql_install_db
+#   invokes mysqld with the --bootstrap option).
 
 use strict;
 
@@ -368,14 +372,13 @@
   $count= 0;
   foreach $cat_name (@category_names)
   {
-    print_insert_header($count,$header);
     my $parent_cat_name= $categories{$cat_name}->{__parent_category__};
     my $parent_cat_id= $parent_cat_name eq "" 
         ? "0" : $categories{$parent_cat_name}->{__id__};
-    print "\n(", $count+1, ",\"$cat_name\",$parent_cat_id,'')";
+    print "$header(", $count+1, ",\"$cat_name\",$parent_cat_id,'');\n";
     $count++;
   }
-  printf ";\n\n";
+  printf "\n";
 }
 
 my @topic_names= keys(%topics);
@@ -387,18 +390,22 @@
   my $count= 0;
   foreach $topic_name (@topic_names)
   {
-    print_insert_header($count,$header);
     my $topic= $topics{$topic_name};
-    print "($count,";
+
+    # map newline to "\n" so that output appears in single line
+    $topic->{description} =~ s/\n/\\n/g if defined $topic->{description};
+    $topic->{example} =~ s/\n/\\n/g if defined $topic->{example};
+
+    print "$header($count,";
     print "$topic->{category}->{__id__},";
     print "\"$topic_name\",";
     print "\"$topic->{description}\",";
     print "\"$topic->{example}\",";
-    print "\"$topic->{url}\")";
+    print "\"$topic->{url}\");\n";
     $topics{$topic_name}->{__id__}= $count;
     $count++;
   }
-  printf ";\n\n";
+  printf "\n";
 }
 
 my @keywords_names= keys(%keywords);
@@ -409,11 +416,10 @@
   my $count= 0;
   foreach $keyword_name (@keywords_names)
   {
-    print_insert_header($count,$header);
-    print "($count,\"$keyword_name\")";
+    print "$header($count,\"$keyword_name\");\n";
     $count++;
   }
-  printf ";\n\n";
+  printf "\n";
     
   $header= "insert into help_relation ".
     "(help_topic_id,help_keyword_id) values ";
@@ -424,13 +430,12 @@
     my $topic_name;
     foreach $topic_name (keys(%{$keywords{$keyword_name}}))
     {
-      print_insert_header($count,$header);
-      print "($topics{$topic_name}->{__id__},$count_keyword)";
+      print "$header($topics{$topic_name}->{__id__},$count_keyword);\n";
       $count++;
     }
     $count_keyword++;
   }
-  printf ";\n\n";
+  printf "\n";
 }
 
 if ($count_errors)
@@ -942,15 +947,3 @@
                             $count_without_example." ~ ".
                             $percent_without_example."%)");
 }
-
-sub print_insert_header
-{
-  my($count,$header)= @_;
-    
-  if ($count % $insert_portion_size ne 0) {
-    print ",";
-  } else {
-    print ";\n" if ($count ne 0);
-    print "$header";
-  }
-}

Thread
svn commit - mysqldoc@docsrva: r592 - in trunk: . toolspaul19 Dec