List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:February 9 2011 7:17pm
Subject:bzr commit into wex-installer-1.0 branch (reggie.burnett:323)
View as plain text  
#At file:///C:/Users/Reggie/work/wex/installer-updated/ based on revid:reggie.burnett@stripped

  323 Reggie Burnett	2011-02-09
      - added schema to world sql
      - commented out some db in the installer until we get them working
      - added examples to 5.1 and 5.5 catalog for testing
      - got basic examples db plugin working

    modified:
      Examples/Product.wxs
      Examples/Sample DB/world.sql
      Examples/Sample DB/world_innodb.sql
      Setup_Net/products.xml
      StandardPlugins/Examples/ConfigurationController.cs
      StandardPlugins/Properties/Resources.Designer.cs
      StandardPlugins/Properties/Resources.resx
      StandardPlugins/Server/ConfigurationController.cs
      WexInstaller.Core/ProductConfigurationController.cs
      WexInstaller.Core/RootPasswordPromptDlg.Designer.cs
      WexInstaller/InstallWizard/AllConfigOverview.cs
=== modified file 'Examples/Product.wxs'
=== modified file 'Examples/Product.wxs'
--- a/Examples/Product.wxs	2011-02-09 17:35:42 +0000
+++ b/Examples/Product.wxs	2011-02-09 19:17:23 +0000
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
-  <Product Id="46b63307-6f7c-4e85-a77b-fa97365df153" Name="Examples" Language="1033" Version="1.0.0.0" Manufacturer="Examples" UpgradeCode="8c8219cb-78a4-4af8-8d49-f36fb1fe3320">
+  <Product Id="46b63307-6f7c-4e85-a77b-fa97365df153" Name="MySQL Examples 5.1" Language="1033" Version="1.0.0.0" Manufacturer="Oracle" UpgradeCode="8c8219cb-78a4-4af8-8d49-f36fb1fe3320">
     <Package InstallerVersion="200" Compressed="yes" />
 
     <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
@@ -20,11 +20,17 @@
                   <RegistryValue Name="Sample Databases" Value="[SampleDBFolder]" Type="string"/>
                 </RegistryKey>
               </Component>
-              <Component Id="WorldDBComponent" Guid="8BD6E222-AC47-4FD0-96A6-7EEA75D62A10">
-                <File Name="world.sql" Source="Sample DB\world.sql"/>
-                <File Name="world_innodb.sql" Source="Sample DB\world_innodb.sql"/>
-              </Component>
-              <Directory Id="MenagerieFolder" Name="Menagerie">
+              <Directory Id="Dir_SampleDbWorld" Name="World">
+                <Component Id="C_WorldDB" Guid="8BD6E222-AC47-4FD0-96A6-7EEA75D62A10">
+                  <File Name="world-schema.sql" Source="Sample DB\world.sql"/>
+                </Component>
+                </Directory>
+              <!--<Directory Id="Dir_SampleDbWorldInno" Name="World (InnoDB)">
+                <Component Id="C_WorldDBInno" Guid="D61AE9FB-1FA4-4106-8891-200BB64898A6">
+                  <File Name="world-inno-schema.sql" Source="Sample DB\world_innodb.sql"/>
+                </Component>
+              </Directory>-->
+              <!--<Directory Id="MenagerieFolder" Name="Menagerie">
                 <Component Id="MenagerieDBComponent" Guid="">
                   <File Name="cr_event_tbl.sql" Source="Sample DB\Menagerie\cr_event_tbl.sql"/>
                   <File Name="cr_pet_tbl.sql" Source="Sample DB\Menagerie\cr_pet_tbl.sql"/>
@@ -34,14 +40,14 @@
                   <File Name="pet.txt" Source="Sample DB\Menagerie\pet.txt"/>
                   <File Name="README.txt" Source="Sample DB\Menagerie\README.txt"/>
                 </Component>
-              </Directory>
-              <Directory Id="SakilaFolder" Name="Sakila">
+              </Directory>-->
+              <!--<Directory Id="SakilaFolder" Name="Sakila">
                 <Component Id="SakilaDBComponent" Guid="">
                   <File Name="sakila.mwb" Source="Sample DB\Sakila\sakila.mwb"/>
                   <File Name="sakila-data.sql" Source="Sample DB\Sakila\sakila-data.sql"/>
                   <File Name="sakila-schema.sql" Source="Sample DB\Sakila\sakila-schema.sql"/>
                 </Component>
-              </Directory>
+              </Directory>-->
             </Directory>
           </Directory>
         </Directory>
@@ -51,9 +57,10 @@
     <Feature Id="SampleDB" Title="Sample Databases" Level="1">
       <ComponentRef Id="C_RegistryKey"/>
       <ComponentRef Id="C_SampleDBRegistryKey"/>
-      <ComponentRef Id="WorldDBComponent" />
-      <ComponentRef Id="SakilaDBComponent" />
-      <ComponentRef Id="MenagerieDBComponent" />
+      <ComponentRef Id="C_WorldDB" />
+      <!--<ComponentRef Id="C_WorldDBInno" />-->
+      <!--<ComponentRef Id="SakilaDBComponent" />-->
+      <!--<ComponentRef Id="MenagerieDBComponent" />-->
 
       <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
       <ComponentGroupRef Id="Product.Generated" />

=== modified file 'Examples/Sample DB/world.sql'
--- a/Examples/Sample DB/world.sql	2011-02-08 21:23:56 +0000
+++ b/Examples/Sample DB/world.sql	2011-02-09 19:17:23 +0000
@@ -15,6 +15,10 @@
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 
+DROP SCHEMA IF EXISTS world;
+CREATE SCHEMA world;
+USE world;
+
 --
 -- Table structure for table `City`
 --

=== modified file 'Examples/Sample DB/world_innodb.sql'
--- a/Examples/Sample DB/world_innodb.sql	2011-02-08 21:23:56 +0000
+++ b/Examples/Sample DB/world_innodb.sql	2011-02-09 19:17:23 +0000
@@ -15,6 +15,10 @@
 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 
+DROP SCHEMA IF EXISTS `world-inno`;
+CREATE SCHEMA `world-inno`;
+USE `world-inno`;
+
 --
 -- Table structure for table `City`
 --

=== modified file 'Setup_Net/products.xml'
--- a/Setup_Net/products.xml	2011-02-09 13:49:30 +0000
+++ b/Setup_Net/products.xml	2011-02-09 19:17:23 +0000
@@ -17,6 +17,7 @@
         <CatalogProduct productId="connector-odbc" setupTypeFlags="1" />
         <CatalogProduct productId="connector-c" setupTypeFlags="1" />
         <CatalogProduct productId="connector-cpp" setupTypeFlags="1" />
+        <CatalogProduct productId="examples" setupTypeFlags="0"/>
       </CatalogProducts>
     </ProductCatalog>
     <ProductCatalog id="mysql-5.1-gpl" name="MySQL 5.1" description="MySQL 5.1 Community Edition" commercial="false">
@@ -32,6 +33,7 @@
         <CatalogProduct productId="connector-odbc" setupTypeFlags="1" />
         <CatalogProduct productId="connector-c" setupTypeFlags="1" />
         <CatalogProduct productId="connector-cpp" setupTypeFlags="1" />
+        <CatalogProduct productId="examples" setupTypeFlags="0"/>
       </CatalogProducts>
     </ProductCatalog>
   </ProductCatalogs>
@@ -142,7 +144,7 @@
                description="A collection of examples and sample databases to help a developer get started."
                upgradeId="8C8219CB-78A4-4AF8-8D49-F36FB1FE3320" urlBaseDir="examples">
         <Packages>
-          <Package type="MSI" arch="Any" filename="mysql-examples-1.0.0.msi" id="{46B63307-6F7C-4E85-A77B-FA97365DF153}" thisVersion="1.0.0">
+          <Package type="MSI" arch="X86" filename="mysql-examples-1.0.0.msi" id="{46B63307-6F7C-4E85-A77B-FA97365DF153}" thisVersion="1.0.0">
             <Feature name="SampleDB" title="Sample Databases" description="Some interesting sample databases" default="true" size="0" display="true" hasComponents="true" />
           </Package>
         </Packages>

=== modified file 'StandardPlugins/Examples/ConfigurationController.cs'
--- a/StandardPlugins/Examples/ConfigurationController.cs	2011-02-09 17:35:42 +0000
+++ b/StandardPlugins/Examples/ConfigurationController.cs	2011-02-09 19:17:23 +0000
@@ -11,45 +11,43 @@
 using System.Threading;
 using System.Diagnostics;
 using WexInstaller.Plugins.Properties;
+using Microsoft.Win32;
 
 namespace WexInstaller.Plugins
 {
     [ProductConfiguration("examples", 1)]
     public class ExamplesConfigurationController : ProductConfigurationController
     {
-        List<string> sampleDbNames = new List<string>();
+        InstallerPanel[] p = new InstallerPanel[1];
         ProductCatalog ourCatalog;
         Product serverProductInCatalog;
         bool alreadySearchedForServer;
         string connectionString;
-        List<string> featuresToConfigure = null;
+        List<SampleDatabase> databasesToInstall = null;
 
         public List<ServerProductConfigurationController> Servers = new List<ServerProductConfigurationController>();
         
         public override int NumPages
         {
-            get { return 0; }
+            get { return 1; }
         }
 
         public override UserControl[] Pages
         {
-            get { return null; }
+            get { return p; }
         }
 
-        public override void Initialize()
+        public override void  Initialize()
         {
-            sampleDbNames.Add("World");
-            sampleDbNames.Add("World (InnoDB)");
-            sampleDbNames.Add("Sakila");
-            sampleDbNames.Add("Menagerie");
+            p[0] = new InstallerPanel();
         }
 
         protected override void BackgroundConfigure(object sender, DoWorkEventArgs e)
         {
             // determine if we have any features to configure
-            if (featuresToConfigure == null)
+            if (databasesToInstall == null)
                 CheckForFeaturesToConfigure();
-            if (featuresToConfigure.Count == 0)
+            if (databasesToInstall.Count == 0)
             {
                 ReportStatus(ConfigurationEventType.Success, null, Resources.ConfigSuccessNoFeaturesToConfig, 100);
                 return;
@@ -100,19 +98,71 @@
         /// </summary>
         private void CheckForFeaturesToConfigure()
         {
-            featuresToConfigure = new List<string>();
+            databasesToInstall = new List<SampleDatabase>();
 
             ReportStatus(ConfigurationEventType.Info, null, Resources.ConfigInfoCheckingFeaturesToConfigure, 10);
-            foreach (ProductFeature feature in Owner.GetProductFeatures())
-            {
-                string lowerFeatureName = feature.Name.ToLowerInvariant();
-                if (lowerFeatureName.StartsWith("sampledb_") && feature.Installed)
-                    featuresToConfigure.Add(feature.Name);
+
+            string sampleDbLocation = Owner.GetInstalledProductRegistryKey("Sample Databases");
+            if (String.IsNullOrEmpty(sampleDbLocation))
+            {
+                ReportStatus(ConfigurationEventType.Info, null, Resources.ConfigInfoNoSampleDbsToConfigure, 10);
+                return;
+            }
+
+            string[] sampleDirs = Directory.GetDirectories(sampleDbLocation);
+            foreach (string dir in sampleDirs)
+            {
+                SampleDatabase db = new SampleDatabase();
+                db.Path = dir;
+                db.Installed = false;
+                string[] files = Directory.GetFiles(dir);
+                foreach (string file in files)
+                {
+                    string lowerFile = file.ToLowerInvariant();
+                    if (lowerFile.EndsWith("-schema.sql"))
+                        db.SchemaFile = file;
+                    else if (lowerFile.EndsWith("-data.sql"))
+                        db.DataFile = file;
+                }
+                if (!String.IsNullOrEmpty(db.SchemaFile))
+                    databasesToInstall.Add(db);
             }
         }
 
         private void RunDatabaseScripts()
         {
+            using (MySqlConnection connection = new MySqlConnection(connectionString))
+            {
+                connection.Open();
+                MySqlScript script = new MySqlScript(connection);
+                foreach (SampleDatabase db in databasesToInstall)
+                {
+                    if (db.Installed) continue;
+                    if (String.IsNullOrEmpty(db.SchemaFile)) continue;
+
+                    try
+                    {
+                        StreamReader sr = new StreamReader(db.SchemaFile);
+                        string sql = sr.ReadToEnd();
+                        script.Query = sql;
+                        int processed = script.Execute();
+
+                        if (!String.IsNullOrEmpty(db.DataFile))
+                        {
+                            sr = new StreamReader(db.DataFile);
+                            sql = sr.ReadToEnd();
+                            script.Query = sql;
+                            processed = script.Execute();
+                        }
+                        db.Installed = true;
+                    }
+                    catch (Exception ex)
+                    {
+                        //TODO:  improve this
+                        ReportError(null, "Error installing sample database");
+                    }
+                }
+            }
         }
 
         private Product GetServerProductInCatalog()
@@ -158,4 +208,12 @@
             return null;
         }
     }
+
+    class SampleDatabase
+    {
+        public string Path;
+        public string SchemaFile;
+        public string DataFile;
+        public bool Installed;
+    }
 }

=== modified file 'StandardPlugins/Properties/Resources.Designer.cs'
--- a/StandardPlugins/Properties/Resources.Designer.cs	2011-02-09 17:35:42 +0000
+++ b/StandardPlugins/Properties/Resources.Designer.cs	2011-02-09 19:17:23 +0000
@@ -132,6 +132,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to No sample databases were found to configure.
+        /// </summary>
+        internal static string ConfigInfoNoSampleDbsToConfigure {
+            get {
+                return ResourceManager.GetString("ConfigInfoNoSampleDbsToConfigure", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to There are no features installed that need configuration..
         /// </summary>
         internal static string ConfigSuccessNoFeaturesToConfig {

=== modified file 'StandardPlugins/Properties/Resources.resx'
--- a/StandardPlugins/Properties/Resources.resx	2011-02-09 17:35:42 +0000
+++ b/StandardPlugins/Properties/Resources.resx	2011-02-09 19:17:23 +0000
@@ -181,4 +181,7 @@
   <data name="ConfigSuccessNoFeaturesToConfig" xml:space="preserve">
     <value>There are no features installed that need configuration.</value>
   </data>
+  <data name="ConfigInfoNoSampleDbsToConfigure" xml:space="preserve">
+    <value>No sample databases were found to configure</value>
+  </data>
 </root>
\ No newline at end of file

=== modified file 'StandardPlugins/Server/ConfigurationController.cs'
--- a/StandardPlugins/Server/ConfigurationController.cs	2011-02-09 14:52:59 +0000
+++ b/StandardPlugins/Server/ConfigurationController.cs	2011-02-09 19:17:23 +0000
@@ -415,9 +415,25 @@
         /// ========================================================================
         public override bool IsRunning
         {
-            get { return true; }
-        }
-
+            get 
+            {
+                string location = Owner.GetInstalledProductRegistryKey("Location");
+                string binary = String.Format(@"{0}bin\mysqld.exe", location);
+                return IsProcessRunning(binary);
+            }
+        }
+
+        private bool IsProcessRunning(string binaryPath)
+        {
+            string path = binaryPath.ToLowerInvariant();
+
+            foreach (Process p in Process.GetProcesses())
+            {
+                if (!p.ProcessName.Contains("mysqld")) continue;
+                if (p.MainModule.FileName.ToLowerInvariant() == path) return true;
+            }
+            return false;
+        }
     }
 
     public enum ServerInstallType

=== modified file 'WexInstaller.Core/ProductConfigurationController.cs'
--- a/WexInstaller.Core/ProductConfigurationController.cs	2011-02-09 17:35:42 +0000
+++ b/WexInstaller.Core/ProductConfigurationController.cs	2011-02-09 19:17:23 +0000
@@ -73,7 +73,7 @@
             ConfigurationEventArgs args = new ConfigurationEventArgs(type, action);
             args.Details = details;
             args.PercentComplete = progress;
-            OnConfigured(args);
+            bgw.ReportProgress(progress, args);
         }
 
         protected void ReportError(string action, string details)

=== modified file 'WexInstaller.Core/RootPasswordPromptDlg.Designer.cs'
--- a/WexInstaller.Core/RootPasswordPromptDlg.Designer.cs	2011-02-09 13:49:30 +0000
+++ b/WexInstaller.Core/RootPasswordPromptDlg.Designer.cs	2011-02-09 19:17:23 +0000
@@ -29,13 +29,13 @@
         private void InitializeComponent()
         {
             this.panel1 = new System.Windows.Forms.Panel();
+            this.password = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.username = new System.Windows.Forms.TextBox();
+            this.pictureBox1 = new System.Windows.Forms.PictureBox();
+            this.label1 = new System.Windows.Forms.Label();
             this.largeTitle = new System.Windows.Forms.Label();
-            this.label1 = new System.Windows.Forms.Label();
-            this.pictureBox1 = new System.Windows.Forms.PictureBox();
-            this.username = new System.Windows.Forms.TextBox();
-            this.label2 = new System.Windows.Forms.Label();
-            this.label3 = new System.Windows.Forms.Label();
-            this.password = new System.Windows.Forms.TextBox();
             this.cancelButton = new System.Windows.Forms.Button();
             this.loginButton = new System.Windows.Forms.Button();
             this.panel1.SuspendLayout();
@@ -58,6 +58,58 @@
             this.panel1.Size = new System.Drawing.Size(443, 193);
             this.panel1.TabIndex = 0;
             // 
+            // password
+            // 
+            this.password.Location = new System.Drawing.Point(279, 126);
+            this.password.Name = "password";
+            this.password.PasswordChar = '*';
+            this.password.Size = new System.Drawing.Size(122, 22);
+            this.password.TabIndex = 6;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(211, 129);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(62, 14);
+            this.label3.TabIndex = 5;
+            this.label3.Text = "Password:";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(128, 99);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(145, 14);
+            this.label2.TabIndex = 4;
+            this.label2.Text = "Root Account Username:";
+            // 
+            // username
+            // 
+            this.username.Location = new System.Drawing.Point(279, 96);
+            this.username.Name = "username";
+            this.username.Size = new System.Drawing.Size(122, 22);
+            this.username.TabIndex = 3;
+            // 
+            // pictureBox1
+            // 
+            this.pictureBox1.Image = global::WexInstaller.Core.Properties.Resources.Server_Reflection;
+            this.pictureBox1.Location = new System.Drawing.Point(50, 94);
+            this.pictureBox1.Name = "pictureBox1";
+            this.pictureBox1.Size = new System.Drawing.Size(59, 63);
+            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
+            this.pictureBox1.TabIndex = 2;
+            this.pictureBox1.TabStop = false;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(25, 51);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(248, 14);
+            this.label1.TabIndex = 1;
+            this.label1.Text = "Login as a user with root account privileges.";
+            // 
             // largeTitle
             // 
             this.largeTitle.AutoSize = true;
@@ -69,58 +121,6 @@
             this.largeTitle.TabIndex = 0;
             this.largeTitle.Text = "Please provide a MySQL Server 5.5 Login";
             // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(25, 51);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(248, 14);
-            this.label1.TabIndex = 1;
-            this.label1.Text = "Login as a user with root account privileges.";
-            // 
-            // pictureBox1
-            // 
-            this.pictureBox1.Image = global::WexInstaller.Core.Properties.Resources.Server_Reflection;
-            this.pictureBox1.Location = new System.Drawing.Point(50, 94);
-            this.pictureBox1.Name = "pictureBox1";
-            this.pictureBox1.Size = new System.Drawing.Size(59, 63);
-            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
-            this.pictureBox1.TabIndex = 2;
-            this.pictureBox1.TabStop = false;
-            // 
-            // username
-            // 
-            this.username.Location = new System.Drawing.Point(279, 96);
-            this.username.Name = "username";
-            this.username.Size = new System.Drawing.Size(122, 22);
-            this.username.TabIndex = 3;
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(128, 99);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(145, 14);
-            this.label2.TabIndex = 4;
-            this.label2.Text = "Root Account Username:";
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(211, 129);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(62, 14);
-            this.label3.TabIndex = 5;
-            this.label3.Text = "Password:";
-            // 
-            // password
-            // 
-            this.password.Location = new System.Drawing.Point(279, 126);
-            this.password.Name = "password";
-            this.password.PasswordChar = '*';
-            this.password.Size = new System.Drawing.Size(122, 22);
-            this.password.TabIndex = 6;
-            // 
             // cancelButton
             // 
             this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
@@ -155,6 +155,7 @@
             this.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
             this.Name = "RootPasswordPromptDlg";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
             this.Text = "Configuration";
             this.panel1.ResumeLayout(false);
             this.panel1.PerformLayout();

=== modified file 'WexInstaller/InstallWizard/AllConfigOverview.cs'
--- a/WexInstaller/InstallWizard/AllConfigOverview.cs	2011-02-09 14:52:59 +0000
+++ b/WexInstaller/InstallWizard/AllConfigOverview.cs	2011-02-09 19:17:23 +0000
@@ -182,6 +182,7 @@
         private void productList_MouseDown(object sender, MouseEventArgs e)
         {
             ListViewHitTestInfo lvihti = productList.HitTest(e.Location);
+            if (lvihti.Item == null) return;
 
             if (lvihti.SubItem.Text == "Retry")
             {


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110209191723-eawszmot2dyyqw8j.bundle
Thread
bzr commit into wex-installer-1.0 branch (reggie.burnett:323) Reggie Burnett9 Feb