Exemple #1
0
        /// <summary>
        /// Method itry to drop and create table
        /// </summary>
        /// <param name="prefix">Project prefix</param>
        /// <param name="tableName">Table name</param>
        /// <param name="tableType">New columns types</param>
        /// <param name="columns">New table columns</param>
        /// <param name="drop">If true table with the same name will be drop</param>
        private static string tryCreateTable(string prefix, string tableName, string tableType, string columns, bool drop)
        {
            if (tableName != "" && tableType != "" && columns != "")
            {
                Result result;

                if (tableType == "DIMENSION")
                {
                    if (drop == true)
                    {
                        DimensionHandler.dropDimension(prefix, tableName);
                    }
                    result = DimensionHandler.addDimension(tableName, columns, prefix);
                    if (result.errormsg != "OK")
                    {
                        return("Import status: Cannot create table. Please check if old table contains foreign keys or if all required inforamtion are correct.");
                    }
                    return("OK");
                }
                else
                {
                    if (drop == true)
                    {
                        FactHandler.dropFact(prefix, tableName);
                    }
                    result = FactHandler.addFact(tableName, columns, prefix);
                    if (result.errormsg != "OK")
                    {
                        return("Import status: Cannot create table. Please check if old table exists or contains foreign keys or if all required inforamtion are correct.");
                    }
                    return("OK");
                }
                if (tableType == "FUNCTION")
                {
                    if (drop == true)
                    {
                        FunctionHandler.dropFunction(prefix + "_" + tableType + "_" + tableName);
                    }
                    result = FunctionHandler.addFunction(tableName, columns, prefix);
                    if (result.errormsg != "OK")
                    {
                        return("Import status: Cannot create table. Please check if old table exists or contains foreign keys or if all required inforamtion are correct.");
                    }
                    return("OK");
                }
            }
            return("Import status: Please check if csv contains all required information - table type, table name and columns name with types");
        }
Exemple #2
0
 private void BtnDrop_Click(object sender, RoutedEventArgs e)
 {
     FunctionHandler.dropFunction(table);
     Switcher.Switch(new ProjectPage(2));
 }